SANS Digital Forensics and Incident Response Blog

SANS Digital Forensics and Incident Response Blog

Computer Forensic Artifacts: Windows 7 Shellbags

Windows ShellbagsAs Windows Registry artifacts go, the "Shellbag" keys tend to be some of the more complicated artifacts we have to decipher. But they are worth the effort, giving an excellent means to prove the existence of files and folders along with user knowledge. Shellbags can be used to answer the difficult questions of data enumeration in intrusion cases, identify the contents of long gone removable devices, and show the contents of previously mounted encrypted volumes. Information persists for deleted folders, providing an invaluable reference for items no longer part of the file system.

A Brief Overview

Windows uses the Shellbag keys to store user preferences for GUI folder display within Windows Explorer. Everything from visible columns to display mode (icons, details, list, etc.) to sort order are tracked. If you have ever made changes to a folder and returned to that folder to find your new preferences intact, then you have seen Shellbags in action. In the paper Using shellbag information to reconstruct user activities, the authors write that "Shellbag information is available only for folders that have been opened and closed in Windows Explorer at least once" [1]. In other words, the simple existence of a Shellbag sub-key for a given directory indicates that the specific user account once visited that folder. Thanks to the wonders of Windows Registry last write timestamps, we can also identify when that folder was first visited or last updated (and correlate with the embedded folder MAC times also stored by the key). In some cases, historical file listings are available. Given much of this information can only be found within Shellbag keys, it is little wonder why it has become a fan favorite.

The Shift from Windows XP

The architecture of Shellbag keys within Windows XP is well understood and has been broadly covered [1,2]. However this is not the case with the Windows 7 format. I have recently had good luck using Shellbags within computer intrusion cases to show evidence of file system enumeration by attackers using compromised accounts. These systems have largely been Windows XP or Server 2003 and when I first sat down to review a Windows 7 system I was severely disappointed. Following the trend of many of our favorite Registry keys being updated in Windows 7, the Shellbag keys underwent a major transformation. Gone are the familiar Shell, ShellNoRoam, and StreamMRU categories that respectively denoted network, local, and removable device folders. Data from all of these locations still appears to be collected, but all three artifact categories are now stored within the Shell subkey. The keys themselves are stored as a slightly different binary format making manual deciphering even more painful. I was beating my head against the wall trying to reverse engineer the new format when Rob Lee suggested I do something really smart: leverage an existing tool and work backwards. He introduced me to the Tzworks Shellbag Parser and I was hooked. Besides being the only true Windows 7 Shellbags parser I am aware of, it does a remarkable job of parsing Shellbag structures.

What you need to know

Along with updating the Registry keys, Windows 7 also gave us a completely new user-specific Registry hive named USRCLASS.dat. This hive supports the new User Access Control (UAC) and the mandatory access control integrity levels now baked into the operating system. In oversimplified terms, it is used to record configuration information from user processes that do not have access to write to the standard registry hives. In order to get all Shellbags information, we now need to parse both NTUSER.dat and USRCLASS.dat for each user account. These Registry hives are located in the %user profile% and %user profile%&#092AppData&#092Local&#092Microsoft&#092Windows folders respectively. The specific Shellbag keys are:

 

USRCLASS.DAT&#092Local Settings&#092Software&#092Microsoft&#092Windows&#092Shell&#092BagMRU

USRCLASS.DAT&#092Local Settings&#092Software&#092Microsoft&#092Windows&#092Shell&#092Bags

NTUSER.DAT&#092Software&#092Microsoft&#092Windows&#092Shell&#092BagMRU

NTUSER.DAT&#092Software&#092Microsoft&#092Windows&#092Shell&#092Bags

 

Microsoft documents additional Shellbag keys that may be present on Win7 systems, but after a review of several Win7, Vista, and 2008R2 systems I have been unable to find any evidence of them being used [4]. For reference purposes, the additional keys are (Wow6432Node keys are located on x64 systems):

 

NTUSER.DAT &#092Software&#092Microsoft&#092Windows&#092ShellNoRoam&#092BagMRU

NTUSER.DAT&#092Software&#092Microsoft&#092Windows&#092ShellNoRoam&#092Bags

USRCLASS.DAT&#092Wow6432Node&#092Local Settings&#092Software&#092Microsoft&#092Windows&#092Shell&#092Bags

USRCLASS.DAT&#092Wow6432Node&#092Local Settings&#092Software

 

