Computer Forensic Artifacts: Windows 7 Shellbags

轉自 SANS

As 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%\AppData\Local\Microsoft\Windows folders respectively. The specific Shellbag keys are:



USRCLASS.DAT\Local Settings\Software\Microsoft\Windows\Shell\BagMRU

USRCLASS.DAT\Local Settings\Software\Microsoft\Windows\Shell\Bags

NTUSER.DAT\Software\Microsoft\Windows\Shell\BagMRU

NTUSER.DAT\Software\Microsoft\Windows\Shell\Bags



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 \Software\Microsoft\Windows\ShellNoRoam\BagMRU

NTUSER.DAT\Software\Microsoft\Windows\ShellNoRoam\Bags

USRCLASS.DAT\Wow6432Node\Local Settings\Software\Microsoft\Windows\Shell\Bags

USRCLASS.DAT\Wow6432Node\Local Settings\Software



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


[3] Tzworks Sbag.exe




0 意見: