Locations starting from Windows 7:

Windows Explorer activity:

File:
<SYSTEMDRIVE>\Users\<USERNAME>\AppData\Local\Microsoft\Windows\UsrClass.dat

Registry keys:
HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU
HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags

Desktop and Network locations activity:

File:
<SYSTEMDRIVE>\Users\<USERNAME>\NTUSER.dat

Registry keys:
HKCU\Software\Microsoft\Windows\Shell\BagMRU
HKCU\Software\Microsoft\Windows\Shell\Bags.

Overview

The Shellbags are Windows Registry keys designed to enhance the user experience by keeping track of Windows Explorer graphical display settings on a folder-by-folder basis. For instance, a Shellbag entry is used to store the View mode of a folder (details, list, small/medium/large icons) as well as the columns displayed (entry names, dates, sizes, etc.) and their order.

Shellbags contain folders and network shares to which a given user has navigated (using the Windows Explorer), but not the content of a directory. Files will thus not be referenced, and subdirectories will only be referenced if they were navigated into. An exception applies to ZIP files and other archive formats (such as tar, 7z, tgz, …) in Windows 11 (2023-09 update) that are opened directly as folders through the Windows Explorer. In such cases, archive files are stored as if they were folders (with their content thus partially referenced, depending on the related activity). Shellbags entries are also generated by access to the Control Panel settings, on an interface-by-interface basis. The Shellbags entries related to the Control Panel can notably be useful to detect possible Windows Firewall (Control Panel\All Control Panel Items\Windows Defender Firewall\Customize Settings) or Credential Manager (Control Panel\User Accounts\Credential Manager) operations.

Various kinds of user activity may generate or update Shellbag entries (with different levels of data depending on the activity):

  • First access or renaming of folders, removable devices, or network shares through the Windows Explorer systematically generates a Shellbag entry.

  • Graphical opening of compressed archives or ISOs.

  • Access to the Control Panel interface.

  • Modification of the folder view preferences.

  • Etc.

Information of interest

Shellbag entries are stored in the registry as a tree-like data structure, with the root target having the topmost BagMRU key. This allows the reconstitution of the browsed directory tree. Each sub-target (for example, a subdirectory) of the parent target is then represented by both:

  • A registry subkey, named with a numerical value (starting from 0).

  • A registry value (in the parent target’s registry key), named with the same numerical value and associated with binary data that notably contains the target’s name.

Each Shellbag BagMRU registry key also contains:

  • An MRUListEx value, which maintains the visit order of the entries, i.e. the order in which the sub-targets of a target were accessed (the last sub-target accessed having an MRU position of 0).

    For example, My Computer will be associated with the topmost BagMRU key, C: with BagMRU\0 if it was accessed first (0), C:\Users with BagMRU\0\1 if Users was the second folder accessed under C:\ (1), C:\Users\USERNAME with BagMRU\0\1\0 if USERNAME was the first folder accessed under C:\Users, and so on. A hierarchical view of the Shellbag entries can thus be established.

  • A NodeSlot value, containing a numerical value that references the item’s Bags subkey. Each target is indeed associated with a subkey under the HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags key. This subkey, named with a numerical value corresponding to the NodeSlot of its associated target, contains the Explorer view settings for the target.

As the Shellbags entries are stored in user-specific registry hives, access to targets (folders, Control Panel interfaces, etc.) can be tied to a given user through their Shellbags. As Shellbags entries are populated only upon interaction (i.e. are not pre-populated), the mere presence of a Shellbag entry for a target is thus evidence that the user interacted with the given target. Shellbags entries are not automatically deleted upon deletion of the related folders and can thus be a source of historical information.

Each Shellbags entry for a given target yields the following information of forensic interest:

  • The target name and absolute path.

  • The target Modified, Access, and Created (MAC) timestamps (UTC), retrieved from the $MFT at the Shellbag entry creation (and not further updated).

  • Each entry in Shellbags BagMRU maintains an MRUListEx list, which records the order in which the sub-targets of a target were accessed (the last sub-target accessed having an MRU position of 0).

The first and last interacted timestamps can be indirectly deduced for some targets:

  • The First Interacted timestamp can be deduced for some targets thanks to the tree-like data structure of Shellbags entries. Indeed, for entries that do not have subkeys (i.e. directories for which no subdirectory was accessed), the First Interacted timestamp is equal to the key’s LastWriteTime timestamp. This is due to the fact that the key is created when a target is first accessed, and further activity for that target will not update the target BagMRU key’s values or its subkeys. Indeed, activities such as Explorer display settings modifications will update only the target Bags key (and not its BagMRU key directly). In such circumstances, the LastWriteTime timestamp reflects the timestamp of the key’s initial creation.

    When a subkey is created for the target (i.e. when a subdirectory of that particular directory is accessed), the timestamp becomes unreliable, as it reflects the creation of the subkey.

  • The Last Interacted timestamp can be deduced for the sub-target that was last interacted with. Indeed, as each Shellbag entry corresponds to a registry key, the key’s LastWriteTime timestamp indicates when the Shellbag entry was last updated. As the key is only updated when a (newly interacted with) sub-target is added (both as a subkey and a numerical value), the LastWriteTime timestamp of a key (with subkeys) corresponds to the timestamp of creation of the last added subkey. As this last added subkey can be identified by its MRU position of 0, the interaction timestamp of the last interacted with child bag/sub-target can be deduced (as the parent key’s LastWriteTime timestamp).

However, major updates of the Windows operating system may modify Shellbags entries, resulting in updated last write timestamps.

Tool(s)

ShellBagsExplorer and SBECmd tools (associated KAPE module SBECmd) can be used to parse Shellbags entries.

ShellBagsExplorer displays the Shellbags entries in a graphical user interface that allows browsing of the referenced targets, in a similar manner to Windows Explorer.

# Recursively enumerates the users' registry hives in the specified directory and parses their ShellBags entries.
SBECmd.exe --csv <CSV_DIRECTORY_OUTPUT> -d <C:\Users\<USERNAME> | C:\Users\ | DIRECTORY>

# Parses the ShellBags entries in the live registry.
SBECmd.exe --csv <CSV_DIRECTORY_OUTPUT> -l

References



View on GitHub