Communitygithub.com

分析Windows Shellbag工件

分析Windows Shellbag(BagMRU)注册表工件,使用SBECmd和ShellBags Explorer等工具进行取证调查。

分析Windows Shellbag工件 是什么?

该技能专注于分析Windows Shellbag注册表工件,这些工件由Windows资源管理器在用户浏览文件夹时创建,并记录文件夹视图设置(如图标大小、窗口位置、排序顺序和视图模式)。从取证角度看,Shellbag提供了用户访问特定文件夹的确凿证据——即使这些文件夹已被删除、驱动器已断开连接或用户配置文件已重置。技能指南涵盖用于提取和分析Shellbag数据的命令行工具SBECmd以及图形界面工具ShellBags Explorer,并详细介绍了注册表位置,包括NTUSER.DAT和UsrClass.dat中的关键路径。该技能还提供了实际取证调查场景,如证明USB设备浏览、检测网络共享访问以及识别已被删除但用户曾导航过的文件夹,并附有示例输出帮助理解分析结果。平台支持:Windows 7/8/10/11系统,需Python 3.8+和相应依赖。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-windows-shellbag-artifacts

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

分析Windows Shellbag工件 是做什么的?

概述

Shellbag是Windows注册表工件,用于记录用户通过Windows资源管理器与文件夹交互的方式,存储视图设置,如图标大小、窗口位置、排序顺序和视图模式。从取证角度看,Shellbag提供了用户访问文件夹的确凿证据——即使这些文件夹在系统中已不存在。当用户通过Windows资源管理器、打开/保存对话框或控制面板浏览到某个文件夹时,会在用户注册表配置单元中创建或更新一个Shellbag条目。这些条目会在文件夹删除、驱动器断开连接甚至用户配置文件重置后仍然存在,使得它们对于证明用户导航到本地驱动器、USB设备、网络共享或zip存档中的特定目录非常宝贵。

何时使用

  • 调查安全事件时,需要分析Windows Shellbag工件
  • 为此领域构建检测规则或威胁狩猎查询时
  • SOC分析师需要此分析类型的结构化流程时
  • 验证相关攻击技术的安全监控覆盖范围时

前提条件

  • 熟悉数字取证概念和工具
  • 访问测试或实验室环境以安全执行
  • 已安装Python 3.8+及所需依赖
  • 对任何测试活动获得适当授权

注册表位置

Windows 7/8/10/11

配置单元键路径存储内容
NTUSER.DATSoftware\Microsoft\Windows\Shell\BagMRU文件夹层次结构树
NTUSER.DATSoftware\Microsoft\Windows\Shell\Bags每个文件夹的视图设置
UsrClass.datLocal Settings\Software\Microsoft\Windows\Shell\BagMRU桌面/资源管理器外壳
UsrClass.datLocal Settings\Software\Microsoft\Windows\Shell\Bags附加视图设置

BagMRU结构

BagMRU键包含一个由编号子键组成的层次结构树,表示目录结构。每个子键值包含一个编码文件夹标识的Shell项(SHITEMID)二进制块:

  • 根(BagMRU):桌面命名空间根
  • BagMRU\0:通常为“我的电脑”
  • BagMRU\0\0:第一个驱动器(例如C:)
  • BagMRU\0\0\0:C:上的第一个子文件夹

每个Shell项包含:

  • 项类型(文件夹、驱动器、网络、zip、控制面板)
  • 短名称(8.3格式)
  • 长名称(Unicode)
  • 创建/修改时间戳
  • NTFS文件夹的MFT条目/序列

使用EZ Tools进行分析

SBECmd(命令行)

# 从注册表配置单元目录解析Shellbags
SBECmd.exe -d "C:\Evidence\Registry" --csv C:\Output --csvf shellbags.csv

# 从正在运行的系统解析(需要管理员权限)
SBECmd.exe --live --csv C:\Output --csvf live_shellbags.csv

# 关键输出列:
# AbsolutePath - 完整重建路径
# CreatedOn - 首次浏览文件夹的时间
# ModifiedOn - 视图设置最后更改的时间
# AccessedOn - 最后访问时间戳
# ShellType - Shell项类型(目录、驱动器、网络等)
# Value - 原始Shell项数据

ShellBags Explorer(图形界面)

# 启动图形界面工具进行交互式分析
ShellBagsExplorer.exe

# 加载注册表配置单元:文件 > 加载配置单元
# 导航树结构查看文件夹层次结构
# 右键单击条目可查看详细的Shell项属性

取证调查场景

证明USB设备浏览

Shellbag路径:我的电脑\E:\Confidential\Project_Files
Shell类型:目录(在可移动卷上)
创建时间:2025-03-15 09:30:00 UTC

