I received a new RegRipper plugin from Chakib today, rdpnla.pl. In short, the plugin checks the SecurityLayer value of the HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp key in order to determine if network level authentication is enabled or not.
So what?, you ask? Well, for one, this is a way to help prevent the Sticky Keys attack from succeeding. If you've found that a system had been subject to the attack and wanted to see if it would succeed, be sure to run this plugin.
This HowToGeek page has a graphical discussion of what some of the other settings look like for this key.
Thanks, Chakib!
The Windows Incident Response Blog is dedicated to the myriad information surrounding and inherent to the topics of IR and digital analysis of Windows systems. This blog provides information in support of my books; "Windows Forensic Analysis" (1st thru 4th editions), "Windows Registry Forensics", as well as the book I co-authored with Cory Altheide, "Digital Forensics with Open Source Tools".
Thursday, December 17, 2015
Wednesday, December 16, 2015
Working with Shadow Volumes
I had an opportunity recently to do some interesting work with Volume Shadow Copies within an image acquired from a Windows 7 system. In this instance, I got some great information from a specific VSC, and I wanted to go back and do some testing. Through exchanges with David Cowen, I got access to some tools and decided to share my findings.
Goal
The goal of this analysis, after completing the analysis I originally intended to do with the image, was to see if the hibernation file (hiberfil.sys) existed as a "previous version" in a VSC.
My original analysis involved creating a timeline in order to develop a detailed understanding of a malware infection associated with a targeted threat group. The system had been infected over a year ago, and at one point late this past summer, the AV had quarantined the malware and "cleaned" the persistence mechanisms.
During that initial analysis, I opened the image in FTK Imager, and at one point, I checked the "System Volume Information" folder and found that there were a number of difference files visible. At that point, I knew that the image contained VSCs, and by examining the modification dates for the files in FTK Imager, I had a good idea of when each had been created. I saw that there were one or two VSCs that had been created prior to the malware being quarantined, and I figured that I could extract specific data sources from that VSC in order to augment my timeline.
I accessed the VSC of interest using the VHD method outlined here (note: this blog post contains the commands used). I still have a copy of vhdtool.exe (seems to no longer be available, possible replacement linked here), so I used the "convert" option to change the *.001 file to a VHD format; this operation essentially adds a footer to the image file. In order to attach the VHD via the Disk Management utility on my Win10 analysis system, I had to change the file extension from "*.001" to "*.vhd"; the file still opens just fine in FTK Imager.
Everything went fine using the vssadmin and mklink commands to access the VSC of interest, and I then added the resulting folder as an evidence item to FTK Imager (choosing 'contents of a folder'). I was able to extract the files I wanted at the time, but I did not that this method did not provide me with the necessary access to extract files such as the $MFT, etc. At the time, for the analysis I was doing, that was not an issue.
The issue came up later when I mentioned to Jamie Levy that I had Windows 7 system with VSCs available, and that the hibernation file within the image itself was not a useful source of information about the malware, because the malware had been quarantined about a month prior the hibernation file being created. Jamie said she was curious to see through testing if the hibernation file was covered by VSCs; that is, could I go back to the VSC of interest and retrieve/extract a previous version of hiberfil.sys?
VSS
Jimmy Weg has a good number of blog posts that address VSS; Jimmy's done a lot of great work and shared it. In fact, I initially used information from his 13 Jul 2012 blog post entitled Mounting Shadow Volumes to mount the VSC of interest as a RAM disk on my analysis system. At the time that I did this, I was simply interested in collecting a copy of the $MFT, which is why I was pursing it...at the time, I wasn't interested in comparing hibernation files.
After attaching the VHD and running the vssadmin command to enumerate VSCs from the newly-attached volume, I used the following command:
D:\Tools>vss x: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy16
This resulted in a RAM disk being added to my analysis system. I didn't see it in Explorer, nor in the Disk Management utility, but I could add it as a logical volume to FTK Imager.
Removing the drive was easy:
D:\Tools>vss x:
Drive X: removed
If you're interested in mounting multiple VSCs sequentially, take a look at Jimmy's blog posts and consider using Dan Mare's vss.exe.
Libvshadow
While chatting with David, he mentioned that the method used to access VSCs may have an effect on what I was seeing, or what I could access, and he suggested that I take a look at using libvshadow to access the VSCs.
Step 1: Get the tools..look for "...windows compiled version of libvshadow..."
Step 2: Install Dokan (I went with v.0.7.4, as David mentioned via chat that 0.7.something was the latest stable release)
Step 3: Run mmls to get the sector offset to the partition of interest
mmls -i raw -t dos z:\image.vhd
This gave me a sector offset of "0000002048" to the partition.
Step 4: Run vshadowinfo (not really necessary)
I'm including this step for completeness...vshadowinfo and vshadowmount require byte offsets, and 2048 x 512 = 1048576, so we will use 1048576 to designate the byte offset to the partition we're interested in:
vshadowinfo -o 1048576 z:\image.vhd
Step 5: Run vshadowmount
vshadowmount -o 1048576 -X allow_other z:\image.vhd x:
The result of running this command is that I now had an X:\ volume on my system (i.e., X: is the mount point added via the vshadowmount command line), with the contents of the volume illustrated in the figure to the right.
Note: After hitting "enter" following the above command line, the command prompt did not return; this is normal. Don't do anything...don't hit "ctrl-C" and do not close the command prompt. You can minimize it, but do not forget that it's there.
Step 6: Access VSS1 using FTK Imager
I opened FTK Imager and added VSS1 as an image file. It parsed and opened a little slower than a "normal" image would (the image itself is on a USB drive, and the VSC had to be parsed...). However, I now have access to the VSC as a raw/dd image. This VSC was created on 13 July 2015, and I can not only extract files that were quarantined on 13 Aug 2015, but I can also extract a previous version of the $MFT and other system files. I can even mount the contents of the VSC by choosing "File->Image Mounting..." via FTK Imager.
If you left the command prompt up in the background, you'll see stuff scrolling by...when you're done doing what you want to do with the VSC and have closed FTK Imager, or just removed the evidence item, bring the command prompt into focus and hit "Ctrl-C"; the prompt will return, and you'll no longer have an X:\ volume on your system.
Testing
I opted to use libvshadow to access the VSC and extract hiberfil.sys. I did that, and use Volatility to convert the file to a raw memory dump, and then ran the imageinfo command; even though the VSC that I'd "extracted" the file from had been created on 13 July 2015, the output of the imageinfo command said that the file had been created on 13 Sept 2015. I then hashed both hiberfil.sys files and got the exact same hash.
As such, using this method it appears that the hibernation file is not "tracked" or affected by the Volume Shadow Service; that is, you don't get previous versions of the file.
Addendum: After publishing this post, David Cowen pointed me to this MSDN page that discusses files excluded from VSCs. Checking the Registry key HKLM\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup on my analysis system, I see that the hibernation file is listed (as is the pagefile).
Addendum, 29 Dec: I had a chance recently to work with another Windows 7 image file, and found that it contained two difference files. I then used Arsenal Image Mounter to mount the image read-only, and was able to enumerate VSCs using vssadmin.
If you perform your own testing and find something different, I'd greatly appreciate knowing the process and tools you used.
Other Take-Aways
The research, testing, and most importantly, interaction with other analysts really demonstrates that there a number of methods available for accessing historical information on Windows systems that do not require dongles, and do not require the purchase of commercial applications. Also, you don't need to know Linux, or how to install and compile libraries. Using native Windows tools, you can access the contents of a VSC as you would any other folder, but with a couple of freely available tools, you can get even deeper access, to the point of accessing the $MFT within the shadow volume.
During my initial analysis (prior to the testing outlined here), I extracted a couple of specific files from the VSC and created a mini-timeline in order to add context to my original timeline, and develop a clearer picture. And it all took just a couple of minutes.
And it doesn't end there. David Cowen's been producing a series of blog posts on automating DFIR work, and he has a blog post that walks you through accessing VSCs within an acquired image programmatically, via Python. The final Python script that David makes available essentially accesses each VSC, searches across it for specific files, and collects information about those files.
Resources
VhdxTool - possible replacement to vhdtool (Note: I have not tried this tool)
Goal
The goal of this analysis, after completing the analysis I originally intended to do with the image, was to see if the hibernation file (hiberfil.sys) existed as a "previous version" in a VSC.
My original analysis involved creating a timeline in order to develop a detailed understanding of a malware infection associated with a targeted threat group. The system had been infected over a year ago, and at one point late this past summer, the AV had quarantined the malware and "cleaned" the persistence mechanisms.
VSCs in FTK Imager |
I accessed the VSC of interest using the VHD method outlined here (note: this blog post contains the commands used). I still have a copy of vhdtool.exe (seems to no longer be available, possible replacement linked here), so I used the "convert" option to change the *.001 file to a VHD format; this operation essentially adds a footer to the image file. In order to attach the VHD via the Disk Management utility on my Win10 analysis system, I had to change the file extension from "*.001" to "*.vhd"; the file still opens just fine in FTK Imager.
Everything went fine using the vssadmin and mklink commands to access the VSC of interest, and I then added the resulting folder as an evidence item to FTK Imager (choosing 'contents of a folder'). I was able to extract the files I wanted at the time, but I did not that this method did not provide me with the necessary access to extract files such as the $MFT, etc. At the time, for the analysis I was doing, that was not an issue.
The issue came up later when I mentioned to Jamie Levy that I had Windows 7 system with VSCs available, and that the hibernation file within the image itself was not a useful source of information about the malware, because the malware had been quarantined about a month prior the hibernation file being created. Jamie said she was curious to see through testing if the hibernation file was covered by VSCs; that is, could I go back to the VSC of interest and retrieve/extract a previous version of hiberfil.sys?
VSS
Jimmy Weg has a good number of blog posts that address VSS; Jimmy's done a lot of great work and shared it. In fact, I initially used information from his 13 Jul 2012 blog post entitled Mounting Shadow Volumes to mount the VSC of interest as a RAM disk on my analysis system. At the time that I did this, I was simply interested in collecting a copy of the $MFT, which is why I was pursing it...at the time, I wasn't interested in comparing hibernation files.
After attaching the VHD and running the vssadmin command to enumerate VSCs from the newly-attached volume, I used the following command:
D:\Tools>vss x: \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy16
This resulted in a RAM disk being added to my analysis system. I didn't see it in Explorer, nor in the Disk Management utility, but I could add it as a logical volume to FTK Imager.
Removing the drive was easy:
D:\Tools>vss x:
Drive X: removed
If you're interested in mounting multiple VSCs sequentially, take a look at Jimmy's blog posts and consider using Dan Mare's vss.exe.
Libvshadow
While chatting with David, he mentioned that the method used to access VSCs may have an effect on what I was seeing, or what I could access, and he suggested that I take a look at using libvshadow to access the VSCs.
Step 1: Get the tools..look for "...windows compiled version of libvshadow..."
Step 2: Install Dokan (I went with v.0.7.4, as David mentioned via chat that 0.7.something was the latest stable release)
Step 3: Run mmls to get the sector offset to the partition of interest
mmls -i raw -t dos z:\image.vhd
This gave me a sector offset of "0000002048" to the partition.
Step 4: Run vshadowinfo (not really necessary)
I'm including this step for completeness...vshadowinfo and vshadowmount require byte offsets, and 2048 x 512 = 1048576, so we will use 1048576 to designate the byte offset to the partition we're interested in:
vshadowinfo -o 1048576 z:\image.vhd
Step 5: Run vshadowmount
vshadowmount -o 1048576 -X allow_other z:\image.vhd x:
X:\ volume contents |
Note: After hitting "enter" following the above command line, the command prompt did not return; this is normal. Don't do anything...don't hit "ctrl-C" and do not close the command prompt. You can minimize it, but do not forget that it's there.
Step 6: Access VSS1 using FTK Imager
I opened FTK Imager and added VSS1 as an image file. It parsed and opened a little slower than a "normal" image would (the image itself is on a USB drive, and the VSC had to be parsed...). However, I now have access to the VSC as a raw/dd image. This VSC was created on 13 July 2015, and I can not only extract files that were quarantined on 13 Aug 2015, but I can also extract a previous version of the $MFT and other system files. I can even mount the contents of the VSC by choosing "File->Image Mounting..." via FTK Imager.
If you left the command prompt up in the background, you'll see stuff scrolling by...when you're done doing what you want to do with the VSC and have closed FTK Imager, or just removed the evidence item, bring the command prompt into focus and hit "Ctrl-C"; the prompt will return, and you'll no longer have an X:\ volume on your system.
Testing
I opted to use libvshadow to access the VSC and extract hiberfil.sys. I did that, and use Volatility to convert the file to a raw memory dump, and then ran the imageinfo command; even though the VSC that I'd "extracted" the file from had been created on 13 July 2015, the output of the imageinfo command said that the file had been created on 13 Sept 2015. I then hashed both hiberfil.sys files and got the exact same hash.
As such, using this method it appears that the hibernation file is not "tracked" or affected by the Volume Shadow Service; that is, you don't get previous versions of the file.
Addendum: After publishing this post, David Cowen pointed me to this MSDN page that discusses files excluded from VSCs. Checking the Registry key HKLM\SYSTEM\CurrentControlSet\Control\BackupRestore\FilesNotToBackup on my analysis system, I see that the hibernation file is listed (as is the pagefile).
Addendum, 29 Dec: I had a chance recently to work with another Windows 7 image file, and found that it contained two difference files. I then used Arsenal Image Mounter to mount the image read-only, and was able to enumerate VSCs using vssadmin.
If you perform your own testing and find something different, I'd greatly appreciate knowing the process and tools you used.
Other Take-Aways
The research, testing, and most importantly, interaction with other analysts really demonstrates that there a number of methods available for accessing historical information on Windows systems that do not require dongles, and do not require the purchase of commercial applications. Also, you don't need to know Linux, or how to install and compile libraries. Using native Windows tools, you can access the contents of a VSC as you would any other folder, but with a couple of freely available tools, you can get even deeper access, to the point of accessing the $MFT within the shadow volume.
During my initial analysis (prior to the testing outlined here), I extracted a couple of specific files from the VSC and created a mini-timeline in order to add context to my original timeline, and develop a clearer picture. And it all took just a couple of minutes.
And it doesn't end there. David Cowen's been producing a series of blog posts on automating DFIR work, and he has a blog post that walks you through accessing VSCs within an acquired image programmatically, via Python. The final Python script that David makes available essentially accesses each VSC, searches across it for specific files, and collects information about those files.
Resources
VhdxTool - possible replacement to vhdtool (Note: I have not tried this tool)
Friday, December 11, 2015
New RR Plugin: Identities.pl
This past week, I read an interesting FireEye blog post that discussed malware that targets the volume boot record. As I read through the post, I got to step 4 ("Component Installation") for the malware, and the Registry values listed caught my eye. I know...go figure, right?
The blog post states that a number of values are created within a specific hive file, and that these values refer to the various components of the malware itself. As such, I looked at these values as a great way to determine if a system was infected, through either digital forensic analysis, or even active hunting within the enterprise.
The key path for the values listed in the blog post is "HKCU\.Default". Hhhmmm...okay, so...where is that hive on the system? As you can see in the figure to the right, taken via RegEdit on my Windows 10 system, the path should be listed as "HKU", which stands for "HKEY_USERS", rather than "HKCU", which stands for "HKEY_CURRENT_USER" (which would be me). Regardless, we see the ".Default" key in the figure. This MSDN blog post lets us know that it's not what we think...no, not at all. That is, this key is not for the "Default User", from which the new user profiles are created, but instead for the Local System account.
The RegRipper profilelist.pl plugin will show us the paths to the NTUSER.DAT hives for various accounts on the system, including not only the users but the other SIDs, as well:
Path : %systemroot%\system32\config\systemprofile
SID : S-1-5-18
LastWrite : Tue Jul 14 04:53:25 2009 (UTC)
Path : C:\Windows\ServiceProfiles\LocalService
SID : S-1-5-19
LastWrite : Thu Dec 30 20:51:42 2010 (UTC)
Path : C:\Windows\ServiceProfiles\NetworkService
SID : S-1-5-20
LastWrite : Thu Dec 30 20:51:42 2010 (UTC)
As such, you can extract the NTUSER.DAT file from any of these profiles, and run the identities.pl plugin (uploaded to the GitHub repository today) against it.
Addendum, 13 Dec: I added a plugin to the repository this morning called latentbot.pl that parses the persistence location for LatentBot (as reported by FireEye), and attempts to determine the plugins, as well. YMMV...extremely limited test suite.
The blog post states that a number of values are created within a specific hive file, and that these values refer to the various components of the malware itself. As such, I looked at these values as a great way to determine if a system was infected, through either digital forensic analysis, or even active hunting within the enterprise.
The RegRipper profilelist.pl plugin will show us the paths to the NTUSER.DAT hives for various accounts on the system, including not only the users but the other SIDs, as well:
Path : %systemroot%\system32\config\systemprofile
SID : S-1-5-18
LastWrite : Tue Jul 14 04:53:25 2009 (UTC)
Path : C:\Windows\ServiceProfiles\LocalService
SID : S-1-5-19
LastWrite : Thu Dec 30 20:51:42 2010 (UTC)
Path : C:\Windows\ServiceProfiles\NetworkService
SID : S-1-5-20
LastWrite : Thu Dec 30 20:51:42 2010 (UTC)
As such, you can extract the NTUSER.DAT file from any of these profiles, and run the identities.pl plugin (uploaded to the GitHub repository today) against it.
Addendum, 13 Dec: I added a plugin to the repository this morning called latentbot.pl that parses the persistence location for LatentBot (as reported by FireEye), and attempts to determine the plugins, as well. YMMV...extremely limited test suite.
Saturday, December 05, 2015
WRF 2/e
As 2015 draws to a close, so does my work on "Windows Registry Forensics, 2/e". My schedule has the manuscript completed just before the end of the year, and from what I've seen, the book itself is supposed to be available in April, 2016. As it is, I got the final material in to the publisher yesterday, three weeks ahead of schedule.
Note: The OFFICIAL (re: ONLY) location of RegRipper is the GitHub repository. Do not send me emails about the Google Code site, or about the Wordpress page. Please stop referring to the Wordpress site, and please stop referring others (i.e., your students) to the site.
Goals
What I hoped to do with this edition is spend much less time focused on the basics of the Registry (where the files are located) and how to extract data from the Registry, and spend more time on data interpretation. I retained the basic material, as I think it's important to have that foundation before proceeding, but in chapters 3 and 4, I wanted to spend more real estate talking about how the available data needs to be interpreted correctly.
What it is
The second edition is a significant (albeit not complete) rewrite of the first edition. Some of the material remains the same because quite frankly, it doesn't change. There's some new stuff in there (new keys/values, AmCache.hve, etc.), and some stuff has been updated.
There is some discussion that includes new versions of Windows, and there are examples specific to Windows 8, 8.1, and 10.
In this edition, I separated various Registry artifacts by category, in hopes that it would be easier to follow, or visualize. We'll see...
Throughout the book, as with my other books, I've used examples of how Registry analysis has had a significant impact on the analysis I've done. Unfortunately, most of the stories are from analysis I've done. Prior to starting the book, I held an online contest to see if folks from the community would be willing to send in little stories and vignettes about how Registry analysis had impacted their analysis; I offered a free copy of the book, once it was published, for any and all submissions that appeared in the book. I got one submission.
There is more content in this book that discusses using RegRipper. In fact, there's an entire chapter just on RegRipper.
There is discussion of "new" plugins that I've written and added to the GitHub repository. In fact, here's a blog post that describes a couple of the ones I wrote and added to the repository; these plugins are meant to be run intentionally, and I did not add them to any of the profiles.
Speaking of new plugins, I'd like to ask that if you have a question about RegRipper, please do not post it to a forum first...because doing that makes it likely that you won't get an answer. Here's an example of a blog post where someone decided that RegRipper didn't do something, and instead of asking about it, just announced it. If there is something you'd like RegRipper to be capable of, please feel free to reach to me first...most times that results in RegRipper being able to do just that, usually within a few hours.
What it is NOT
This edition is NOT a complete compendium of all possible Registry keys and values that may be of interest to an analyst, in part because...quite simply...I don't know everything.
I did not address all devices that contain Windows Registry hives, for the simple reason that I could not...I do not have access to Windows phones or other devices that include hives. I do get those questions (i.e., "What about Registry files from ....?"), so I thought I'd just go ahead and answer them ahead of time.
As for the rest of the questions, like, "...did you cover this?", and "...did you talk about this?", you're SOL and missed your chance to get it included in the book, my friend...sorry.
What's next?
I've been thinking for some time now about a scanner, where I'd be able to point the tool at a mounted image or shadow volume, make a couple of simple choices, and have the tool spit out the data. I like the idea of basing this on artifact categories and an analysis matrix.
Resources
InfoSecInstitute - Registry Forensics
Note: The OFFICIAL (re: ONLY) location of RegRipper is the GitHub repository. Do not send me emails about the Google Code site, or about the Wordpress page. Please stop referring to the Wordpress site, and please stop referring others (i.e., your students) to the site.
What I hoped to do with this edition is spend much less time focused on the basics of the Registry (where the files are located) and how to extract data from the Registry, and spend more time on data interpretation. I retained the basic material, as I think it's important to have that foundation before proceeding, but in chapters 3 and 4, I wanted to spend more real estate talking about how the available data needs to be interpreted correctly.
What it is
The second edition is a significant (albeit not complete) rewrite of the first edition. Some of the material remains the same because quite frankly, it doesn't change. There's some new stuff in there (new keys/values, AmCache.hve, etc.), and some stuff has been updated.
There is some discussion that includes new versions of Windows, and there are examples specific to Windows 8, 8.1, and 10.
In this edition, I separated various Registry artifacts by category, in hopes that it would be easier to follow, or visualize. We'll see...
Throughout the book, as with my other books, I've used examples of how Registry analysis has had a significant impact on the analysis I've done. Unfortunately, most of the stories are from analysis I've done. Prior to starting the book, I held an online contest to see if folks from the community would be willing to send in little stories and vignettes about how Registry analysis had impacted their analysis; I offered a free copy of the book, once it was published, for any and all submissions that appeared in the book. I got one submission.
There is more content in this book that discusses using RegRipper. In fact, there's an entire chapter just on RegRipper.
There is discussion of "new" plugins that I've written and added to the GitHub repository. In fact, here's a blog post that describes a couple of the ones I wrote and added to the repository; these plugins are meant to be run intentionally, and I did not add them to any of the profiles.
Speaking of new plugins, I'd like to ask that if you have a question about RegRipper, please do not post it to a forum first...because doing that makes it likely that you won't get an answer. Here's an example of a blog post where someone decided that RegRipper didn't do something, and instead of asking about it, just announced it. If there is something you'd like RegRipper to be capable of, please feel free to reach to me first...most times that results in RegRipper being able to do just that, usually within a few hours.
What it is NOT
This edition is NOT a complete compendium of all possible Registry keys and values that may be of interest to an analyst, in part because...quite simply...I don't know everything.
I did not address all devices that contain Windows Registry hives, for the simple reason that I could not...I do not have access to Windows phones or other devices that include hives. I do get those questions (i.e., "What about Registry files from ....?"), so I thought I'd just go ahead and answer them ahead of time.
As for the rest of the questions, like, "...did you cover this?", and "...did you talk about this?", you're SOL and missed your chance to get it included in the book, my friend...sorry.
What's next?
I've been thinking for some time now about a scanner, where I'd be able to point the tool at a mounted image or shadow volume, make a couple of simple choices, and have the tool spit out the data. I like the idea of basing this on artifact categories and an analysis matrix.
Resources
InfoSecInstitute - Registry Forensics
Wednesday, December 02, 2015
Links
NTFS Tools
A while back, David and his cohorts released NTFS TriForce, a great tool that allowed you to correlate several NTFS data sources...the MFT, $LogFile, and the USN change journal, using various data elements as "pivot points" to join tables within the database. The folks over at StrozFriedberg came out with their own version of a similar tool called NTFS-Linker.
Program Execution
Not 'new' (this one is from earlier this year), but Chad recommended that if you're looking for artifacts of program execution, you should consider taking a look at SuperFetch artifacts. This is another artifact to add to the category, given information such as can be found here.
Registry
The folks over at CodeReversing have an interesting post on "Stealth Techniques: Hiding Files in the Registry". This is not new...about 15 years ago, I developed a proof of concept tool that downloaded an executable file that had been renamed as a *.gif file, and parsed up the file into discrete sections, putting those sections in the Registry. The second half of the PoC re-assembled the file in the Recycle Bin and launched the executable.
Don't get me wrong...just because something isn't new doesn't mean that it's not relevant. I see that in pretty much ever targeted threat response engagement that I'm involved in, either directly or peripherally...the adversary or intruder uses some technique that are really very simple, so much so that it's overlooked; the Sleeper Agent blog post is a great example of that.
RegRipper
Reminder: The OFFICIAL (re: only) location of RegRipper is GitHub. Do not send me emails about the Google Code site, or about the Wordpress page.
Plugins
I caught something in the archives for one of the mailing lists I access...someone had reached to the list about the auditpol.pl plugin, saying that it wasn't working for them. Well, I hadn't touched that plugin since I wrote it, and it was intended for Windows XP and 2003 systems, due to the fact that those were the only systems on which I had documentation.
Well, someone responded with a link to a PDF document that illustrates how to parse the audit configuration for Vista+ systems. I renamed the current plugin to auditpol_xp.pl, and updated the auditpol.pl plugin to work for Windows 7 and 10 systems ONLY, because I don't have data from other systems available for testing.
Again, the new auditpol.pl plugin has only been tested against Windows 7 and Windows 10 systems, and only one Security hive from each platform. What it does is allow you to see the effective audit policy on the system, or the equivalent of running:
auditpol /get /category:*
Both plugins are in the Github repository; however, again, I do not maintain the RegRipper profiles, so as plugins are added to the repository, I am not updating the profiles to remain current based on the available plugins.
On Sharing
I'm a huge proponent for sharing; sharing information or intel, even just engaging and asking questions. I recently came across this article on sharing that just sort of reinforced my thoughts on the subject.
A while back, David and his cohorts released NTFS TriForce, a great tool that allowed you to correlate several NTFS data sources...the MFT, $LogFile, and the USN change journal, using various data elements as "pivot points" to join tables within the database. The folks over at StrozFriedberg came out with their own version of a similar tool called NTFS-Linker.
Program Execution
Not 'new' (this one is from earlier this year), but Chad recommended that if you're looking for artifacts of program execution, you should consider taking a look at SuperFetch artifacts. This is another artifact to add to the category, given information such as can be found here.
Registry
The folks over at CodeReversing have an interesting post on "Stealth Techniques: Hiding Files in the Registry". This is not new...about 15 years ago, I developed a proof of concept tool that downloaded an executable file that had been renamed as a *.gif file, and parsed up the file into discrete sections, putting those sections in the Registry. The second half of the PoC re-assembled the file in the Recycle Bin and launched the executable.
Don't get me wrong...just because something isn't new doesn't mean that it's not relevant. I see that in pretty much ever targeted threat response engagement that I'm involved in, either directly or peripherally...the adversary or intruder uses some technique that are really very simple, so much so that it's overlooked; the Sleeper Agent blog post is a great example of that.
RegRipper
Reminder: The OFFICIAL (re: only) location of RegRipper is GitHub. Do not send me emails about the Google Code site, or about the Wordpress page.
Plugins
I caught something in the archives for one of the mailing lists I access...someone had reached to the list about the auditpol.pl plugin, saying that it wasn't working for them. Well, I hadn't touched that plugin since I wrote it, and it was intended for Windows XP and 2003 systems, due to the fact that those were the only systems on which I had documentation.
Well, someone responded with a link to a PDF document that illustrates how to parse the audit configuration for Vista+ systems. I renamed the current plugin to auditpol_xp.pl, and updated the auditpol.pl plugin to work for Windows 7 and 10 systems ONLY, because I don't have data from other systems available for testing.
Again, the new auditpol.pl plugin has only been tested against Windows 7 and Windows 10 systems, and only one Security hive from each platform. What it does is allow you to see the effective audit policy on the system, or the equivalent of running:
auditpol /get /category:*
Both plugins are in the Github repository; however, again, I do not maintain the RegRipper profiles, so as plugins are added to the repository, I am not updating the profiles to remain current based on the available plugins.
On Sharing
I'm a huge proponent for sharing; sharing information or intel, even just engaging and asking questions. I recently came across this article on sharing that just sort of reinforced my thoughts on the subject.
Tuesday, December 01, 2015
Doing Analysis
I had an opportunity to perform some pretty fascinating analysis recently, and I thought some might appreciate it if I were to take a moment and describe what I did, and how I went about the analysis.
Situation
The situation was pretty straight-forward; a system (Win7SP1) had been identified as having been infected with malware at one point. What had been determined from the initial analysis that had been conducted was that the system have been infected in Sept, 2014. As it turned out, the malware in question had been deleted by an AV scan around mid-Aug, 2015, and the image had been acquired near the end of Sept, 2015. Two user profiles had been identified as having been involved in the initial infection.
Goals
The goal of this analysis was pretty simple. Essentially, the initial analysis work had already been done, and a report had been delivered to the client. My objective for this analysis was to gain greater insight into the infection process, and to see if I could develop threat intelligence from anything else that I found.
Tools
I performed all of my work using free and open-source tools.
I conducted my analysis using Notepad++.
Timeline
I created a timeline of system activity using:
The system did have Prefetch files but given the time frame, there were no files of interest in the Prefetch folder.
Once I created the timeline, I was able to easily add context to what I was looking at using other tools. For example, I parsed the user's WebCacheV01.dat files initially using esedbexport.exe, and then using ESEDatabaseView. An important take-away from this is data interpretation...entries have several time stamps associated with each visited URL, and the incorrect identification and interpretation of those time stamps can significantly impact your findings. For example, the visited URL has an expiry date time stamp; assuming that this is when the site was last accessed can have a significant (and perhaps detrimental) impact on your overall analysis.
I took a look at IE session recovery files using the Structured Storage Viewer; I got what I needed out of the particular streams of interest, and added notes to my timeline.
Mapping the user's TypedURLs values with the TypedURLsTime values was pretty fascinating, although all it really did was support findings that didn't pertain directly to the malware. Still...it was pretty cool.
User shellbags proved to be very illuminating, and the UserAssist information added additional context to what I was seeing. In the case of one user profile, the combination of those two artifacts illustrated intentional, purposeful activity...the user navigated to a specific subfolder, and double-clicked a specific .exe file, launching it. File system and Registry events following this activity indicated the execution of the application.
Hibernation File
It turned out that the system was a laptop, and had a hibernation file. I extracted the file, and used Volatility 2.5 to convert it to raw format. The "imageinfo" command told me that the hibernation file had been created on 13 Sept 2015, a bit before the image was acquired. I didn't expect to find anything of value from the memory image, but I ran a couple of commands (pslist, psxview) anyway. Doing so essentially validated my suspicions, but better to do it than not. Besides, I wasn't stopping my other analysis...the command prompt where I ran the commands simply went to the background, and I examined the output files when the commands completed.
The previous analysis had indicated that strings/IOCs associated with the malware had been found in the hibernation file. I used strings.exe, and then the Volatility 'strings' command, and found that those strings were in free space.
Working with VSCs
A quick check of the image indicated that there were volume shadow copies (VSCs) available, which was great. Most corporate systems I've dealt with for the past couple of years have had VSCs disabled for some reason, and here was one that didn't. I ran vhdtool.exe to "convert" the image, which essentially added a footer to the file. As my analysis system is Windows 10, I renamed the file to have the ".vhd" file extension. I opened the Disk Management utility and attached the newly-created VHD, and used the following command to list the available VSCs:
vssadmin list shadows /for=g:
Interestingly, I basically followed the process laid out in this blog post. The output of the vssadmin command showed me that there was a VSC that had been created on 13 Jul 2015, which was about a month prior to the malware being detected and quarantined by AV. I linked the VSC to a folder on my analysis system, and added the contents of the folder to FTK Imager; however, this didn't give me the level of access I wanted, as I wanted to get, among other things, a copy of the $MFT from the VSC.
That's where Jimmy's blog post on mounting shadow volumes can into play. Using vss.exe, I added the VSC in question to my analysis system as X:\, which appeared as a RAM image. I then added the logical volume to FTK Imager, and was able to extract the $MFT, as well as other files. By creating a timeline using files extracted from the VSC, I was able to create a bit more context around the
Conclusion
Creating the timeline in the manner that I did allowed me to get started on my analysis in fairly short order, identify what needed a closer look, and then add context and notes to the timeline. I didn't have to wait for an automated tool to complete, and then trudge through a lot of data that didn't pertain to what I was trying to determine. I admit, I had a bit of a leg up because of the initial analysis that had been conducted, but the process I used would have led me to the initial indicators pretty quickly. Specifically, the use of eventmap.txt in parsing Windows Event Logs allows for a number of event records to be auto-tagged, and then easily searched for in the timeline. Searching the timeline for the "[MalDetect]" tag would've taken me to the "Symantec Endpoint Protection Client" event ID 51 record that identified what would be my initial pivot point.
As it turns out, there were a number of "Symantec Endpoint Protection Client/51" events in the timeline, so an easy fix to that would have been to do something like this:
type events.txt | find "[MalDetect]" > av_events.txt
The above command runs through the events file and locates all malware detection events, putting them into a separate file. From there, I could have run:
parse -f av_events.txt > av_tln.txt
This would give me a nano-timeline of just AV detection events, giving me a much smaller set of data to analyze, and on which I could pivot. This would also pick up all malware detection events, for any such events mapped in the eventmap.txt file.
Accessing the shadow volume allowed me to collect copies of files that were not otherwise accessible, as well as get a look at the state of the system prior to the malware being removed. In this case, the malware employed two persistence mechanisms, which meant that two copies of the malware existed on the system. My initial timeline provided an indication of this, as immediately prior to the AV writing it's detection and quarantine message to the Windows Event Log, there were changes to two locations within the file system, and to one Registry key. Accessing the shadow volume from a time when the malware existed on the system allowed me to confirm what I had suspected. It only took a few minutes, and to be honest, it was worth time to close the loop on the speculation.
I should note that I exported the hibernation file from the shadow volume, but once I converted it to raw format, the "imageinfo" command showed me that it had the same "image date and time" as the one from the image. Running "pslist" and "psxview" gave me the exact same information as running those commands on the original hibernation file. I need to look into this more, but it seems that the hibernation file is not tracked in shadow volumes, although the $MFT is.
Situation
The situation was pretty straight-forward; a system (Win7SP1) had been identified as having been infected with malware at one point. What had been determined from the initial analysis that had been conducted was that the system have been infected in Sept, 2014. As it turned out, the malware in question had been deleted by an AV scan around mid-Aug, 2015, and the image had been acquired near the end of Sept, 2015. Two user profiles had been identified as having been involved in the initial infection.
Goals
The goal of this analysis was pretty simple. Essentially, the initial analysis work had already been done, and a report had been delivered to the client. My objective for this analysis was to gain greater insight into the infection process, and to see if I could develop threat intelligence from anything else that I found.
Tools
I performed all of my work using free and open-source tools.
- Timeline Tools
- RegRipper
- FTK Imager
- Volatility
I conducted my analysis using Notepad++.
Timeline
I created a timeline of system activity using:
- File system metadata
- Selected Windows Event Logs
- Registry hives (Software, System, Security)
- NTUSER.DAT and USRCLASS.DAT from the two profiles of interest
- User WebCacheV01.DAT IE browser history files
The system did have Prefetch files but given the time frame, there were no files of interest in the Prefetch folder.
Once I created the timeline, I was able to easily add context to what I was looking at using other tools. For example, I parsed the user's WebCacheV01.dat files initially using esedbexport.exe, and then using ESEDatabaseView. An important take-away from this is data interpretation...entries have several time stamps associated with each visited URL, and the incorrect identification and interpretation of those time stamps can significantly impact your findings. For example, the visited URL has an expiry date time stamp; assuming that this is when the site was last accessed can have a significant (and perhaps detrimental) impact on your overall analysis.
I took a look at IE session recovery files using the Structured Storage Viewer; I got what I needed out of the particular streams of interest, and added notes to my timeline.
Mapping the user's TypedURLs values with the TypedURLsTime values was pretty fascinating, although all it really did was support findings that didn't pertain directly to the malware. Still...it was pretty cool.
User shellbags proved to be very illuminating, and the UserAssist information added additional context to what I was seeing. In the case of one user profile, the combination of those two artifacts illustrated intentional, purposeful activity...the user navigated to a specific subfolder, and double-clicked a specific .exe file, launching it. File system and Registry events following this activity indicated the execution of the application.
Hibernation File
It turned out that the system was a laptop, and had a hibernation file. I extracted the file, and used Volatility 2.5 to convert it to raw format. The "imageinfo" command told me that the hibernation file had been created on 13 Sept 2015, a bit before the image was acquired. I didn't expect to find anything of value from the memory image, but I ran a couple of commands (pslist, psxview) anyway. Doing so essentially validated my suspicions, but better to do it than not. Besides, I wasn't stopping my other analysis...the command prompt where I ran the commands simply went to the background, and I examined the output files when the commands completed.
The previous analysis had indicated that strings/IOCs associated with the malware had been found in the hibernation file. I used strings.exe, and then the Volatility 'strings' command, and found that those strings were in free space.
Working with VSCs
A quick check of the image indicated that there were volume shadow copies (VSCs) available, which was great. Most corporate systems I've dealt with for the past couple of years have had VSCs disabled for some reason, and here was one that didn't. I ran vhdtool.exe to "convert" the image, which essentially added a footer to the file. As my analysis system is Windows 10, I renamed the file to have the ".vhd" file extension. I opened the Disk Management utility and attached the newly-created VHD, and used the following command to list the available VSCs:
vssadmin list shadows /for=g:
Interestingly, I basically followed the process laid out in this blog post. The output of the vssadmin command showed me that there was a VSC that had been created on 13 Jul 2015, which was about a month prior to the malware being detected and quarantined by AV. I linked the VSC to a folder on my analysis system, and added the contents of the folder to FTK Imager; however, this didn't give me the level of access I wanted, as I wanted to get, among other things, a copy of the $MFT from the VSC.
That's where Jimmy's blog post on mounting shadow volumes can into play. Using vss.exe, I added the VSC in question to my analysis system as X:\, which appeared as a RAM image. I then added the logical volume to FTK Imager, and was able to extract the $MFT, as well as other files. By creating a timeline using files extracted from the VSC, I was able to create a bit more context around the
Conclusion
Creating the timeline in the manner that I did allowed me to get started on my analysis in fairly short order, identify what needed a closer look, and then add context and notes to the timeline. I didn't have to wait for an automated tool to complete, and then trudge through a lot of data that didn't pertain to what I was trying to determine. I admit, I had a bit of a leg up because of the initial analysis that had been conducted, but the process I used would have led me to the initial indicators pretty quickly. Specifically, the use of eventmap.txt in parsing Windows Event Logs allows for a number of event records to be auto-tagged, and then easily searched for in the timeline. Searching the timeline for the "[MalDetect]" tag would've taken me to the "Symantec Endpoint Protection Client" event ID 51 record that identified what would be my initial pivot point.
As it turns out, there were a number of "Symantec Endpoint Protection Client/51" events in the timeline, so an easy fix to that would have been to do something like this:
type events.txt | find "[MalDetect]" > av_events.txt
The above command runs through the events file and locates all malware detection events, putting them into a separate file. From there, I could have run:
parse -f av_events.txt > av_tln.txt
This would give me a nano-timeline of just AV detection events, giving me a much smaller set of data to analyze, and on which I could pivot. This would also pick up all malware detection events, for any such events mapped in the eventmap.txt file.
Accessing the shadow volume allowed me to collect copies of files that were not otherwise accessible, as well as get a look at the state of the system prior to the malware being removed. In this case, the malware employed two persistence mechanisms, which meant that two copies of the malware existed on the system. My initial timeline provided an indication of this, as immediately prior to the AV writing it's detection and quarantine message to the Windows Event Log, there were changes to two locations within the file system, and to one Registry key. Accessing the shadow volume from a time when the malware existed on the system allowed me to confirm what I had suspected. It only took a few minutes, and to be honest, it was worth time to close the loop on the speculation.
I should note that I exported the hibernation file from the shadow volume, but once I converted it to raw format, the "imageinfo" command showed me that it had the same "image date and time" as the one from the image. Running "pslist" and "psxview" gave me the exact same information as running those commands on the original hibernation file. I need to look into this more, but it seems that the hibernation file is not tracked in shadow volumes, although the $MFT is.
Friday, November 06, 2015
Goin' huntin'
I ran across this write-up on W32.Brambul recently, and as I often do when I see this sort of thing, I thought about how one might go about trying to find this within an infrastructure, from an endpoint perspective. After all, this is the perspective that most of the "threat intelligence" that we see tends to leave out.
The most obvious indicator would be failed login attempts within the Security Event Log of target systems, and possibly account lockouts. You'd see this sort of indicator either via the SIEM you're using, or if you were proactively hunting within the domain.
As something of a side note, I mentioned Ryan's (of Tanium) presentation at the HTCIA2015 conference a bit ago, where he discussed "hunting in the dark". I thought it was a really good presentation as he broke down how to get started. Hunting in any infrastructure can be a bit overwhelming, but if you break your goal down into discrete, manageable steps, it can be easier to get started. As Ryan recommends, starting small is key...you start eating the elephant one bite a time. Looking at the enormity of an infrastructure can make things overwhelming, so start small. Start with examining the contents of the Run key on systems, maybe starting with domain controllers and then once you've automated that, move to workstations. Learn what's "normal" in your environment. Then move on to the Windows Event Logs. But the point is to not get overwhelmed by the apparent size and scope of the task, and to instead start working with what you have.
Okay.,.that said, we'll go back to the Brambul...
On the infected systems, looking in the Run key might be a place to start. However, if the malware installs as a service, locating "Service Control Manager/7045" event records (there shouldn't be many) within the System Event Log would be the way to go. If you're using a SIEM, and forwarding the right logs, you could search there, instead. Or set a filter. If you don't have a SIEM, you can use Powershell (MS has some good documentation available...) or WMI.
Something else that may occur on the infected systems is Security Auditing/4648 event records, indicating the use of explicit credentials. This likely won't be definitive without further context, and to be honest, it's not surprising that malware write-ups aren't addressing this sort of indicator.
The key is that if you're going to "go huntin'" within your infrastructure, what do you look for? Do you look for malware, when the write-ups you're seeing all talk about how the folks writing this stuff are using high-speed techniques to ensure that the malware avoids detection and is hard to analyze? Do you search for file hashes on systems? Do you search for IP addresses in your logs? Or do you go looking for indicators of behavior?
So, how is looking beyond low-level technical indicators (hashes, IP addresses) valuable? Remember the Moker write-up? This 'new APT' reportedly includes anti-detection and anti-debugging techniques, allowing it to bypass detection. Yet, it apparently persists via the Run key...so, if I just enumerate the values within this key and look for anything suspicious, such as a path that includes "C:\ProgramData". If I did that, and then correlated that information with a new user account being created on the system, would I then be able to determine that the system was infected with something? And that's not so much a low-level technical indicator as it is moving closer to a behavior, something that may be anomalous within your infrastructure and indicate that something needs to be looked at a bit closer.
Here's another bit of malware that, according to some write-ups, may be associated with Brambul. you'll notice in the write-up that it states:
If it is successful in logging in, it will set the %System Root% as a network share named adnim.
I added the emphasis, in order to draw your attention to the spelling of the share (I did a copy-paste and didn't try to retype that...). If you were hunting in your environment, looking at the values beneath the LanmanServer/Shares key within the Registry might help you find this (or anything else that might be suspicious), particularly if you don't have auditing for Object Access/File Shares enabled.
Just for fun, I created a couple of shares using the "net share" command...one called "adnim" and one called "adnim$". Both appeared as values beneath the LanmanServer/Shares key. So rather than looking for file hashes on a system, we can start to correlate various indicators, based on time, and also develop context around what we're seeing. The name of the share may change, but if the malware continues to create a share, we know what to look for when we're hunting.
Testing and Monitoring
If you're testing malware, doing dynamic analysis by running it in a VM (or on bare metal), something that I don't seen done very often is running it with monitoring tools such as SysMon or Carbon Black.
Why would anyone want to do this? After all, who really cares what happens on the endpoint, right? Not the malware RE and AV guys. If you're protecting an infrastructure, or responding to a breach, you probably do care, because process creation monitoring is extremely valuable.
Here's an example...we've seen malware that persists via a particular key, and at one point that malware stopped using the API and instead used an embedded 'reg add' command to maintain persistence. Okay, so now, we have not only the persistence location, but we also have a command we can monitor for in order to perform detection much closer to the time of infection. Or...and bear with me here...if you don't use reg.exe in your infrastructure, you can take steps to prevent it from being used, even by an account running with System-level privileges.
The same holds true for other processes. Consider the malware described above that creates a share...how does it do this? Via the API, included as part of the code, or via an embedded "net share" command?
Monitoring for this sort of activity within the infrastructure can give us a great deal more visibility into what's going on. For example, if someone archives files (via WinRAR) and encrypts the archive, the process runs and completes, and the memory used if freed up for use by other processes. However, if we monitor for process creation, we can capture that command line (along with the password used). Process creation monitoring provides a great deal of insight into what the bad guys are doing, or are trying to do, and will illustrate behaviors.
The most obvious indicator would be failed login attempts within the Security Event Log of target systems, and possibly account lockouts. You'd see this sort of indicator either via the SIEM you're using, or if you were proactively hunting within the domain.
As something of a side note, I mentioned Ryan's (of Tanium) presentation at the HTCIA2015 conference a bit ago, where he discussed "hunting in the dark". I thought it was a really good presentation as he broke down how to get started. Hunting in any infrastructure can be a bit overwhelming, but if you break your goal down into discrete, manageable steps, it can be easier to get started. As Ryan recommends, starting small is key...you start eating the elephant one bite a time. Looking at the enormity of an infrastructure can make things overwhelming, so start small. Start with examining the contents of the Run key on systems, maybe starting with domain controllers and then once you've automated that, move to workstations. Learn what's "normal" in your environment. Then move on to the Windows Event Logs. But the point is to not get overwhelmed by the apparent size and scope of the task, and to instead start working with what you have.
Okay.,.that said, we'll go back to the Brambul...
On the infected systems, looking in the Run key might be a place to start. However, if the malware installs as a service, locating "Service Control Manager/7045" event records (there shouldn't be many) within the System Event Log would be the way to go. If you're using a SIEM, and forwarding the right logs, you could search there, instead. Or set a filter. If you don't have a SIEM, you can use Powershell (MS has some good documentation available...) or WMI.
Something else that may occur on the infected systems is Security Auditing/4648 event records, indicating the use of explicit credentials. This likely won't be definitive without further context, and to be honest, it's not surprising that malware write-ups aren't addressing this sort of indicator.
The key is that if you're going to "go huntin'" within your infrastructure, what do you look for? Do you look for malware, when the write-ups you're seeing all talk about how the folks writing this stuff are using high-speed techniques to ensure that the malware avoids detection and is hard to analyze? Do you search for file hashes on systems? Do you search for IP addresses in your logs? Or do you go looking for indicators of behavior?
So, how is looking beyond low-level technical indicators (hashes, IP addresses) valuable? Remember the Moker write-up? This 'new APT' reportedly includes anti-detection and anti-debugging techniques, allowing it to bypass detection. Yet, it apparently persists via the Run key...so, if I just enumerate the values within this key and look for anything suspicious, such as a path that includes "C:\ProgramData". If I did that, and then correlated that information with a new user account being created on the system, would I then be able to determine that the system was infected with something? And that's not so much a low-level technical indicator as it is moving closer to a behavior, something that may be anomalous within your infrastructure and indicate that something needs to be looked at a bit closer.
Here's another bit of malware that, according to some write-ups, may be associated with Brambul. you'll notice in the write-up that it states:
If it is successful in logging in, it will set the %System Root% as a network share named adnim.
I added the emphasis, in order to draw your attention to the spelling of the share (I did a copy-paste and didn't try to retype that...). If you were hunting in your environment, looking at the values beneath the LanmanServer/Shares key within the Registry might help you find this (or anything else that might be suspicious), particularly if you don't have auditing for Object Access/File Shares enabled.
Just for fun, I created a couple of shares using the "net share" command...one called "adnim" and one called "adnim$". Both appeared as values beneath the LanmanServer/Shares key. So rather than looking for file hashes on a system, we can start to correlate various indicators, based on time, and also develop context around what we're seeing. The name of the share may change, but if the malware continues to create a share, we know what to look for when we're hunting.
Testing and Monitoring
If you're testing malware, doing dynamic analysis by running it in a VM (or on bare metal), something that I don't seen done very often is running it with monitoring tools such as SysMon or Carbon Black.
Why would anyone want to do this? After all, who really cares what happens on the endpoint, right? Not the malware RE and AV guys. If you're protecting an infrastructure, or responding to a breach, you probably do care, because process creation monitoring is extremely valuable.
Here's an example...we've seen malware that persists via a particular key, and at one point that malware stopped using the API and instead used an embedded 'reg add' command to maintain persistence. Okay, so now, we have not only the persistence location, but we also have a command we can monitor for in order to perform detection much closer to the time of infection. Or...and bear with me here...if you don't use reg.exe in your infrastructure, you can take steps to prevent it from being used, even by an account running with System-level privileges.
The same holds true for other processes. Consider the malware described above that creates a share...how does it do this? Via the API, included as part of the code, or via an embedded "net share" command?
Monitoring for this sort of activity within the infrastructure can give us a great deal more visibility into what's going on. For example, if someone archives files (via WinRAR) and encrypts the archive, the process runs and completes, and the memory used if freed up for use by other processes. However, if we monitor for process creation, we can capture that command line (along with the password used). Process creation monitoring provides a great deal of insight into what the bad guys are doing, or are trying to do, and will illustrate behaviors.
Friday, October 30, 2015
OSDFCon follow-up
I attended Basis Tech's OSDFCon recently...I've attended and presented at this conference in the past...and as has been the case in previous years, this turned out to be a great experience.
OSDFCon isn't so much a DFIR conference as it is a "tools and frameworks" conference, centered around the Autopsy toolkit. However, the folks who attend this conference are, for the most part, developers and DFIR practitioners. Many of the attendees are one or the other, while a number are both. This makes for a very interesting time.
Brian asked me to come by and, along with several other folks, give an update to a previous presentation. Last year, I talked about some updates I was considering/working on for RegRipper, and this time I gave a quick update on what I was looking at in the coming year. Based on that, my hope for next year's conference is to have something available to give a presentation, along with a demo, of what I talked about.
I really liked hearing about the new stuff in Volatility 2.5, as well as seeing the plugins that came out of the contest...and congrats to the contest winners!
Something I like about this particular conference is the type of folks that it brings together. Working on the types of cases I tend to work gives me a sort of myopic view of things, so it's good to meet up with others and hear about the kinds of cases they work, and the challenges they face.
Take-Aways
There are a lot of really smart people at this conference, and what I really like to see is frameworks and solutions to DFIR problems being created by DFIR practitioners, even if they are specific to those individual's needs.
Many of the solutions...whether it be Turbinia, or Autopsy, or Willi's tools, or whatever...provide an excellent means for data collection and presentation. I think we still have a challenge to overcome...data interpretation. Sure, we get now get data from an image or from across the enterprise much faster because we've put stuff in the cloud, or we've got a fast, multi-threaded design in our framework, and that's awesome. But what happens if that data is misunderstood and misinterpreted? This thought started to gel with me right after I registered for the conference and was talking to Christa about CyberTriage, and then during the conference, I made a comment to that effect to Cory...to which he responded, "Baby steps." He's right. But now that we can get to the data faster, the nex step is to make sure that we're getting the right data, and that it's being interpreted and understood correctly. Maybe the data interpretation phase is beyond the scope of a conference that's about open source tools...although there may be space for an open source tool that incorporates threat intelligence. Just sayin'...
Maybe I've just given myself the basis for a presentation next year. ;-)
Finally, a huge thanks to Brian and his staff for continuing to put on an excellent conference, in both format and content. In fact, I still believe that this is one of the better conferences available today. The format is great, requiring speakers to focus on the guts of what they want to convey, and the breaks allow for interaction not only with speakers but with other attendees, as well.
OSDFCon isn't so much a DFIR conference as it is a "tools and frameworks" conference, centered around the Autopsy toolkit. However, the folks who attend this conference are, for the most part, developers and DFIR practitioners. Many of the attendees are one or the other, while a number are both. This makes for a very interesting time.
Brian asked me to come by and, along with several other folks, give an update to a previous presentation. Last year, I talked about some updates I was considering/working on for RegRipper, and this time I gave a quick update on what I was looking at in the coming year. Based on that, my hope for next year's conference is to have something available to give a presentation, along with a demo, of what I talked about.
I really liked hearing about the new stuff in Volatility 2.5, as well as seeing the plugins that came out of the contest...and congrats to the contest winners!
Something I like about this particular conference is the type of folks that it brings together. Working on the types of cases I tend to work gives me a sort of myopic view of things, so it's good to meet up with others and hear about the kinds of cases they work, and the challenges they face.
Take-Aways
There are a lot of really smart people at this conference, and what I really like to see is frameworks and solutions to DFIR problems being created by DFIR practitioners, even if they are specific to those individual's needs.
Many of the solutions...whether it be Turbinia, or Autopsy, or Willi's tools, or whatever...provide an excellent means for data collection and presentation. I think we still have a challenge to overcome...data interpretation. Sure, we get now get data from an image or from across the enterprise much faster because we've put stuff in the cloud, or we've got a fast, multi-threaded design in our framework, and that's awesome. But what happens if that data is misunderstood and misinterpreted? This thought started to gel with me right after I registered for the conference and was talking to Christa about CyberTriage, and then during the conference, I made a comment to that effect to Cory...to which he responded, "Baby steps." He's right. But now that we can get to the data faster, the nex step is to make sure that we're getting the right data, and that it's being interpreted and understood correctly. Maybe the data interpretation phase is beyond the scope of a conference that's about open source tools...although there may be space for an open source tool that incorporates threat intelligence. Just sayin'...
Maybe I've just given myself the basis for a presentation next year. ;-)
Finally, a huge thanks to Brian and his staff for continuing to put on an excellent conference, in both format and content. In fact, I still believe that this is one of the better conferences available today. The format is great, requiring speakers to focus on the guts of what they want to convey, and the breaks allow for interaction not only with speakers but with other attendees, as well.
Thursday, October 08, 2015
Threat Intel and Threat Hunting Conferences in 2016
I'm looking for input from the community, with respect to conferences in 2016 that cover DFIR, threat intelligence, and threat hunting.
Members of the team I work with have some pretty significant content that we're looking to share, so I thought I'd reach to the community and see what conferences are out there that folks are looking to (for content) in 2016.
So, if you're looking at conferences in 2016 that cover digital forensics, incident response, as well as targeted threat hunting and response, I'd appreciate hearing about them.
Thanks.
Members of the team I work with have some pretty significant content that we're looking to share, so I thought I'd reach to the community and see what conferences are out there that folks are looking to (for content) in 2016.
So, if you're looking at conferences in 2016 that cover digital forensics, incident response, as well as targeted threat hunting and response, I'd appreciate hearing about them.
Thanks.
Tuesday, October 06, 2015
Tools, Links - ESEDB, etc.
Tools
CapLoader - This looks like an interesting tool...and another one...for carving packets from memory dumps. I'm not clear as to how this tool differs from the Volatility modules, in particular netscan and Jamaal's ethscan, but it does seem interesting. If you were curious as to how to install Rekall on Windows systems, see this blog post.
SAMParser.py - I'm not entirely sure how this Python script differs from RegRipper's samparse.pl plugin, but it does offer an interesting alternative, if you're looking for one. The output does appear similar to what samparse.pl produces.
MFT Parsers
Mari posted an excellent blog article based on her review of several MFT parsing tools. One of the key factors to Mari's post is that she understands what it is she's looking at (MFT records), so she's able to evaluate the various tools for her own use, rather than simply running them and not questioning the output.
This is the sort of thing that the DFIR community would benefit from greatly, if more practitioners engaged in it, or if more practitioners responded to it. Honestly evaluating tools can be of significant benefit to the community, particularly when they're evaluated in light of a particular practitioner's analysis process. It's even more beneficial if that process is shared, so that others can determine the usefulness of the tools for themselves, and decide if those tools can/should be incorporated into their own analysis process.
Yara
Yara is a tool that's been available for some time, and is worth mentioning again. A while back, Corey Harrell asked a question via social media regarding how to detect the presence of web shells on a system, using only the HTTP access logs. Shortly thereafter, Aaron Shelmire posted this article to the ThreatStream blog. In the article, Aaron mentions a couple of methods for detecting web shells using only the HTTP access logs, in accordance with Corey's question, and his suggestions are very valuable. One method of detection he mentioned, as well, was using a change control and inventory process, or a file system monitoring tool, to detect new pages being added to web directories. Aaron also mentions that searching for patterns within files can produce false positives, but if you use something like Yara, you can reduce those false positives. Yara can be used by sysadmins who want to keep ahead of things or those who want to perform hunting, as well as by analysts and responders engaged in DFIR analysis.
An excellent resource for web shell rules can be found here.
ESEDB Databases
Windows systems utilize ESE format databases more and more, and as such, it's imperative that analysts be able to identify the databases, as well as extract data for incorporation into their analysis processes.
An example of an ESE format database includes the IE10+ WebCacheV01.dat web history database. Also, Brent Muir recently posted regarding Windows 10 Cortana Notification Center Forensics.
A note on Brent's post...I have a Windows 10 laptop that was upgraded from Win7; I opened the notification center as he described towards the end of the post. Even after rebooting the system, the value containing the timestamp does not exist in my NTUSER.DAT. However, I'm also not running Cortana, as this is an older laptop, so that may have an impact as to whether or not the value gets created.
There's also the Search Index database; reading through the post responses, you can see how the contents of this database can be useful to a forensic analyst. One of the response lists tools that can be used to parse the database.
So, at this point, that's three databases that use the ESE format, all of which can provide significant value to a forensic analyst.
Parsing Tools
WoanWare ESEDBViewer - deprecated, but still a good visual tool.
libesedb - needs to be compiled for the Windows platform; most of the web sites that I've found that mention the tool don't provide a compiled copy
esentutl - native tool that lets you copy and/or recover an ESEDB file. While one method of obtaining a copy of an ESEDB file for analysis might be to create a VSC and copy the file in question from the shadow copy, this option might not always be available. As such, this native tool may be of significant use to an analyst.
pyesedbwebcache2.py - It looks as if Jon Glass has updated his Python script for parsing the WebCacheV01.dat file.
Addendum, 7 Oct: I found this post over at Sanderson Forensics this morning...if you're analyzing Windows systems, you want to be sure to read the post and include the tool in your toolkit...
CapLoader - This looks like an interesting tool...and another one...for carving packets from memory dumps. I'm not clear as to how this tool differs from the Volatility modules, in particular netscan and Jamaal's ethscan, but it does seem interesting. If you were curious as to how to install Rekall on Windows systems, see this blog post.
SAMParser.py - I'm not entirely sure how this Python script differs from RegRipper's samparse.pl plugin, but it does offer an interesting alternative, if you're looking for one. The output does appear similar to what samparse.pl produces.
MFT Parsers
Mari posted an excellent blog article based on her review of several MFT parsing tools. One of the key factors to Mari's post is that she understands what it is she's looking at (MFT records), so she's able to evaluate the various tools for her own use, rather than simply running them and not questioning the output.
This is the sort of thing that the DFIR community would benefit from greatly, if more practitioners engaged in it, or if more practitioners responded to it. Honestly evaluating tools can be of significant benefit to the community, particularly when they're evaluated in light of a particular practitioner's analysis process. It's even more beneficial if that process is shared, so that others can determine the usefulness of the tools for themselves, and decide if those tools can/should be incorporated into their own analysis process.
Yara
Yara is a tool that's been available for some time, and is worth mentioning again. A while back, Corey Harrell asked a question via social media regarding how to detect the presence of web shells on a system, using only the HTTP access logs. Shortly thereafter, Aaron Shelmire posted this article to the ThreatStream blog. In the article, Aaron mentions a couple of methods for detecting web shells using only the HTTP access logs, in accordance with Corey's question, and his suggestions are very valuable. One method of detection he mentioned, as well, was using a change control and inventory process, or a file system monitoring tool, to detect new pages being added to web directories. Aaron also mentions that searching for patterns within files can produce false positives, but if you use something like Yara, you can reduce those false positives. Yara can be used by sysadmins who want to keep ahead of things or those who want to perform hunting, as well as by analysts and responders engaged in DFIR analysis.
An excellent resource for web shell rules can be found here.
ESEDB Databases
Windows systems utilize ESE format databases more and more, and as such, it's imperative that analysts be able to identify the databases, as well as extract data for incorporation into their analysis processes.
An example of an ESE format database includes the IE10+ WebCacheV01.dat web history database. Also, Brent Muir recently posted regarding Windows 10 Cortana Notification Center Forensics.
A note on Brent's post...I have a Windows 10 laptop that was upgraded from Win7; I opened the notification center as he described towards the end of the post. Even after rebooting the system, the value containing the timestamp does not exist in my NTUSER.DAT. However, I'm also not running Cortana, as this is an older laptop, so that may have an impact as to whether or not the value gets created.
There's also the Search Index database; reading through the post responses, you can see how the contents of this database can be useful to a forensic analyst. One of the response lists tools that can be used to parse the database.
So, at this point, that's three databases that use the ESE format, all of which can provide significant value to a forensic analyst.
Parsing Tools
WoanWare ESEDBViewer - deprecated, but still a good visual tool.
libesedb - needs to be compiled for the Windows platform; most of the web sites that I've found that mention the tool don't provide a compiled copy
esentutl - native tool that lets you copy and/or recover an ESEDB file. While one method of obtaining a copy of an ESEDB file for analysis might be to create a VSC and copy the file in question from the shadow copy, this option might not always be available. As such, this native tool may be of significant use to an analyst.
pyesedbwebcache2.py - It looks as if Jon Glass has updated his Python script for parsing the WebCacheV01.dat file.
Addendum, 7 Oct: I found this post over at Sanderson Forensics this morning...if you're analyzing Windows systems, you want to be sure to read the post and include the tool in your toolkit...
Saturday, September 12, 2015
Updates, Links, etc.
RegRipper Plugin Updates
I updated a plugin recently and provided a new one, and thought I'd share some information about those updates here...
The updated plugin is environment.pl, originally written in 2011; the update that I added to the code was to specifically look for and alert on the value described in this blog post. So, four years later, I added a small bit of code to the plugin to look for something specific in the data.
I added the malware.pl plugin, which can be run against any hive; it has specific sections in its code that describe what's being looked for, in which hive, along with references as to the sources from which the keys, values or data in question were derived - why was I looking for them in the first place? Essentially, these are all artifacts I find myself looking for time and again, and I figured I'd just keep them together in one plugin. If you look at the plugin contents, you'll see that I copied the code from secrets.pl and included it.
There are a couple of other plugins I thought I'd mention, in case folks hadn't considered using them....
The sizes.pl plugin was written to address malware maintaining configuration information in a Registry value, as described in this Symantec post. You can run this plugin against any hive.
The rlo.pl plugin is an interesting plugin, and the use of the plugin was illustrated in this Secureworks blog post. As you can see in the figure to the left, there are two Registry keys that appear to have the same name.
In testing for this particular issue, I had specifically crafted two Registry key names, using the method outlined in the Secureworks blog post. This allowed me to create some useful data that mimicked what we'd seen, and provided an opportunity for more comprehensive testing.
As you can see from the output of the plugin listed below, I had also crafted a Registry value name using the same method, to see if the plugin would detect that, as well.
C:\Perl\rr>rip -r d:\cases\local\ntuser.dat -p rlo
Launching rlo v.20130904
rlo v.20130904
(All) Parse hive, check key/value names for RLO character
RLO control char detected in key name: \Software\gpu.etadp [gpupdate]
RLO control char detected in key name: \Software\.etadpupg [gpupdate]
RLO control char detected in value name: \Software\.etadpupg :.etadpupg [gpupdate]
Now, when running the rlo.pl plugin, analysts need to keep in mind that it's looking for something very specific; in this case, indications of the RLO Unicode control character. What's great about plugins like this is that you can include them in your process, run them every time you're conducting analysis, and they'll alert you when there's an issue.
Just as PSA, I have provided these plugins but I haven't updated any of the profiles...I leave that up to the users. So, if you're downloading the plugins folder and refreshing it in place, do not expect to see the
Anti-Forensic Malware
I ran across this InfoSecurity Magazine article recently, and while the title caught my attention, I was more than a bit surprised at the lack of substance.
There are a couple of statements in the blog post that I wanted to address, and share my thoughts on...
Increasingly, bad actors are using techniques that leave little trace on physical disks. And unfortunately, the white hats aren’t keeping up: There’s a shortage of digital forensics practitioners able to investigate these types of offensives.
As to the first sentence, sometimes, yes. Other times, not so much.
The second statement regarding "white hats" is somewhat ambiguous, don't you think? Who are the "white hats"? From my perspective, if "white hats" are the folks investigating these breaches, it's not so much that we aren't keeping up, as it is that the breaches themselves aren't being detected in a timely manner, due to a lack of instrumentation. By the time the "white hats" get the call to investigate the breach, a great deal of the potential evidence has been obviated.
Finally, I don't know that I agree with the final statement, regarding the shortage of practitioners. Sometimes, there's nothing to investigate. As I described in a recent blog post, when putting together some recent presentations, I looked at the statistics in annual security trends reports. One of the statistics I found interested was dwell time, or median time to detection. The point I tried to make in the presentations was that when consultants go on-site to investigate a breach, they're able to see indicators that allow them to identify these numbers. For example in the M-Trends 2015 report, there was an infrastructure that had been compromised 8 years before the compromise was detected.
I would suggest that it's not so much a shortage of practitioners able to investigate these breaches, it's a lack of management oversight that prevents the infrastructure from being instrumented in a manner that provides for timely detection of breaches. By the time some breaches are detected (many through external, third party notification), the systems in question have likely been rebooted multiple times, potentially obviating memory analysis all together.
If a crime is committed and the perpetrator had to walk across a muddy field to commit that crime (leaving footprints), and that field is dug up and paved over with a parking lot before the crime is reported, you cannot then say that there aren't enough trained responders able to investigate the crime.
...seen a rise in file-less malware, which exists only in volatile memory and avoids installation on a target’s file system.
"File-less malware"? Like Poweliks? Here's a TrendMicro blog post regarding PhaseBot, which references a TrendMicro article on Poweliks. Sure, there may not be a file on disk, but there's something pulled from the Registry, isn't there?
Malware comes from somewhere...it doesn't magically appear out of nowhere. If you take a system off of the main network and reboot it, and find indications of malware persisting, then it's somewhere on the system. Just because it is in memory, but there are no obvious indications of the malware within the file system doesn't mean that it can't be found.
Hunting
At the recent HTCIA 2015 Conference, I attended Ryan's presentation on "Hunting in the Dark", and I found it fascinating that at a sufficient level of abstraction, those of us who are doing "hunting" are doing very similar things; we may use different terms to describe it (what Ryan refers to as "harvesting and stacking", the folks I work with call it "using strategic rules")
Ryan's presentation was mostly directed to folks who work within one environment, and was intended to address the question of, "...how do I get started?" Ryan had some very good advice for folks in that position...start small, take a small bite, and use it to get familiar with your infrastructure to learn what is "normal", and what might not be normal.
Along those lines, a friend of mine recently asked a question regarding detecting web shells in an environment using only web server logs. Apparently in response to that question, ThreatStream posted an article explaining just how to do this. So this is an example of how someone can start hunting within their own environment, with limited resources. If you're hunting for web shells, there are number of other things I'd recommend looking at, but the original question was how to do so using only the web server logs.
The folks at ThreatStream also posted this article regarding "evasive maneuvers" used by a threat actor group. If you read the article, you will quickly see that it is more about obfuscation techniques used in the malware and it's communications means, which can significantly effect network monitoring. Reading the article, many folks will likely take a look at their own massive lists of C2 domain names and IP addresses, and append those listed in the article to that list. So, like most of what's put forth as 'threat intelligence', articles such as this are really more a means for analysts to say, "hey, look how smart I am, because I figured this out...". I'm sure that the discussion of assembly language code is interesting, and useful to other malware reverse engineers, but how does a CISO or IT staff utilize the contents of the third figure to protect and defend their infrastructure?
However, for anyone who's familiar with the Pyramid of Pain, you'll understand the efficacy of a bigger list of items that might...and do...change quickly. Instead, if you're interested in hunting, I'd recommend looking for items such as the persistence mechanism listed in the article, as well as monitoring for the creation of new values (if you can).
Like I said, I agree with Ryan's approach to hunting, if you're new to it...start small, and learn what that set of artifacts looks like in your environment. I did the same thing years ago, before the terms "APT" and "hunting" were in vogue...back then, I filed it under "doing my job". Essentially, I wrote some small code that would give me a list of all systems visible to the domain controllers, and then reach out to each one and pull the values listed beneath the Run keys, for the system and the logged in user. The first time I ran this, I had a pretty big list, and as I started seeing what was normal and verifying entries, they got whitelisted. In a relatively short time, I could run this search during a meeting or while I was at lunch, and come back to about half a page of entries that had to be run down.
Tools
I ran across this post over at PostModernSecurity recently, and I think that it really illustrates somethings about the #DFIR community beyond just the fact that these tools are available for use.
The author starts his post with:
...I covet and hoard security tools. But I’m also frugal and impatient,..
Having written some open source tools, I generally don't appreciate it when someone "covets and hoards" what I've written, largely because in releasing the tools, I'd like to get some feedback as to if and how the tool fills a need. I know that the tool meets my needs...after all, that's why I wrote it. But in releasing it and sharing it with others, I've very often been disappointed when someone says that they've downloaded the tool, and the conversation ends right there, at that point...suddenly and in a very awkward manner.
Then there's the "frugal and impatient" part...I think that's probably true for a lot of us, isn't it? At least, sometimes, that is. However, there are a few caveats one needs to keep in mind when using tools like those the author has listed. For instance, what is the veracity of the tools? How accurate are they?
More importantly, I saw the links to the free "malware analysis" sites...some referenced performing "behavioral analysis". Okay, great...but more important than the information provided by these tools is how that information is interpreted by the analyst. If the analyst is focused on free and easy, the question then becomes, how much effort have they put into understanding the issue, and are they able to correctly interpret the data returned by the tools?
For example, look at how often the ShimCache or AppCompatCache data from the Windows Registry is misinterpreted by analysts. That misinterpretation then becomes the basis for findings that then become statements in reports to clients.
There are other examples, but the point is that if the analyst hasn't engaged in the academic rigor to understand something and they're just using a bunch of free tools, the question then becomes, is the analyst correctly interpreting the data that they're being provided by those tools?
Don't get me wrong...I think that the list of tools is a good one, and I can see myself using some of them at some point in the future. But when I do so, I'll very likely be looking for certain things, and verifying the data that I get back from the tools.
I updated a plugin recently and provided a new one, and thought I'd share some information about those updates here...
The updated plugin is environment.pl, originally written in 2011; the update that I added to the code was to specifically look for and alert on the value described in this blog post. So, four years later, I added a small bit of code to the plugin to look for something specific in the data.
I added the malware.pl plugin, which can be run against any hive; it has specific sections in its code that describe what's being looked for, in which hive, along with references as to the sources from which the keys, values or data in question were derived - why was I looking for them in the first place? Essentially, these are all artifacts I find myself looking for time and again, and I figured I'd just keep them together in one plugin. If you look at the plugin contents, you'll see that I copied the code from secrets.pl and included it.
There are a couple of other plugins I thought I'd mention, in case folks hadn't considered using them....
The sizes.pl plugin was written to address malware maintaining configuration information in a Registry value, as described in this Symantec post. You can run this plugin against any hive.
In testing for this particular issue, I had specifically crafted two Registry key names, using the method outlined in the Secureworks blog post. This allowed me to create some useful data that mimicked what we'd seen, and provided an opportunity for more comprehensive testing.
As you can see from the output of the plugin listed below, I had also crafted a Registry value name using the same method, to see if the plugin would detect that, as well.
C:\Perl\rr>rip -r d:\cases\local\ntuser.dat -p rlo
Launching rlo v.20130904
rlo v.20130904
(All) Parse hive, check key/value names for RLO character
RLO control char detected in key name: \Software\gpu.etadp [gpupdate]
RLO control char detected in key name: \Software\.etadpupg [gpupdate]
RLO control char detected in value name: \Software\.etadpupg :.etadpupg [gpupdate]
Now, when running the rlo.pl plugin, analysts need to keep in mind that it's looking for something very specific; in this case, indications of the RLO Unicode control character. What's great about plugins like this is that you can include them in your process, run them every time you're conducting analysis, and they'll alert you when there's an issue.
Just as PSA, I have provided these plugins but I haven't updated any of the profiles...I leave that up to the users. So, if you're downloading the plugins folder and refreshing it in place, do not expect to see the
Anti-Forensic Malware
I ran across this InfoSecurity Magazine article recently, and while the title caught my attention, I was more than a bit surprised at the lack of substance.
There are a couple of statements in the blog post that I wanted to address, and share my thoughts on...
Increasingly, bad actors are using techniques that leave little trace on physical disks. And unfortunately, the white hats aren’t keeping up: There’s a shortage of digital forensics practitioners able to investigate these types of offensives.
As to the first sentence, sometimes, yes. Other times, not so much.
The second statement regarding "white hats" is somewhat ambiguous, don't you think? Who are the "white hats"? From my perspective, if "white hats" are the folks investigating these breaches, it's not so much that we aren't keeping up, as it is that the breaches themselves aren't being detected in a timely manner, due to a lack of instrumentation. By the time the "white hats" get the call to investigate the breach, a great deal of the potential evidence has been obviated.
Finally, I don't know that I agree with the final statement, regarding the shortage of practitioners. Sometimes, there's nothing to investigate. As I described in a recent blog post, when putting together some recent presentations, I looked at the statistics in annual security trends reports. One of the statistics I found interested was dwell time, or median time to detection. The point I tried to make in the presentations was that when consultants go on-site to investigate a breach, they're able to see indicators that allow them to identify these numbers. For example in the M-Trends 2015 report, there was an infrastructure that had been compromised 8 years before the compromise was detected.
I would suggest that it's not so much a shortage of practitioners able to investigate these breaches, it's a lack of management oversight that prevents the infrastructure from being instrumented in a manner that provides for timely detection of breaches. By the time some breaches are detected (many through external, third party notification), the systems in question have likely been rebooted multiple times, potentially obviating memory analysis all together.
If a crime is committed and the perpetrator had to walk across a muddy field to commit that crime (leaving footprints), and that field is dug up and paved over with a parking lot before the crime is reported, you cannot then say that there aren't enough trained responders able to investigate the crime.
...seen a rise in file-less malware, which exists only in volatile memory and avoids installation on a target’s file system.
"File-less malware"? Like Poweliks? Here's a TrendMicro blog post regarding PhaseBot, which references a TrendMicro article on Poweliks. Sure, there may not be a file on disk, but there's something pulled from the Registry, isn't there?
Malware comes from somewhere...it doesn't magically appear out of nowhere. If you take a system off of the main network and reboot it, and find indications of malware persisting, then it's somewhere on the system. Just because it is in memory, but there are no obvious indications of the malware within the file system doesn't mean that it can't be found.
Hunting
At the recent HTCIA 2015 Conference, I attended Ryan's presentation on "Hunting in the Dark", and I found it fascinating that at a sufficient level of abstraction, those of us who are doing "hunting" are doing very similar things; we may use different terms to describe it (what Ryan refers to as "harvesting and stacking", the folks I work with call it "using strategic rules")
Ryan's presentation was mostly directed to folks who work within one environment, and was intended to address the question of, "...how do I get started?" Ryan had some very good advice for folks in that position...start small, take a small bite, and use it to get familiar with your infrastructure to learn what is "normal", and what might not be normal.
Along those lines, a friend of mine recently asked a question regarding detecting web shells in an environment using only web server logs. Apparently in response to that question, ThreatStream posted an article explaining just how to do this. So this is an example of how someone can start hunting within their own environment, with limited resources. If you're hunting for web shells, there are number of other things I'd recommend looking at, but the original question was how to do so using only the web server logs.
The folks at ThreatStream also posted this article regarding "evasive maneuvers" used by a threat actor group. If you read the article, you will quickly see that it is more about obfuscation techniques used in the malware and it's communications means, which can significantly effect network monitoring. Reading the article, many folks will likely take a look at their own massive lists of C2 domain names and IP addresses, and append those listed in the article to that list. So, like most of what's put forth as 'threat intelligence', articles such as this are really more a means for analysts to say, "hey, look how smart I am, because I figured this out...". I'm sure that the discussion of assembly language code is interesting, and useful to other malware reverse engineers, but how does a CISO or IT staff utilize the contents of the third figure to protect and defend their infrastructure?
However, for anyone who's familiar with the Pyramid of Pain, you'll understand the efficacy of a bigger list of items that might...and do...change quickly. Instead, if you're interested in hunting, I'd recommend looking for items such as the persistence mechanism listed in the article, as well as monitoring for the creation of new values (if you can).
Like I said, I agree with Ryan's approach to hunting, if you're new to it...start small, and learn what that set of artifacts looks like in your environment. I did the same thing years ago, before the terms "APT" and "hunting" were in vogue...back then, I filed it under "doing my job". Essentially, I wrote some small code that would give me a list of all systems visible to the domain controllers, and then reach out to each one and pull the values listed beneath the Run keys, for the system and the logged in user. The first time I ran this, I had a pretty big list, and as I started seeing what was normal and verifying entries, they got whitelisted. In a relatively short time, I could run this search during a meeting or while I was at lunch, and come back to about half a page of entries that had to be run down.
Tools
I ran across this post over at PostModernSecurity recently, and I think that it really illustrates somethings about the #DFIR community beyond just the fact that these tools are available for use.
The author starts his post with:
...I covet and hoard security tools. But I’m also frugal and impatient,..
Having written some open source tools, I generally don't appreciate it when someone "covets and hoards" what I've written, largely because in releasing the tools, I'd like to get some feedback as to if and how the tool fills a need. I know that the tool meets my needs...after all, that's why I wrote it. But in releasing it and sharing it with others, I've very often been disappointed when someone says that they've downloaded the tool, and the conversation ends right there, at that point...suddenly and in a very awkward manner.
Then there's the "frugal and impatient" part...I think that's probably true for a lot of us, isn't it? At least, sometimes, that is. However, there are a few caveats one needs to keep in mind when using tools like those the author has listed. For instance, what is the veracity of the tools? How accurate are they?
More importantly, I saw the links to the free "malware analysis" sites...some referenced performing "behavioral analysis". Okay, great...but more important than the information provided by these tools is how that information is interpreted by the analyst. If the analyst is focused on free and easy, the question then becomes, how much effort have they put into understanding the issue, and are they able to correctly interpret the data returned by the tools?
For example, look at how often the ShimCache or AppCompatCache data from the Windows Registry is misinterpreted by analysts. That misinterpretation then becomes the basis for findings that then become statements in reports to clients.
There are other examples, but the point is that if the analyst hasn't engaged in the academic rigor to understand something and they're just using a bunch of free tools, the question then becomes, is the analyst correctly interpreting the data that they're being provided by those tools?
Don't get me wrong...I think that the list of tools is a good one, and I can see myself using some of them at some point in the future. But when I do so, I'll very likely be looking for certain things, and verifying the data that I get back from the tools.
Saturday, September 05, 2015
Registry Analysis
I gave a presentation on Registry analysis at the recent HTCIA2015 Conference, and I thought that there were some things from the presentation that might be worth sharing.
What is Registry analysis?
For the purposes of DFIR work, Registry analysis is the collection and interpretation of data and metadata from Registry keys and values.
The collection part is easy...it's the interpretation part of that definition that is extremely important. In my experience, I see a lot of issues with interpretation of data collected from the Registry. The two biggest ones are what the timestamps associated with ShimCache entries mean, and what persistence via a particular key path really means.
Many times, you'll see the timestamps embedded in the ShimCache data referred to as either the execution time, or "creation/modification" time. Referring to this timestamp as the "execution time" can be very bad, particularly if you're using it to demonstrate the window of compromise during an incident, or the time between first infection and discovery. If the file is placed on a system and timestomped prior to being added to the ShimCache, or the method for getting it on the system preserves the original last modification time, that could significantly skew your understanding of the event. Analysts need to remember that for systems beyond 32-bit XP, the timestamp in the ShimCache data is the last modification time from the file system metadata; for NTFS, this means the $STANDARD_INFORMATION attribute within the MFT record.
Ryan's slides include some great information about the ShimCache data, as does the original white paper on the subject.
With respect to persistence, I see a lot of write-ups that state that malware creates persistence by creating a value beneath the Run key in the HKCU hive, and the write-up then states that that means that the malware will be started again the next time the system reboots. That's not the case at all...because if the persistence exists in a user's hive, then the malware won't be reactivated following a reboot until that user logs in. I completely understand how this is misinterpreted, particularly (although not exclusively) by malware analysts...MS says this a lot in their own malware write-ups. While simple testing will demonstrate otherwise, the vast majority of the time, you'll see malware analysts repeating this statement.
The point is that not all of the persistence locations within the Registry allow applications and programs to start on system start. Some require that a user log in first, and others require some other trigger or mechanism, such as an application being launched. It's very easy...too easy...to simply make the statement that any Registry value used for persistence allows the application to start on system reboot, because there's very little in the way of accountability. I've seen instances during incident response where malware was installed only when a particular user logged into the system; if the malware used a Registry value in that user's NTUSER.DAT hive for persistence, the system was rebooted, and the user account was not used to log in, then the malware would not be active. Making an incorrect statement about the malware could significantly impact the client's decision-making process (regarding AV licenses), or the decisions made by regulatory or compliance bodies (i.e., fines, sanctions, etc.).
Both of these items, when misinterpreted, can significantly impact the overall analysis of the incident.
Why do we do it?
There is an incredible amount of value in Registry analysis, and even more so when we incorporate it with other types of analysis. Registry analysis is rarely performed in isolation; rather, most often, it's used to augment other analysis processes, particularly timeline analysis, allowing analysts to develop a clearer, more focused picture of the incident. Registry analysis can be a significant benefit, particularly when we don't have the instrumentation in place that we would like to have (i.e., process creation monitoring, logging, etc.), but analysts also need to realize that Registry analysis is NOT the be-all-end-all of analysis.
In the presentation, I mention several of the annual security trend reports that we see; for example, from TrustWave, or Mandiant. My point of bringing these up is that the reports generally have statistics such as dwell time or median number of days to detection, statistics which are based on some sort of empirical evidence that provides analysts with artifacts/indicators of an adversary's earliest entry into the compromised infrastructure. If you've ever done this sort of analysis work, you'll know that you may not always be able to determine the initial infection vector (IIV), tracking back to say, the original phishing email or original web link/SWC site. Regardless, this is always based on some sort of hard indicator that an analyst can point to as the earliest artifact, and sometimes, this may be a Registry key or value.
Think about it...for an analyst to determine that the earliest data of compromise was...for example, in the M-Trends 2015 Threat Report, 8 yrs prior to the team being called in...there has to be something on the system, some artifact that acts as a digital muddy boot print on a white carpet. The fact of the matter is that it's something that the analyst can point to and show to another analyst in order to get corroboration. This isn't something where the analysts sit around rolling D&D dice...they have hard evidence, and that evidence may often be Registry keys, or value data.
What is Registry analysis?
For the purposes of DFIR work, Registry analysis is the collection and interpretation of data and metadata from Registry keys and values.
The collection part is easy...it's the interpretation part of that definition that is extremely important. In my experience, I see a lot of issues with interpretation of data collected from the Registry. The two biggest ones are what the timestamps associated with ShimCache entries mean, and what persistence via a particular key path really means.
Many times, you'll see the timestamps embedded in the ShimCache data referred to as either the execution time, or "creation/modification" time. Referring to this timestamp as the "execution time" can be very bad, particularly if you're using it to demonstrate the window of compromise during an incident, or the time between first infection and discovery. If the file is placed on a system and timestomped prior to being added to the ShimCache, or the method for getting it on the system preserves the original last modification time, that could significantly skew your understanding of the event. Analysts need to remember that for systems beyond 32-bit XP, the timestamp in the ShimCache data is the last modification time from the file system metadata; for NTFS, this means the $STANDARD_INFORMATION attribute within the MFT record.
Ryan's slides include some great information about the ShimCache data, as does the original white paper on the subject.
With respect to persistence, I see a lot of write-ups that state that malware creates persistence by creating a value beneath the Run key in the HKCU hive, and the write-up then states that that means that the malware will be started again the next time the system reboots. That's not the case at all...because if the persistence exists in a user's hive, then the malware won't be reactivated following a reboot until that user logs in. I completely understand how this is misinterpreted, particularly (although not exclusively) by malware analysts...MS says this a lot in their own malware write-ups. While simple testing will demonstrate otherwise, the vast majority of the time, you'll see malware analysts repeating this statement.
The point is that not all of the persistence locations within the Registry allow applications and programs to start on system start. Some require that a user log in first, and others require some other trigger or mechanism, such as an application being launched. It's very easy...too easy...to simply make the statement that any Registry value used for persistence allows the application to start on system reboot, because there's very little in the way of accountability. I've seen instances during incident response where malware was installed only when a particular user logged into the system; if the malware used a Registry value in that user's NTUSER.DAT hive for persistence, the system was rebooted, and the user account was not used to log in, then the malware would not be active. Making an incorrect statement about the malware could significantly impact the client's decision-making process (regarding AV licenses), or the decisions made by regulatory or compliance bodies (i.e., fines, sanctions, etc.).
Both of these items, when misinterpreted, can significantly impact the overall analysis of the incident.
Why do we do it?
There is an incredible amount of value in Registry analysis, and even more so when we incorporate it with other types of analysis. Registry analysis is rarely performed in isolation; rather, most often, it's used to augment other analysis processes, particularly timeline analysis, allowing analysts to develop a clearer, more focused picture of the incident. Registry analysis can be a significant benefit, particularly when we don't have the instrumentation in place that we would like to have (i.e., process creation monitoring, logging, etc.), but analysts also need to realize that Registry analysis is NOT the be-all-end-all of analysis.
In the presentation, I mention several of the annual security trend reports that we see; for example, from TrustWave, or Mandiant. My point of bringing these up is that the reports generally have statistics such as dwell time or median number of days to detection, statistics which are based on some sort of empirical evidence that provides analysts with artifacts/indicators of an adversary's earliest entry into the compromised infrastructure. If you've ever done this sort of analysis work, you'll know that you may not always be able to determine the initial infection vector (IIV), tracking back to say, the original phishing email or original web link/SWC site. Regardless, this is always based on some sort of hard indicator that an analyst can point to as the earliest artifact, and sometimes, this may be a Registry key or value.
Think about it...for an analyst to determine that the earliest data of compromise was...for example, in the M-Trends 2015 Threat Report, 8 yrs prior to the team being called in...there has to be something on the system, some artifact that acts as a digital muddy boot print on a white carpet. The fact of the matter is that it's something that the analyst can point to and show to another analyst in order to get corroboration. This isn't something where the analysts sit around rolling D&D dice...they have hard evidence, and that evidence may often be Registry keys, or value data.
Wednesday, September 02, 2015
HTCIA2015 Conference Follow up
I spoke at the HTCIA 2015 conference, held in Orlando, FL, on Mon, 31 Aug. In fact, I gave two presentations...Registry analysis, and lateral movement. You can see the video for the lateral movement presentation I gave at BSideCincy here...many thanks to the BSides Cincy guys and Adrian.
I haven't spoken at, or attended an HTCIA conference in quite a while. I had no idea if I was going to make it to this one, between airline delays and tropical storms. This one was held at the Rosen Shingle Creek Resort, a huge ("palatial" doesn't cover it) conference center..."huge", in the manner of Caesar's Palace. In fact, there was an Avon conference going on at the same time as the HTCIA conference, and there very well could have been other conferences there, as well. Given the humidity and volume of rain, having everything you'd need in one location was a very good thing. In fact, the rain was so heavy on Monday afternoon, after the final presentation, that there were leaks in the room.
After presenting on Monday, I attended Mari's presentation, which I've seen before...however, this is one of those presentations that it pays to see again. I think that many times when we're deeply engaged in forensic analysis, we don't often think about other artifacts that may be of use...either we aren't aware of them, due to lack of exposure, or we simply forgot. However, if you're doing ANYTHING at all related to determining what the user may have done on the system, you've got to at least consider what Mari was talking about. Why? Well, we all know that browsers have an automatic cache clean-up mechanism; if the user is right at about 19 days since the last cache clean-up in IE, and they do something bad, it's likely that the artifacts of activity are going to be deleted...which doesn't make them impossible to find, just harder. The cookies that Mari has researched AND provided a tool to collect can illustrate user activity long after the fact, either in specific activity, or simply illustrating the fact that the user was active on the system at a particular time.
Also, Mari is one of the very few denizens of the DFIR community who finds something, digs into it, researches it and runs it down, then writes it up and provides a tool to do the things she talked about in her write-up. This is very rare and unique within the community, and extremely valuable. Her presentation on Google Analytics cookies could very well provide coverage of a gap that many don't even know exist in their analysis.
I was also able to see Ryan's presentation on Tuesday morning. This one wasn't as heavily attended as the presentations on Monday, which is (I guess) to be expected. But I'll tell you...a lot of folks missed some very good information. I attended for a couple of reasons...one was that Ryan is a competitor, as much as a compatriot, within the community. We both do very similar work, so I wanted to see what he was sharing about what he does. I'm generally not particularly interested in presentations that talk about "hunting", because my experience at big conferences has often been that the titles of presentations don't match up with the content, but Ryan's definitely did so. Some of what I liked about his presentation was how he broke things down...rather than going whole hog with an enterprise roll-out of some commercial package, Ryan broke things down with, "...here are the big things I look for during an initial sweep...", and proceeded from there. He also recommended means for folks who want to start hunting in their own organization, and that they start small. Trying to do it all can be completely overwhelming, so a lot of folks don't even start. But taking just one small piece, and then using it to get familiar with what things look like in your environment, what constitutes "noise" vs "signal"...that's the way to get started.
What's interesting is that what Ryan talked about is exactly what I do in my day job. I either go in blind, with very little information, on an IR engagement, or I do a hunt, where a client will call and say, "hey, I don't have any specific information that tells me that I've been compromised, but I want a sanity check...", and so I do a "blind" hunt, pretty much exactly as Ryan described in his presentation. So it was interesting for me to see that, at a certain level of abstraction, we are pretty much doing the same things. Now, of course there are some differences...tools, exact steps in the process, and even the artifacts that we're looking for or at, may be a little different. But the fact of the matter is that just like I mentioned in my presentation, when a bad guy "moves through" an environment such as the Windows OS, there are going to be artifacts. Looking for a footprint here, an over-turned stone there, and maybe a broken branch or two will give you the picture of where the bad guy went and what they did. For me, seeing what Ryan recommended looking at was validating...because what he was talking about is what I do while both hunting and performing DFIR work. It was also good to see him recommending ways that folks could start doing these sorts of things in their own environments. It doesn't take a big commercial suite, or any special skills...it simply takes the desire, and the rest of what's needed (i.e., how to collect the information, what to look for, etc.) is all available.
All in all, I had a good time, and learned a lot from the folks I was able to engage with.
Addendum: While not related to the conference, here are some other good slides that provide information about a similar topic as Ryan's...
I haven't spoken at, or attended an HTCIA conference in quite a while. I had no idea if I was going to make it to this one, between airline delays and tropical storms. This one was held at the Rosen Shingle Creek Resort, a huge ("palatial" doesn't cover it) conference center..."huge", in the manner of Caesar's Palace. In fact, there was an Avon conference going on at the same time as the HTCIA conference, and there very well could have been other conferences there, as well. Given the humidity and volume of rain, having everything you'd need in one location was a very good thing. In fact, the rain was so heavy on Monday afternoon, after the final presentation, that there were leaks in the room.
After presenting on Monday, I attended Mari's presentation, which I've seen before...however, this is one of those presentations that it pays to see again. I think that many times when we're deeply engaged in forensic analysis, we don't often think about other artifacts that may be of use...either we aren't aware of them, due to lack of exposure, or we simply forgot. However, if you're doing ANYTHING at all related to determining what the user may have done on the system, you've got to at least consider what Mari was talking about. Why? Well, we all know that browsers have an automatic cache clean-up mechanism; if the user is right at about 19 days since the last cache clean-up in IE, and they do something bad, it's likely that the artifacts of activity are going to be deleted...which doesn't make them impossible to find, just harder. The cookies that Mari has researched AND provided a tool to collect can illustrate user activity long after the fact, either in specific activity, or simply illustrating the fact that the user was active on the system at a particular time.
Also, Mari is one of the very few denizens of the DFIR community who finds something, digs into it, researches it and runs it down, then writes it up and provides a tool to do the things she talked about in her write-up. This is very rare and unique within the community, and extremely valuable. Her presentation on Google Analytics cookies could very well provide coverage of a gap that many don't even know exist in their analysis.
I was also able to see Ryan's presentation on Tuesday morning. This one wasn't as heavily attended as the presentations on Monday, which is (I guess) to be expected. But I'll tell you...a lot of folks missed some very good information. I attended for a couple of reasons...one was that Ryan is a competitor, as much as a compatriot, within the community. We both do very similar work, so I wanted to see what he was sharing about what he does. I'm generally not particularly interested in presentations that talk about "hunting", because my experience at big conferences has often been that the titles of presentations don't match up with the content, but Ryan's definitely did so. Some of what I liked about his presentation was how he broke things down...rather than going whole hog with an enterprise roll-out of some commercial package, Ryan broke things down with, "...here are the big things I look for during an initial sweep...", and proceeded from there. He also recommended means for folks who want to start hunting in their own organization, and that they start small. Trying to do it all can be completely overwhelming, so a lot of folks don't even start. But taking just one small piece, and then using it to get familiar with what things look like in your environment, what constitutes "noise" vs "signal"...that's the way to get started.
What's interesting is that what Ryan talked about is exactly what I do in my day job. I either go in blind, with very little information, on an IR engagement, or I do a hunt, where a client will call and say, "hey, I don't have any specific information that tells me that I've been compromised, but I want a sanity check...", and so I do a "blind" hunt, pretty much exactly as Ryan described in his presentation. So it was interesting for me to see that, at a certain level of abstraction, we are pretty much doing the same things. Now, of course there are some differences...tools, exact steps in the process, and even the artifacts that we're looking for or at, may be a little different. But the fact of the matter is that just like I mentioned in my presentation, when a bad guy "moves through" an environment such as the Windows OS, there are going to be artifacts. Looking for a footprint here, an over-turned stone there, and maybe a broken branch or two will give you the picture of where the bad guy went and what they did. For me, seeing what Ryan recommended looking at was validating...because what he was talking about is what I do while both hunting and performing DFIR work. It was also good to see him recommending ways that folks could start doing these sorts of things in their own environments. It doesn't take a big commercial suite, or any special skills...it simply takes the desire, and the rest of what's needed (i.e., how to collect the information, what to look for, etc.) is all available.
All in all, I had a good time, and learned a lot from the folks I was able to engage with.
Addendum: While not related to the conference, here are some other good slides that provide information about a similar topic as Ryan's...
Friday, August 28, 2015
Updates & Links
HTCIA2015 Presentations
For those of you attending HTCIA2015 (or just interested), I printed my presentations to PDF format and uploaded them to my GitHub site. Unfortunately, as you'll see, particularly with the Registry analysis presentation, there are slides that are just place holders, so you won't know what is said unless you're actually there.
Indicators
I recently read this post at the SecurityIntelligence web site, and was more than just a little happy to see a malware write-up that contained host-based indicators that could be used by analysts to determine if a system had been affected by this malware. The same could be extended to an image acquired from the system, or to the entire infrastructure.
However, something does concern me about the write-up, and is found in the section titled "Dyre's Run Key in Non-Admin Installations". The write-up states:
Until a few weeks ago, these non-admin installations had Dyre register a run key in the Windows Registry, designed to have it automatically run as soon as the computer is rebooted by the user:
The write-up then goes on to list the user's Run key, located in the NTUSER.DAT hive file. This goes back to what I've said before about specificity and clarity of language...the malware does not "register a run key"; it creates a value beneath the Run key. When this occurs, the persistence only works to re-start the malware when the user logs in, not when the system is rebooted.
I know that this seems pedantic, but Registry keys and values have different structures and properties, and are therefore...well...different. The commands to create or retrieve Registry keys via reg.exe are different from those for values. If you approached a developer who had no DFIR background and asked them to create a tool to look for a specific Registry key on all systems within an infrastructure, when you really meant value, you'd get a piece of code that likely returned nothing, or incorrect information.
I understand that Registry analysis is one of the least understood areas of DFIR analysis work. So many Registry indicators are misunderstood and misinterpreted, that I think that it's important that analysts from across the many fields in information security (malware RE, DFIR, etc.) accept a common structure and usage of terminology.
That same section does, however, include the command used to create the Scheduled Task, and what's listed in the write-up provides a great deal of information regarding how an analyst can detect this either on a system, within an acquired image, or across an enterprise. It can also be used to detect the persistence mechanism being created, if you're using something like SysMon or Carbon Black.
I would say that I'm adding this one to my bag of tricks, but it's already there...the timeline analysis process that I use can already detect this "renovation". I think that more than anything, I'm just glad to see this level of detail provided by someone doing malware analysis, as it's not often that you see such things.
Plugin Updates
I've recently written a RegRipper plugin that may prove to be helpful, and someone else has updated another plugin...
handler.pl - there is malware out there that modifies the "(Default)" value beneath the HKCR\Network\SharingHandler key, which essentially removes the hand icon from shared resources. I wrote this plugin recently in order to help analysts determine if the value had been modified. In the hives that I have available, the value simply points to "ntshrui.dll".
winrar2.pl - "randomaccess" made some updates to the winrar.pl plugin, and shared them, so I'm including the plugin in the distribution. Thanks to "randomaccess" for providing the plugin...I hope that folks will find the information it provides valuable.
Windows 10
It's likely that many of you may have recently updated your Win7 to Win10, via the free upgrade...I did.
I know that when I present at conferences, one of the questions I get asked quite often is, "...what's the new hotness in Windows 10?" Well, I'm providing some links below...in part because my thoughts are that if you don't understand the old hotness (i.e., Registry analysis, ADSs, Jump Lists, etc.), what good is the new hotness?
Some Win10 Forensics Resources
Brent Muir's slides on SlideShare
PDF Document from Champlain
Zena Forensics - Win10 Prefetch files
For those of you attending HTCIA2015 (or just interested), I printed my presentations to PDF format and uploaded them to my GitHub site. Unfortunately, as you'll see, particularly with the Registry analysis presentation, there are slides that are just place holders, so you won't know what is said unless you're actually there.
Indicators
I recently read this post at the SecurityIntelligence web site, and was more than just a little happy to see a malware write-up that contained host-based indicators that could be used by analysts to determine if a system had been affected by this malware. The same could be extended to an image acquired from the system, or to the entire infrastructure.
However, something does concern me about the write-up, and is found in the section titled "Dyre's Run Key in Non-Admin Installations". The write-up states:
Until a few weeks ago, these non-admin installations had Dyre register a run key in the Windows Registry, designed to have it automatically run as soon as the computer is rebooted by the user:
The write-up then goes on to list the user's Run key, located in the NTUSER.DAT hive file. This goes back to what I've said before about specificity and clarity of language...the malware does not "register a run key"; it creates a value beneath the Run key. When this occurs, the persistence only works to re-start the malware when the user logs in, not when the system is rebooted.
I know that this seems pedantic, but Registry keys and values have different structures and properties, and are therefore...well...different. The commands to create or retrieve Registry keys via reg.exe are different from those for values. If you approached a developer who had no DFIR background and asked them to create a tool to look for a specific Registry key on all systems within an infrastructure, when you really meant value, you'd get a piece of code that likely returned nothing, or incorrect information.
I understand that Registry analysis is one of the least understood areas of DFIR analysis work. So many Registry indicators are misunderstood and misinterpreted, that I think that it's important that analysts from across the many fields in information security (malware RE, DFIR, etc.) accept a common structure and usage of terminology.
That same section does, however, include the command used to create the Scheduled Task, and what's listed in the write-up provides a great deal of information regarding how an analyst can detect this either on a system, within an acquired image, or across an enterprise. It can also be used to detect the persistence mechanism being created, if you're using something like SysMon or Carbon Black.
I would say that I'm adding this one to my bag of tricks, but it's already there...the timeline analysis process that I use can already detect this "renovation". I think that more than anything, I'm just glad to see this level of detail provided by someone doing malware analysis, as it's not often that you see such things.
Plugin Updates
I've recently written a RegRipper plugin that may prove to be helpful, and someone else has updated another plugin...
handler.pl - there is malware out there that modifies the "(Default)" value beneath the HKCR\Network\SharingHandler key, which essentially removes the hand icon from shared resources. I wrote this plugin recently in order to help analysts determine if the value had been modified. In the hives that I have available, the value simply points to "ntshrui.dll".
winrar2.pl - "randomaccess" made some updates to the winrar.pl plugin, and shared them, so I'm including the plugin in the distribution. Thanks to "randomaccess" for providing the plugin...I hope that folks will find the information it provides valuable.
Windows 10
It's likely that many of you may have recently updated your Win7 to Win10, via the free upgrade...I did.
I know that when I present at conferences, one of the questions I get asked quite often is, "...what's the new hotness in Windows 10?" Well, I'm providing some links below...in part because my thoughts are that if you don't understand the old hotness (i.e., Registry analysis, ADSs, Jump Lists, etc.), what good is the new hotness?
Some Win10 Forensics Resources
Brent Muir's slides on SlideShare
PDF Document from Champlain
Zena Forensics - Win10 Prefetch files
Sunday, August 16, 2015
Updates
RegRipper Plugin Updates
I made some updates to a couple of plugins recently. One was to the networklist.pl/networklist_tln.pl plugins; the update was to add collecting subkey names and LastWrite times from beneath the Nla\Cache\Intranet key. At this point, I'm not 100% clear on what the dates refer to, but I'm hoping that will come as the data is observed and added to timelines.
I also updated the nic2.pl plugin based on input from Yogesh Khatri. Specifically, he found that in some cases, there's a string (REG_SZ) value named "DhcpNetworkHint" that, if you reverse the individual nibbles of the string, will spell out the SSID.
This is an interesting finding in a couple of ways. First, Yogesh found that by reading the string in hex and reversing the nibbles, you'd get the SSID. That in itself is pretty cool. However, what this also says is that if you'd doing a keyword search for the SSID, that search will not return this value.
jIIr
Corey's most recent blog post, Go Against The Grain, is a pretty interesting read. It is an interesting thought. As a consultant, I'm not usually "in" an infrastructure long enough to try to effect change in this manner, but it would be very interesting to hear how others may have utilized this approach.
"New" Tools
Eric Zimmerman recently released a tool for parsing the AmCache.hve file, which is a "new" file on Windows systems that follows the Registry hive file format. So, the file follows the same format as the more "traditional" Registry hive files, but it's not part of the Registry that we see when we open RegEdit on a live system.
Yogesh Khatri blogged about the AmCache.hve file back in 2013 (here, and then again here).
While Eric's blog post focuses on Windows 10, it's important to point out that the AmCache. hve file was first seen on Windows 8 systems, and I started seeing them in images of Windows 7 systems since about the beginning of 2015. Volatility has a parser for AmCache.hve files found in memory, and RegRipper has had a plugin to parse the AmCache.hve file since Dec, 2013.
I applaud Eric for adding a winnowing capability to his tool; in an age where threat hunting is a popular topic for discussion, data reduction (or, "how do I find the needle in the haystack with no prior knowledge or experience?") is extremely important. I've tried doing something similar with my own tools (including, to some extent, some RegRipper plugins) by including an alerting capability based on file paths found in various data sources (i.e., Prefetch file metadata, Registry value data, etc.). The thought behind adding this capability was that items that would likely be of interest to the analyst would be pulled out. However, to date, the one comment I've received about this capability has been, "...if it says 'temp was found in the path', what does that mean?"
Again, Eric's addition of the data reduction technique to his tool is really very interesting, and is very likely to be extremely valuable.
Shell Items
I had an interesting chat with David Cowen recently regarding stuff he'd found in LNK files; specifically, Windows shortcut/LNK files can contain shell item ID lists, which can contain extremely valuable information, depending upon the type of examination you're performing. Specifically, some shell item ID lists (think shellbags) comprise paths to files, such as those found on network shares and USB devices. In many cases, the individual shell items contain not only the name of a folder in the path, but also timestamp information. Many of the shell items also contain the MFT reference number (record number and sequence number combined) for the folder. Using this information, you can build a historical picture of what some portion of the file system looked like, at a point in the past.
Conference Presentations And Questions
Many times when I present at a conference and open up for questions, one question I hear many times is, "What's new in Windows (insert next version number)?" Many times, I'm sort of mystified by questions like this, as I don't tend to see the "newest hotness" as something that requires immediate attention if analysts aren't familiar with "old hotness", such as ADSs, Registry analysis, etc.
As an example, I saw this tweet not long ago, which led to this SANS ISC Handler's Diary post. Jump Lists are not necessarily "new hotness", and have been part of Windows systems since Windows 7. As far as resources go, the ForensicsWiki Jump Lists page was originally created on 23 Aug 2011. I get that the tweet was likely bringing attention back to something of value, rather than pointing out something that is "new".
As a bit of a side note, I tend to use my own tools for parsing files like Jump Lists, because the allow me to incorporate the data in to the timelines I create, if that's something I need to do.
I made some updates to a couple of plugins recently. One was to the networklist.pl/networklist_tln.pl plugins; the update was to add collecting subkey names and LastWrite times from beneath the Nla\Cache\Intranet key. At this point, I'm not 100% clear on what the dates refer to, but I'm hoping that will come as the data is observed and added to timelines.
I also updated the nic2.pl plugin based on input from Yogesh Khatri. Specifically, he found that in some cases, there's a string (REG_SZ) value named "DhcpNetworkHint" that, if you reverse the individual nibbles of the string, will spell out the SSID.
This is an interesting finding in a couple of ways. First, Yogesh found that by reading the string in hex and reversing the nibbles, you'd get the SSID. That in itself is pretty cool. However, what this also says is that if you'd doing a keyword search for the SSID, that search will not return this value.
jIIr
Corey's most recent blog post, Go Against The Grain, is a pretty interesting read. It is an interesting thought. As a consultant, I'm not usually "in" an infrastructure long enough to try to effect change in this manner, but it would be very interesting to hear how others may have utilized this approach.
"New" Tools
Eric Zimmerman recently released a tool for parsing the AmCache.hve file, which is a "new" file on Windows systems that follows the Registry hive file format. So, the file follows the same format as the more "traditional" Registry hive files, but it's not part of the Registry that we see when we open RegEdit on a live system.
Yogesh Khatri blogged about the AmCache.hve file back in 2013 (here, and then again here).
While Eric's blog post focuses on Windows 10, it's important to point out that the AmCache. hve file was first seen on Windows 8 systems, and I started seeing them in images of Windows 7 systems since about the beginning of 2015. Volatility has a parser for AmCache.hve files found in memory, and RegRipper has had a plugin to parse the AmCache.hve file since Dec, 2013.
I applaud Eric for adding a winnowing capability to his tool; in an age where threat hunting is a popular topic for discussion, data reduction (or, "how do I find the needle in the haystack with no prior knowledge or experience?") is extremely important. I've tried doing something similar with my own tools (including, to some extent, some RegRipper plugins) by including an alerting capability based on file paths found in various data sources (i.e., Prefetch file metadata, Registry value data, etc.). The thought behind adding this capability was that items that would likely be of interest to the analyst would be pulled out. However, to date, the one comment I've received about this capability has been, "...if it says 'temp was found in the path', what does that mean?"
Again, Eric's addition of the data reduction technique to his tool is really very interesting, and is very likely to be extremely valuable.
Shell Items
I had an interesting chat with David Cowen recently regarding stuff he'd found in LNK files; specifically, Windows shortcut/LNK files can contain shell item ID lists, which can contain extremely valuable information, depending upon the type of examination you're performing. Specifically, some shell item ID lists (think shellbags) comprise paths to files, such as those found on network shares and USB devices. In many cases, the individual shell items contain not only the name of a folder in the path, but also timestamp information. Many of the shell items also contain the MFT reference number (record number and sequence number combined) for the folder. Using this information, you can build a historical picture of what some portion of the file system looked like, at a point in the past.
Conference Presentations And Questions
Many times when I present at a conference and open up for questions, one question I hear many times is, "What's new in Windows (insert next version number)?" Many times, I'm sort of mystified by questions like this, as I don't tend to see the "newest hotness" as something that requires immediate attention if analysts aren't familiar with "old hotness", such as ADSs, Registry analysis, etc.
As an example, I saw this tweet not long ago, which led to this SANS ISC Handler's Diary post. Jump Lists are not necessarily "new hotness", and have been part of Windows systems since Windows 7. As far as resources go, the ForensicsWiki Jump Lists page was originally created on 23 Aug 2011. I get that the tweet was likely bringing attention back to something of value, rather than pointing out something that is "new".
As a bit of a side note, I tend to use my own tools for parsing files like Jump Lists, because the allow me to incorporate the data in to the timelines I create, if that's something I need to do.
Subscribe to:
Posts (Atom)