Parsing Shellbag Keys Using TZworks Sbag.exe

Using the TZworks tool to parse Shellbags is trivial. It is a command-line tool with just a few parameters. If you are working on a live system, you can use the "listhives" parameter to have it identify the available user Registry hives.

Livehives Option in Sbag.exe


Once you know the paths of the hives you wish to parse, execute Sbag.exe and redirect the results to a .csv file (results are "|" delimited).

Parsing Shellbag Artifacts with Sbag.exe

 

Finally, import the files into your favorite spreadsheet and start your analysis.

Shellbag Results

What information should you expect to gather from the Shellbags keys? Each folder will have:

  • Bag Number [Identifies the "Bags" subkey containing user preferences — aka Nodeslot]
  • Registry key last write time [First access of folder or last preference change]
  • Folder name
  • Full path
  • Embedded creation date / time [Stored at the time the BagMRU key was created]
  • Embedded modify date / time [Stored at the time the BagMRU key was created]
  • Embedded access date / time [Stored at the time the BagMRU key was created]
My initial testing of TZworks Sbag.exe has found it to be highly reliable. In comparison to my previous go-to tool, Windows Registry Analyzer (which only accurately parses XP Shellbags), it does a more complete job, particularly with regard to timestamps. It works with both XP and Windows 7 artifacts, can parse both live and exported Registry hives, and the output is extremely easy to work with. Versions for Windows, Linux, and Mac OS X are available. If you haven't incorporated Shellbag review into your examinations, now is the time! Also, keep in mind that XP and Windows 7 Shellbag analysis is now included in the SANS 508 Advanced Forensics class.

[1] Zhu, Gladyshev, James (2009). Using shellbag information to reconstruct user activities, Digital Investigation, 6, S69-S77

[2] Shellbags Registry Forensics, John McCash

[3] Tzworks Sbag.exe

[4] Microsoft Support Article: Shellbag Keys

Chad Tilbury, GCFA, has spent over twelve years conducting computer crime investigations ranging from hacking to espionage to multi-million dollar fraud cases. He teaches FOR408 Windows Forensics and FOR508 Advanced Computer Forensic Analysis and Incident Response for the SANS Institute. Find him on Twitter @chadtilbury or at http://ForensicMethods.com.

 

7 Comments

Posted July 05, 2011 at 10:17 PM | Permalink | Reply

Joe Hamm

Thanks Chad. Interesting stuff. See you in Vegas.
Joe

Posted July 06, 2011 at 5:52 PM | Permalink | Reply

Jesse Lands

Great article. Keep it up.
Wrote a little batch script to do this automated.

for /F "tokens=*" %a in ('sbag.exe -livehives') do sbag.exe "%a" > registry.csv

We added it to our current LR process already.

Posted July 08, 2011 at 6:15 PM | Permalink | Reply

Rasmus Riis

Hi. Thankyou for your post. I haven't really messed around with shellbag values before, but I will now! :-)

Just a quick question..

You write:

Embedded creation date / time [Stored at the time the BagMRU key was created]

Embedded modify date / time [Stored at the time the BagMRU key was created]

Embedded access date / time [Stored at the time the BagMRU key was created]

Kant the 2 latter supposed to be last modified and accessed?

Regards

Rasmus Riis

Posted July 08, 2011 at 6:34 PM | Permalink | Reply

Chad Tilbury

Hi Rasmus.

When a folder is first added to the Shellbag key, its current creation, modification, and access times are embedded within that key. Those embedded timestamps appear to remain relatively static, meaning they are not updated in the Shellbag key when changes are made to them within the filesystem. Thus you can think of the embedded timestamps as a snapshot of those times taken when the BagMRU key is first created.

I hope this clarifies things!

Chad

Posted July 10, 2011 at 11:07 PM | Permalink | Reply

Ed Hunter

Great post. I'll add it to my notes for the FOR 508 class.

Posted September 13, 2011 at 11:01 AM | Permalink | Reply

Dan Williams

I'm doing a registry examination of the BagMRU to determine what the folder view was set to for a specific folder, but I'm not sure how this recorded.

Any ideas or assistance on this would be greatly appreciated.

The OS in question is Vista HP.

Posted February 22, 2012 at 8:53 AM | Permalink | Reply

Windows 7 Key

Any ideas or assistance on this would be greatly appreciated.

Post a Comment






Captcha

* Indicates a required field.