Wednesday, February 29, 2012

Low Hanging Fruit

We spend a lot of time watching what is going on in the world.  One of the advantages of having a customer-based intelligence sharing program as well as a distribution of our own sensors in the wild is that we are able to watch as threats change.  When new threats come into play, or when existing threats change, rules have to be created or modified.  Over the next few weeks, we're going to share some of the rules we've written in response to these threats and go over why we chose to write them in the way we did.  Hopefully this will help you in your custom rule-writing.

Every now and then the bad guys pitch you a softball and you shouldn't be so wrapped up in fancy rule writing to let that one go by.  But even simple rules can trip you up.  Case in point: I've seen the following string in PDF files in several different exploit kit chains:

C:\Users\Andrew\Desktop\NEW PDF EXPLOIT\blank.txt

So here was my initial rule:

alert tcp $EXTERNAL_NET $FILE_DATA_PORTS -> $HOME_NET any (msg:"SPECIFIC-THREATS Possible malicious pdf -- new pdf exploit"; flow:to_client,established; flowbits:isset,file.pdf; file_data; content:"NEW PDF EXPLOIT"; fast_pattern:only; metadata:policy balanced-ips drop, policy security-ips drop, service http; classtype:attempted-user; sid:21431; rev:2;)

So, this rule has a couple of things worth mentioning.  First, the rule is written with $FILE_DATA_PORTS.  This means that we look at it over HTTP, POP and IMAP.  So a PDF matching this over any of those vectors will trigger the rule.  Next we have flowbits:isset,file.pdf;. This rule option checks to make sure that Snort has seen enough to know that this is a PDF file.  That way, this web page won't trigger the rule.

Another thing to notice is that the content match for "NEW PDF EXPLOIT" is followed by fast_pattern:only;.  Normally, Snort uses the first, longest content match as the content for the fast pattern matcher.  This content becomes the triggering condition to enter full rule evaluation.  The fast_pattern; option overrides that, telling Snort to use the associated content match in the pattern matcher, not the first, longest content.  This rule has only one content match, so that functionality isn't important here.  Instead, I used the functionality of the "only" modifier to fast_pattern to eek out a little speed increase in rule performance.

Using fast_pattern:only; instructs Snort not to look for the content during rule evaluation, as that content has already been seen during fast pattern matching.  It is important to know that because the fast pattern matcher is case agnostic, any match that is marked as fast_pattern:only; acts as if it had the nocase; modifier.  Also, this modifier can only be used when the content match is not associated with a relative match, because when Snort doesn't look for the content during rule evaluation it doesn't know where the content is in the packet, so relative content matches won't work.  Using the fast_pattern:only; construct means that when the rule enters evaluation, the only checks are for flow direction (making sure the packet is moving from a server to a client) and ensuring that the flowbit for pdf files has been set.  This makes for very fast rule evaluation.

But there is a problem with this rule.  Notice the file_data; keyword.  This keyword ensures that the content match occurs in the part of the stream that is the actual file (for example, after the HTTP header) and ensures that the content is matched against the decoded file data buffer.  Fast pattern matches occur over all buffers, so we would still use the decoded file buffer, but we would like to ensure that the content match is in the right place.  To do this, remove the fast_pattern:only; keyword, allowing the file_data; keyword to properlly enforce location.  The final rule is this:

alert tcp $EXTERNAL_NET $FILE_DATA_PORTS -> $HOME_NET any (msg:"SPECIFIC-THREATS Possible malicious pdf -- new pdf exploit"; flow:to_client,established; flowbits:isset,file.pdf; file_data; content:"NEW PDF EXPLOIT"; metadata:policy balanced-ips drop, policy security-ips drop, service http; classtype:attempted-user; sid:21431; rev:3;)

The wild, wild west of the Internet is moving very quickly right now.  In particular, exploit kits morph almost day-to-day.  Having a firm understanding of how the various rule keywords work together is important to build the detection you need.  Hopefully this blog post gave you a little insight into the rule-writing process.  We'll be putting together more posts going forward that give slightly more complicated examples. Stay tuned!