这证明用户通过Windows资源管理器导航到了E:\Confidential\Project_Files,
即使USB驱动器已不再连接。卷标E:和目录时间戳
可以与USBSTOR和MountPoints2注册表条目相关联。

检测网络共享访问

Shellbag路径:\\FileServer01\Finance\Q4_Reports
Shell类型:网络位置
访问时间:2025-02-20 14:15:00 UTC

这证明用户浏览了一个网络共享,即使该共享
已被弃用或访问权限已撤销。

识别已删除文件夹的访问证据

Shellbag路径:C:\Users\suspect\Documents\Exfiltration_Staging
Shell类型:目录
创建时间:2025-01-10 08:00:00 UTC

尽管C:\Users\suspect\Documents\Exfiltration_Staging
已不存在,但Shellbag条目证明用户
创建并导航到了此文件夹。

局限性

  • Shellbag仅记录文件夹级别的交互,不记录单个文件访问
  • 仅通过Windows资源管理器外壳和打开/保存对话框生成
  • 命令行访问(cmd、PowerShell)不会生成Shellbag条目
  • 通过API的程序化文件访问不会生成Shellbag条目
  • 时间戳可能反映视图设置更改,不一定是文件夹访问
  • Windows可能在Explorer关闭时批量更新Shellbag条目

参考文献

示例输出

$ SBECmd.exe -d "C:\Evidence\Users\jsmith" --csv /analysis/shellbag_output

SBECmd v2.1.0 - ShellBags Explorer(命令行)
====================================================
正在处理用户jsmith的配置单元:
  NTUSER.DAT:  C:\Evidence\Users\jsmith\NTUSER.DAT
  UsrClass.dat: C:\Evidence\Users\jsmith\AppData\Local\Microsoft\Windows\UsrClass.dat

[+] NTUSER.DAT Shellbag条目:   456
[+] UsrClass.dat Shellbag条目: 1,234
[+] 总Shellbag条目:           1,690

--- 文件夹访问时间线(事件窗口) ---
最后访问时间 (UTC)     | 文件夹路径                                               | 类型        | 访问次数
------------------------|---------------------------------------------------------|-------------|-------------
2024-01-15 14:34:05     | C:\Users\jsmith\Downloads                               | 文件系统 | 45
2024-01-15 14:36:25     | C:\ProgramData\Updates                                  | 文件系统 | 3
2024-01-15 15:05:00     | \\FILESERV01\Finance                                    | 网络     | 2
2024-01-15 15:12:30     | \\FILESERV01\Finance\Q4_Reports                          | 网络     | 1
2024-01-15 15:30:00     | E:\                                                     | 可移动   | 4
2024-01-15 15:30:45     | E:\Backup                                               | 可移动   | 3
2024-01-15 15:31:20     | E:\Backup\Corporate_Data                                | 可移动   | 2
2024-01-15 16:12:45     | \\FILESERV01\HR\Employees                                | 网络     | 1
2024-01-15 16:15:00     | \\FILESERV01\HR\Employees\Records_2024                   | 网络     | 1
2024-01-16 02:35:00     | C:\Windows\Temp                                         | 文件系统 | 5
2024-01-17 02:44:00     | C:\ProgramData\svc                                     | 文件系统 | 2
2024-01-18 01:10:00     | C:\Users\jsmith\AppData\Local\Temp                      | 文件系统 | 8

--- 网络共享访问 ---
  \\FILESERV01\Finance             首次:2023-09-10  最后:2024-01-15
  \\FILESERV01\Finance\Q4_Reports  首次:2024-01-15  最后:2024-01-15  (新增)
  \\FILESERV01\HR\Employees        首次:2024-01-15  最后:2024-01-15  (新增)
  \\DC01\SYSVOL                    首次:2023-03-15  最后:2024-01-16  (异常访问时间)

--- 可移动设备访问 ---
  E:\ (USB驱动器)
    卷标名:    BACKUP_DRIVE
    首次访问:2024-01-15 15:30:00 UTC
    最后访问:2024-01-15 15:45:22 UTC
    浏览的文件夹数:3 (E:\, E:\Backup, E:\Backup\Corporate_Data)

--- 已删除/不存在的路径 ---
  C:\ProgramData\Updates\                (文件夹已删除,shellbag仍然存在)
  C:\ProgramData\svc\                    (文件夹已删除,shellbag仍然存在)
  C:\Windows\Temp\tools\                 (文件夹已删除,shellbag仍然存在)

摘要:
  访问的唯一文件夹总数:  1,690
  访问的网络共享:        4(事件期间新增2个)
  可移动介质:            1个USB设备(疑似数据暂存)
  已删除文件夹证据:       3个路径(反取证迹象)
  CSV导出至:                /analysis/shellbag_output/

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

相关技能