Friday, February 24, 2012

Razorback Appliance - Getting Started

With the recent release of Razorback 0.4.1 we decided to update the Virtual Appliance image to this release.  The target audience for the appliance is people that want to test drive the system without going though the process of installing the system and its dependencies.

You can down load the appliance from SourceForge here: http://sfi.re/xTH1nH

The virtual appliance is based on FreeBSD 9.0 (i386) and requires 4GB of RAM on your host and 20-30GB of hard disk space.  We build the VM in VMWare ESXi, but it should run on any hypervisor that can import an Open Virtualization Format archive (OVA) virtual machine; in this guide I will be using VirtualBox.

The appliance ships with the following components:
  • Razorback Dispatcher
  • Razorback Master Nugget
    • Archive Inflate Nugget
    • ClamAV Nugget
    • File Log Nugget (disabled by default, test/sample nugget)
    • Flash Inspector Nugget
    • OfficeCat Nugget - More info: http://sfi.re/yYHpRs
    • PDF Dissector Nugget (disabled by default requires aditional installation steps)
    • PDF Fox (disabled by default, beta release)
    • Script Nugget
    • Syslog Output Nugget
    • Virus Total Nugget (disabled by default, requires API key).
    • Yara Nugget - More info: http://sfi.re/zkPxcl 
  • Razorback Web Interface
  • File Inject
  • File System Walk
  • Snort 2.9.1.1 with Razorback Collection
  • Systems Management Web Interface (Based on FreeNAS interface)
  • MySQL Server
  • Memcached Server
  • ActiveMQ Server

Importing the appliance

Select the following menu option based on your hypervisor:
  • VMWare Workstation - File->Open
  • VMWare vCenter (ESXi) - File->Deploy OVF Template
  • VirtualBox - File->Import Appliance
Select the OVA file that you have downloaded and follow the prompts to deploy the machine; if you are asked if you would like to reset the VM's network cards' MAC addresses at any point you should select yes (or tick the box in the case of VirtualBox).

After you have installed the appliance you can start it up and you should be presented with a screen like this:


If you see a bunch of output related to masterNugget or dispatcher then you may just hit return and the menu should present its self.

Now we need to set up a username and password to access the system, open your browser and enter the address for the management web interface (in this case http://10.7.1.56:8080). You should be presented with the following screen:


Now click the large account button in the top right, and select change password from the tabs in the window that opens:


Enter your new password  and confirmation leaving old password blank. Make sure that "Change root password as well" is selected and click the "Change Admin Password" button.  Now the Alert button in the top right should be solid green rather than flashing red.

Next we need to configure the network interface of the VM. Expand the network item in the tree on the left, and then the Interfaces sub item and select "Add Interface":


Configure the interface to fit your environment (I'm using DHCP in the example) and click ok. If you are moving to a static IP configuration you will need to go the the "Global Configuration" item under network and set your default gateway and name servers.

Now we need to add a user to the system to allow access to the Razorback web interface, to do this expand the Account item in the tree on the left, and then the Users item and select "Add User":


In this example we are adding a user that can only access the web interface so we select the following options:
  • Primary Group - nogroup
  • Home Directory - /nonexistent
  • Shell - nologin
Now you should reboot the appliance to make sure that the network configuration changes took. Select "Reboot" from the menu.

Once the machine has rebooted you should be able to log into the razorback web interface by browsing to the URL listed on the boot menu (in this case, http://10.7.1.56/).

You should be presented with a screen like so:



Changing active inspection nuggets:

Log into the system web interface with the admin user (whose password we set earlier). Expand the Razorback element in the tree and select "Control Nuggets".


To change the configuration items for a nugget click the spanner icon next to the on/off switch.

To turn a nugget on or off just click on the on/off button, your changes should be reflected on the razorback interface under nugget status.

Enabling Snort for traffic capture:

To do this we need to add a capture interface to the appliance, making sure that you enable promiscuous mode for the interface.




You will need to make the following changes based on your hypervisor:
  • VMWare ESXi - Change the configuration of the vSwitch and the port to allow promiscuous mode for the interface.
  • VMWare Workstation - Follow this guide to enable promiscuous for a guest: http://sfi.re/whE6dR
  • VirtualBox - Select "Allow All" under Advanced->Promiscuous Mode as shown above.
After you have added the interface, start the virtual machine and log into the admin interface.  Expand the Services item in the navigation tree and select "Control Services", then click on the on/off switch next to Snort to enable the service:


The appliance also supports inline traffic capture, follow these steps to enable it:
  1. Add a third interface to the appliance connected to your second virtual network.
  2. Select shell from the system console.
  3. Editing /etc/rc.conf:
    1. Comment out the lines starting ifconfig_em1 and snort_interface under the heading "TAP/Span interface on em1".
    2. Un-comment the lines under "Inline configuration em1+em2".
  4. Reboot the appliance.

More information about the appliance can be found here: http://sfi.re/ws6diq 

Thursday, February 23, 2012

A FABULOUS policy rule

Lots of people in the security space are familiar with the blog of Brain Krebs, a former Washington Post network security writer and one of a tiny number of IT security journalists who actually gets it. If you're not following him on Twitter (@briankrebs), you should be.

Especially after today's awesome tweet:

"Don't look now (seriously, don't unless you're ninja) but Twilight author Stephanie Meyer's site appears 2b serving up Crimepack Exploit kit"

I was just lucky enough to notice this tweet within moments of it being sent out. As someone who hates sparkly vampires, I immediately went out and did a wget of the site in question, and pulled down an awesome PCAP. Besides having bad 90s-era HTML, the site was indeed infected with a bad case of the Crimepack Exploit Kit, as Mr. Krebs had noted.

While the VRT is busy adding more exploit kit rules - and please, if you have good intel on any of them, email us at research <at> sourcefire <dot> com - I figured I'd run it through the rule set to see if we had it covered. We did - SID 21039, which looks for a common form of JavaScript obfuscation, took care of matters. We'll be following up with a more detailed analysis of the exploit kit itself, to see if we can add more aggressive rules that even the most conservative CSO types feel comfortable running.

In the meantime, pay attention as you're browsing the Internet - you never know what sort of evil awaits you, even in the lamest of its corners.

Tuesday, February 21, 2012

ClamAV vs. Content IQ Test, part 1

This is the first in a series of blog posts about the Content IQ Test.

A few days ago, we came across a test whose purpose is to gauge a security system's ability to detect client-side attacks. The Content IQ Test consists of detecting a set of test files that contain, at various levels of depth within the file, the string:

target string

The rules of the test are simple: "The objective is to create a single content rule that fires on all of the Test Files but not on any of the Negative Control files. [...]Triggering on the test files' [...] filenames or MD5 hashes and stuff like that is cheating and it doesn't count. "

Let's see how ClamAV does at this.

These files are all benign, so I encourage you to download and check out how these files are crafted.

Test File 1 is a plain text file containing the target string surrounded by some filler text. I crafted an ndb-style signature to target the eval+unescape string. Moreover, the signature below targets normalized ASCII text files:

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c28756e6573636170652827253635253736253639253663253238253239272929

[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_1_Plain_Text_File.txt 
Test_File_1_Plain_Text_File.txt: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 1.00:1)
Time: 0.008 sec (0 m 0 s)

[email protected]:~/Downloads$ clamscan -r -d test.ndb Test_File_1_Negative_Control.txt 
Test_File_1_Negative_Control.txt: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.01 MB
Data read: 0.00 MB (ratio 2.00:1)
Time: 0.010 sec (0 m 0 s)

OK, we are detecting the control file and are not detecting the negative control file. Let's proceed!

Test file 2 contains the control text pasted into the body of a Microsoft Word 2011 document.

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c28756e6573636170652827253635253736253639253663253238253239272929

[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_2_Microsoft_Word_2011.docx
Test_File_2_Microsoft_Word_2011.docx: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.01 MB
Data read: 0.17 MB (ratio 0.05:1)
Time: 0.011 sec (0 m 0 s)

[email protected]:~/Downloads$ clamscan -r -d test.ndb Test_File_2_Negative_Control.docx 
Test_File_2_Negative_Control.docx: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.59 MB
Data read: 0.17 MB (ratio 3.41:1)
Time: 0.028 sec (0 m 0 s)


It makes sense that ClamAV would alert on such a file with a signature targeting normalized ASCII text files. That's because Office Open XML is a compressed (zip), XML-based file format (docx, xlsx, pptx, etc...). ClamAV treats the file as a zip archive and extracts its contents. It's then able to "see":

What ClamAV sees for test file 2

Test file 3 contains the control text pasted into the body of a Microsoft Excel 2011 document.

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c28756e6573636170652827253635253736253639253663253238253239272929

[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_3_Microsoft_Excel_2011.xlsx 
Test_File_3_Microsoft_Excel_2011.xlsx: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.00 MB
Data read: 0.04 MB (ratio 0.10:1)
Time: 0.010 sec (0 m 0 s)

[email protected]:~/Downloads$ clamscan -r -d test.ndb Test_File_3_Negative_Control.xlsx 
Test_File_3_Negative_Control.xlsx: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.09 MB
Data read: 0.04 MB (ratio 2.20:1)
Time: 0.016 sec (0 m 0 s)

Test file 4 contains the control text pasted into the body of a Microsoft PowerPoint 2011 document.

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c28756e6573636170652827253635253736253639253663253238253239272929
[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_4_Microsoft_PowerPoint_2011.pptx 
Test_File_4_Microsoft_PowerPoint_2011.pptx: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.36 MB
Data read: 0.08 MB (ratio 4.65:1)
Time: 0.024 sec (0 m 0 s)

Using the signature in test.ndb, ClamAV failed to pick up the target string inside the pptx file. Using clamscan with the option --leave-temps, you'll notice that in the case of this PowerPoint file, ClamAV "sees":

What ClamAV sees for test file 4

Therefore, I modified the signature alerts if we see "eval" followed by "unescape" no farther than 200 bytes away, in turn followed by "('%65%76%69%6c%28%29'))" no farther than 200 away from "unescape".

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c{-200}756e657363617065{-200}2827253635253736253639253663253238253239272929
[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_4_Microsoft_PowerPoint_2011.pptx 
Test_File_4_Microsoft_PowerPoint_2011.pptx: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.08 MB
Data read: 0.08 MB (ratio 1.05:1)
Time: 0.013 sec (0 m 0 s)

[email protected]:~/Downloads$ clamscan -r -d test.ndb Test_File_4_Negative_Control.pptx 
Test_File_4_Negative_Control.pptx: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.36 MB
Data read: 0.08 MB (ratio 4.65:1)
Time: 0.025 sec (0 m 0 s)


Test file 5 contains the control text pasted into the body of a PDF document.

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c{-200}756e657363617065{-200}282725363525373625363925366325323825323927

[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_5_Control_Text_in_Body_of_PDF_File.pdf 
Test_File_5_Control_Text_in_Body_of_PDF_File.pdf: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.00 MB
Data read: 0.02 MB (ratio 0.25:1)
Time: 0.009 sec (0 m 0 s)


[email protected]:~/Downloads$ clamscan -r -d test.ndb Test_File_5_Negative_Control.pdf 
Test_File_5_Negative_Control.pdf: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.04 MB
Data read: 0.02 MB (ratio 2.75:1)
Time: 0.012 sec (0 m 0 s)

ClamAV generates an alert because it's able to parse some PDF objects. In this particular case, it's able to "see":

What ClamAV sees for test file 5

Test file 6 contains the control file embedded into a PDF document. In a similar way to how Test file 5 was handled, we have:

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c{-200}756e657363617065{-200}282725363525373625363925366325323825323927

[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_6_Control_File_Attached_to_PDF_File.pdf 
Test_File_6_Control_File_Attached_to_PDF_File.pdf: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.00 MB
Data read: 0.02 MB (ratio 0.25:1)
Time: 0.012 sec (0 m 0 s)


[email protected]:~/Downloads$ clamscan -r -d test.ndb Test_File_6_Negative_Control.pdf 
Test_File_6_Negative_Control.pdf: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.02 MB
Data read: 0.01 MB (ratio 1.67:1)
Time: 0.014 sec (0 m 0 s)


Test file 7 contains the control file compressed with Zip.

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c{-200}756e657363617065{-200}282725363525373625363925366325323825323927
[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_7_Control_File_Compressed_with_Zip.zip
Test_File_7_Control_File_Compressed_with_Zip.zip: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 0.011 sec (0 m 0 s)
[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_7_Negative_Control.zip
Test_File_7_Negative_Control.zip: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.01 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 0.053 sec (0 m 0 s)


We see that a ZIP archive is treated as a container. Its contents are inflated and examined.

Test file 8 contains the control text pasted into the body of a Microsoft Word 2011 document. This Word document is compressed with Zip, then Tar, then RAR.

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c{-200}756e657363617065{-200}282725363525373625363925366325323825323927
[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_8_Word_File_Compressed_with_Zip_Tar_and_Rar.rar 
Test_File_8_Word_File_Compressed_with_Zip_Tar_and_Rar.rar: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.01 MB
Data read: 0.16 MB (ratio 0.05:1)
Time: 0.108 sec (0 m 0 s)
[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_8_Negative_Control.rar 
Test_File_8_Negative_Control.rar: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.43 MB
Data read: 0.02 MB (ratio 18.17:1)
Time: 0.081 sec (0 m 0 s)


As with Test file 7, archive files are treated as the containers they are. Here, ClamAV recursively extracts the contents of the RAR, TAR and ZIP files.

Finally, Test file 9 contains the target string embedded in the metadata of an Excel 2011 file as a custom property.

[email protected]:~/Downloads$ cat test.ndb 
TestSig1:7:*:6576616c{-200}756e657363617065{-200}282725363525373625363925366325323825323927
[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_9_Target_String_in_Custom_Properties_of_Excel_File.xlsx 
Test_File_9_Target_String_in_Custom_Properties_of_Excel_File.xlsx: TestSig1.UNOFFICIAL FOUND

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.03 MB
Data read: 0.03 MB (ratio 0.88:1)
Time: 0.045 sec (0 m 0 s)
[email protected]:~/Downloads$ clamscan -d test.ndb Test_File_9_Negative_Control.xlsx 
Test_File_9_Negative_Control.xlsx: OK

----------- SCAN SUMMARY -----------
Known viruses: 1
Engine version: 0.97.3
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.04 MB
Data read: 0.01 MB (ratio 3.33:1)
Time: 0.043 sec (0 m 0 s)

This is what ClamAV "sees":

What ClamAV sees for test file 9


Today we saw how ClamAV fared with the basic content test files. In the next post I'll take a look at the test files with auto-executing embedded active content.

Friday, February 17, 2012

An Exploit Kit Was Sent To You

Unless you've got the world's best spam filter, you've probably seen one of the latest spam techniques used by malware-dropping bad guys: what appears to be an automated email informing you that a multi-function scanner/copier was used to send you a document. It's a smart concept - using your office's big Xerox machine to scan and email in a single step is pretty commonplace these days - even if the execution is often poor. Take, for example, this sample that hit one of our team-wide accounts the other day:

=================================================================
A Document was sent to you using a XEROX CORPORACE FSX43949461.
SENT BY : Abdullah
IMAGES : 1
FORMAT (.JPEG) VIEW

DEVICE: PODA20971LD5PO13911L
=================================================================
A Document was sent to you using a XEROX CORPORACE FSX43949461.
SENT BY : Abdullah
IMAGES : 1
FORMAT (.JPEG) VIEW

DEVICE: PODA20971LD5PO13911L
=================================================================

Most people just delete bad phish like these; we here at the VRT, however, like to play with them. We'd been chasing down the links on this particular flavor of email for a while, but they'd been so transient that by the time we'd clicked the links, we got nothing but 404s or dead domains. In the case above, however, we were rewarded with a heavily obfuscated chunk of JavaScript:



The resulting ownage was classic. After briefly displaying a circa-1995-looking "Loading...Please Wait..." atop the page for a moment, the browser window went away, and the virtual machine's hard drive suddenly started cranking very heavily. Looking at the packet capture, the system immediately contacted a host in Russia, and started communicating over HTTP on port 8801; several files came down, including one named "yrkrktxzfniq.exe". A quick look at that file on VirusTotal showed that it was - surprise, surprise - malicious, and goes by the name of Worm.Cridex.

The exploit kit was easy enough to detect - SID 21108 does the job - given how blatant the obfuscation was. While we're busy working on more complex kits, such as Blackhole (see SIDs 21041 - 21045, 21141, and 21259), it's nice to be able to pick off less sneaky ones like this.

Thursday, February 16, 2012

Agile Security

Up until this past year, I had never included any marketing materials in my slides.  It never seemed to fit in with a technical presentation, even though I always believed in the Sourcefire product line's ability to defend our customers in the face of a rapidly changing landscape.  Having open source solutions, backed by the VRT's ability to convert real-world intelligence into new detection, while still giving the customer the option to build their own custom detection is a powerful combination.  But now our company has come up with a corporate vision and marketing message that speaks directly to how successful organizations approach security and I am really impressed.

We call it "Agile Security" and it basically describes a security cycle that is critical to keeping network defense up-to-date in a changing threat environment. It recognizes that static defenses simply can't stand up to the realities of today's security environment and that the ability to monitor dynamic networks is just the first step in a successful security stance. It also is an excellent description of how the VRT approaches converting its streams of intelligence into protection for our customers.

The concepts of Agile Security are broken up into four essential elements. The first is "See", meaning that you can't protect yourself if you don't have a current understanding of what is is you're trying to defend. With the encroachment into the network by consumer electronics in the form of smart phones, tablets and laptops along with the rapid turn over of technology in today's corporate environment this can be difficult. Organizations can use active or passive techniques for tracking changes in network topology as well as new devices as they come online, but whatever the approach it is critical to know what you're defending right now.

The second element of Agile Security is "Learn", which focuses on gathering information about vulnerabilities, exploits and malware that threaten your environment. This is where you leverage your understanding of your network to map known threats to vulnerable targets within your network. For example, Android malware is an evolving threat. Do your users use their smart phone and integrate into your network making this malware a threat to your network? This is also where you cycle information you gain by incident response teams into your cycle for evaluation by your security development teams. Have you found a new malware on your network? How did it get there? What is it trying to do? Where did your defenses fail? This information leads to the next phase of Agile Security, "Adapt".

"Adapt" is the phase where you convert your intelligence into an actionable defense. In some cases this is automatic, such as when the VRT releases a new rule or when the FireAMP system seamlessly adds detection to their cloud-based malware solution. Other times the situation is unique to your enterprise and detection can be added with custom Snort rules or ClamAV signatures. Sometimes the answer isn't in anti-virus or IDS systems. Perhaps the answer is a traditional firewall rule, application control or even a change to existing policies and procedures. Whatever the question this is the phase where you develop the correct answer for your environment.

The final phase is "Act", where the solutions developed in the "Adapt" phase are incorporated into your security stance. Often this happens automatically as your Snort and Sourcefire 3D sensors are updated with new detection content or when ClamAV and FireAMP receive new signature updates.  Updates may also be custom signatures and rules created by your own organization.  Sometimes changes to your security stance must occur within the policies of your environment. For example you may be subject to change controls before making firewall changes or QA checks prior to deploying custom detection. However it happens, now is when you bring your new defenses online. From here you monitor how your network and your adversaries react to your changes, and the cycle starts again at "See".

Normally I don't pay a lot of attention to marketing. For the most part I'm heads down into fighting day-to-day issues along with others on the VRT to get our new protections to our customers.  But when someone lays out exactly how many of our customers deal with issues and maps our product lines to this approach, I think it's worth looking at. For more information about Agile Security, you can go here:

http://www.sourcefire.com/agile-security.

I know, that's two nice posts in a row. No doubt I'll be angry about something next time.

Monday, February 13, 2012

Razorback 0.4.1 released

The Razorback team has released version 0.4.1 (yeah, we would have released 0.4, but we found some critical bugs that we really needed to fix before general release).  You can find the new version of Razorback here:  http://sfi.re/zQQOQ4.  We've done a lot of work both on the internals of Razorback as well as a couple of new nuggets.

First and foremost, you need to know that we made changes to the API and the database schema.  We're getting close to the point where we will lock the API, but we've had to make some changes to support our goals, so you'll need to rework any custom nuggets you are working on and retool your database.  You'll also see some changes in the queueing setup, but that happens automatically.  I can tell you there will be additional changes in the 0.5 release and then, hopefully we're done.  Hopefully :)

The first change I'd like to discuss is the concept of locality.  Because of the large network traffic that could be generated by the system, we wanted to be able to take advantage of a shared file system to increase throughput and, depending on what kind of shared system you are using, reduce the amount of network traffic.  To do this we've developed the concept of locality.  If you share a locality with the dispatcher, you will access the data blocks directly from the shared disk system.  By default, the dispatcher locality is 1.  Any other locality will result in datablocks being transfered over the network in the standard way.  So if you have a fast shared disk system, be it NFS or a SAN setup, set the locality in api.conf and this should increase your throughput.

Speaking of data transfer over the wire, we've added encrypted data transfer.  Not surprisingly, this is fairly CPU intensive in certain cases, but depending on your needs this may be a required piece of functionality.  The transfer goes over SSH/SFTP and uses the standard libssh library.  We've removed transfering the datablock by putting it in the queue (this resulted in too much data in the queue) so currently this is the supported network data transfer.  The username is automatically the nugget id, and this is checked against the database setup and the password is configured in the api.conf.

Another place we use the locality concept is in our new master/slave high-availability setup for the dispatcher.  Dispatchers in a master/slave setup must share a locality so as they fail over they have all the datablocks that have been transfered to the dispatcher.  In the master/slave setup the routing table is shared between the servers so in the case of failover none of the nuggets will need to be re-registered.  Because of the queue server setup, all of the pending requests will then be handled by the new master nugget on failover.  CLI commands for viewing the status of the high-availbility setup and force-failing servers have also been added.

We've added three new nuggets.  Two of them, syslogNugget and razorTwit, demonstrate the new output nugget capability.  As alerts and status changes come into the dispatcher, details are placed into a queue that output nuggets can subscribe to.  This capability is intended to reduce the impact of database queries and to provide an alternate, installation-specific, capability for logging.  See the nugget samples for more information, they are fairly straightforward.

Finally, we are introducing a beta build of the new PDFFox nugget built by Ryan Pentney.  The idea behind this nugget is to provide an open-source pdf analyzer that doesn't rely and a costly commercial application to work.  The project is still coming together, and you should probably run the latest from trunk, but its coming along nicely and provides solid detection.

So that is it, besides a bunch of bug fixes from 0.3.  We're now working on the Q1 2012 development cycle and it entirely revolves around the Windows API and several nuggets to plug into anti-virus systems.  We're also deploying our first major in-house production build of Razorback, so numerous performance tweeks are in the works.  Expect information about how to tweak each of the components for maximum performance as we complete the Q1 run.

For those that use our VM, the updated 0.4.1 VM should be up shortly; Tom Judge is making a few tweaks on that side before we release it. 

We want to say thanks for giving Razorback a try, let us know if you have any issues via the mailing list or #razorback on freenode.