Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
chainsaw — 快速搜索并追查Windows取证痕迹 | Kitploit
工具/GitHubGitHub/withsecurelabs/chainsaw
防御工具取证分析数字取证入侵检测事件响应日志分析
GitHubwithsecurelabs/chainsaw

chainsaw

快速搜索并追查Windows取证痕迹

查看仓库
3.6k30116天前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

快速搜索与搜寻 Windows 取证工件


Chainsaw 提供强大的“第一响应”能力,能够快速识别 Windows 取证工件(如事件日志和 MFT 文件)中的威胁。Chainsaw 提供了一种通用且快速的方法来搜索事件日志中的关键字,并通过内置对 Sigma 检测规则的支持以及自定义 Chainsaw 检测规则来识别威胁。

功能特性

  • 🎯 使用 Sigma 检测规则和自定义 Chainsaw 检测规则搜寻威胁
  • 🔍 通过字符串匹配和正则表达式模式搜索和提取取证工件
  • 📅 通过分析 Shimcache 工件并用 Amcache 数据丰富来创建执行时间线
  • 💡 分析 SRUM 数据库并提供见解
  • ⬇️ 转储取证工件(MFT、注册表配置单元、ESE 数据库)的原始内容
  • ⚡ 闪电般快速,用 Rust 编写,封装了由 @OBenamram 提供的 EVTX 解析器库
  • 🪶 简洁轻量的执行和输出格式,没有多余的冗余
  • 🔥 由 TAU Engine 库提供的文档标记(检测逻辑匹配)
  • 📑 以多种格式输出结果,例如 ASCII 表格格式、CSV 格式和 JSON 格式
  • 💻 可在 MacOS、Linux 和 Windows 上运行

目录

  • 功能特性
  • 为什么选择 Chainsaw?
  • Windows 事件日志的搜寻逻辑
  • 快速入门指南
    • 下载与运行
    • 使用 Nix 安装/构建
    • EDR 和 AV 警告
    • Chainsaw v2 有什么变化
  • 示例
    • 搜索
    • 搜寻
    • 分析
      • Shimcache
      • SRUM(系统资源使用监视器)
      • Gaps(事件日志缺口检测)
    • 转储
  • 致谢

更多信息可在此工具的 Wiki 中找到:https://github.com/WithSecureLabs/chainsaw/wiki

为什么选择 Chainsaw?

在 WithSecure Countercept,我们通过 EDR 代理从端点摄取广泛的遥测数据源,以提供托管检测与响应服务。然而,在某些情况下,我们需要快速分析未被 EDR 捕获的取证工件,一个常见的例子是:在入侵发生时我们的 EDR 尚未安装的环境中,进行应急响应调查。Chainsaw 的创建正是为了在这些情况下,为我们的威胁猎人和应急响应顾问提供一种对取证工件进行快速分类的工具。

Windows 事件日志

Windows 事件日志为威胁搜寻和应急响应调查提供了丰富的取证信息来源。不幸的是,处理和搜索事件日志可能是一个缓慢且耗时的过程,在大多数情况下还需要周围基础设施的支持(例如 ELK 堆栈或 Splunk 实例)才能高效地搜索日志数据并应用检测逻辑。这种开销往往意味着蓝队无法快速对 Windows 事件日志进行分类,从而无法提供推进调查所需的方向和结论。Chainsaw 解决了这个问题,因为它允许快速搜索和搜寻 Windows 事件日志。

在撰写本文时,很少有开源、独立的工具提供简单快速的 Windows 事件日志分类方法,能够识别日志中的有趣元素,并应用检测逻辑规则格式(如 Sigma)来检测恶意活动的迹象。在我们的测试中,确实存在的那些工具难以高效地将检测逻辑应用于大量事件日志,使其不适用于需要快速分类的场景。

Windows 事件日志的搜寻逻辑

Sigma 规则匹配

使用 --sigma 和 --mapping 参数,您可以指定一个包含部分 SIGMA 检测规则(或整个 SIGMA git 仓库)的目录,Chainsaw 将自动加载、转换并针对提供的事件日志运行这些规则。映射文件告诉 Chainsaw 在事件日志中使用哪些字段进行规则匹配。默认情况下,Chainsaw 支持多种事件日志类型,包括但不限于:

有关用于规则检测的完整字段列表,请参阅映射文件,并可根据需要随意扩展。

Chainsaw 检测规则

除了支持 Sigma 规则外,Chainsaw 还支持自定义规则格式。在仓库中,您会找到一个 rules 目录,其中包含各种 Chainsaw 规则,允许用户:

  1. 提取和解析 Windows Defender、F-Secure、Sophos 和 Kaspersky AV 警报
  2. 检测关键事件日志被清除,或事件日志服务被停止
  3. 检测用户被创建或被添加到敏感用户组
  4. 远程登录(服务、RDP、网络等)事件。这有助于猎人识别横向移动的来源
  5. 对本地用户账户的暴力破解

快速入门指南

下载与运行

随着 Chainsaw v2 的发布,我们决定不再将 Sigma Rules 和 EVTX-Attack-Samples 仓库作为 Chainsaw 的子模块包含在内。我们建议您单独克隆这些仓库,以确保拥有最新版本。

如果您仍然需要包含 Chainsaw 二进制文件、Sigma 规则和示例事件日志的一体化包,可以从这个 GitHub 仓库的 releases 部分 下载。在该 releases 部分,您还会找到适用于各种平台和架构的仅包含预编译二进制文件的 Chainsaw 版本。

如果您想自己编译 Chainsaw,可以克隆 Chainsaw 仓库:

git clone https://github.com/WithSecureLabs/chainsaw.git

然后通过运行: cargo build --release 自行编译代码。构建完成后,您将在 target/release 文件夹中找到编译后的二进制文件副本。

请务必使用 --release 标志进行构建,因为这将确保显著更快的执行时间。

如果您想快速了解 Chainsaw 运行时的效果,可以克隆 Sigma Rules 和 EVTX-Attack-Samples 仓库:``` git clone https://github.com/SigmaHQ/sigma git clone https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES.git

root@kitploit:~
然后使用以下参数运行 Chainsaw:```
./chainsaw hunt EVTX-ATTACK-SAMPLES/ -s sigma/ --mapping mappings/sigma-event-logs-all.yml

使用 Nix 安装/构建```

├───devShells │ └───x86_64-linux │ └───default: development environment 'nix-shell' ├───formatter │ └───x86_64-linux: package 'alejandra-3.1.0' └───packages └───x86_64-linux ├───chainsaw: package 'chainsaw-2.10.1' └───default: package 'chainsaw-2.10.1'

root@kitploit:~
Chainsaw 作为一个软件包,可通过 [nixpkgs](https://search.nixos.org/packages?query=chainsaw) 获取。
如果你使用的是 NixOS,只需将 `chainsaw` 添加到你的系统配置文件中。

不过,如果你没有使用 NixOS,你仍然可以通过 Nix 安装 Chainsaw。推荐的方式是使用 `nix-shell`,它会临时修改你的 $PATH 环境变量。
为此,请运行以下命令:```
nix-shell -p chainsaw

您还可以利用该仓库是一个 flake 这一事实,运行以下命令:``` nix profile install github:WithSecureLabs/chainsaw

root@kitploit:~
然而,如果你想使用 Nix 自行构建 chainsaw,可以再次利用本仓库提供的 `flake.nix`。
要构建二进制文件,请在克隆仓库的根目录中运行以下命令:```
nix build .#

这将创建 ./result 目录,chainsaw 二进制文件位于 ./result/bin/chainsaw。

EDR 与 AV 警告

在下载并运行 chainsaw 时,你可能会发现本地的 EDR / 防病毒引擎将 Chainsaw 检测为恶意软件。你可以通过以下 GitHub issue 查看相关示例:Example1、Example2。

这些警告通常是由于示例事件日志和/或 Sigma 规则中包含对恶意字符串(例如 "mimikatz")的引用所致。我们还发现过 Chainsaw 二进制文件被一小部分防病毒引擎检测到的情况,这很可能是由于某种形式的启发式检测。

Chainsaw v2 有什么变化?

2022 年 7 月,我们发布了 Chainsaw 版本 2,这是对 Chainsaw 运行方式的重大改造。Chainsaw v2 包含多项重要改进,主要亮点如下:

  • 改进了 Sigma 规则的映射方法,使受支持的 Chainsaw 规则数量和事件日志事件类型数量显著增加。
  • 改进了 CLI 输出,可显示包含检测结果的事件日志的所有事件数据快照。
  • 支持以 JSON 和 XML 格式加载和解析事件日志。
  • 为 Hunt 和 Search 功能提供了更简洁、更简单的命令行参数。
  • 可选的附加输出信息,例如规则作者、规则状态、规则级别等。
  • 能够按状态、种类和严重级别过滤已加载的规则。
  • 内置的 Chainsaw 检测规则已被拆分到专门的 Chainsaw 规则文件中
  • 对 Chainsaw 的代码进行了彻底重写,以提高可读性并降低社区贡献的门槛。

如果你仍想使用 Chainsaw 版本 1,可以在发布部分找到编译好的二进制文件,也可以访问 v1.x.x 分支中的源代码。请注意,Chainsaw v1 已不再维护,所有用户都应考虑迁移到 Chainsaw v2。

万分感谢 @AlexKornitzer,他成功将 Chainsaw v1 的 "Christmas Project" 代码库在 v2 中打磨成了一件完善的产品。

示例

搜索

root@kitploit:~
  USAGE:
      chainsaw search [FLAGS] [OPTIONS] <pattern> [--] [path]...

  FLAGS:
      -h, --help            Prints help information
      -i, --ignore-case     Ignore the case when searching patterns
          --json            Print the output in json format
          --load-unknown    Allow chainsaw to try and load files it cannot identify
          --local           Output the timestamp using the local machine's timestamp
      -q                    Suppress informational output
          --skip-errors     Continue to search when an error is encountered
      -V, --version         Prints version information

  OPTIONS:
          --extension <extension>...    Only search through files with the provided extension
          --from <from>                 The timestamp to search from. Drops any documents older than the value provided
      -o, --output <output>             The path to output results to
      -e, --regex <pattern>...          A string or regular expression pattern to search for
      -t, --tau <tau>...                Tau expressions to search with. e.g. 'Event.System.EventID: =4104'
          --timestamp <timestamp>       The field that contains the timestamp
          --timezone <timezone>         Output the timestamp using the timezone provided
          --to <to>                     The timestamp to search up to. Drops any documents newer than the value provided

  ARGS:
      <pattern>    A string or regular expression pattern to search for. Not used when -e or -t is specified
      <path>...    The paths containing event logs to load and hunt through

命令示例

搜索所有 .evtx 文件中不区分大小写的字符串 "mimikatz"

root@kitploit:~
./chainsaw search mimikatz -i evtx_attack_samples/

*搜索所有 .evtx 文件中的 PowerShell 脚本块事件(事件 ID 4014)

root@kitploit:~
./chainsaw search -t 'Event.System.EventID: =4104' evtx_attack_samples/

搜索特定 evtx 日志中的登录事件,并使用匹配的正则表达式模式,以 JSON 格式输出

root@kitploit:~
./chainsaw search -e "DC[0-9].insecurebank.local" evtx_attack_samples --json

狩猎

root@kitploit:~
  USAGE:
      chainsaw hunt [FLAGS] [OPTIONS] [--] [path]...

  FLAGS:
          --csv             Print the output in csv format
          --full            Print the full values for the tabular output
      -h, --help            Prints help information
          --json            Print the output in json format
          --load-unknown    Allow chainsaw to try and load files it cannot identify
          --local           Output the timestamp using the local machine's timestamp
          --log             Print the output in log like format
          --metadata        Display additional metadata in the tablar output
      -q                    Suppress informational output
          --skip-errors     Continue to hunt when an error is encountered
      -V, --version         Prints version information

  OPTIONS:
          --column-width <column-width>    Set the column width for the tabular output
          --extension <extension>...       Only hunt through files with the provided extension
          --from <from>                    The timestamp to hunt from. Drops any documents older than the value provided
          --kind <kind>...                 Restrict loaded rules to specified kinds
          --level <level>...               Restrict loaded rules to specified levels
      -m, --mapping <mapping>...           A mapping file to tell Chainsaw how to use third-party rules
      -o, --output <output>                A path to output results to
      -r, --rule <rule>...                 A path containing additional rules to hunt with
      -s, --sigma <sigma>...               A path containing Sigma rules to hunt with
          --status <status>...             Restrict loaded rules to specified statuses
          --timezone <timezone>            Output the timestamp using the timezone provided
          --to <to>                        The timestamp to hunt up to. Drops any documents newer than the value provided

  ARGS:
      <rules>      The path to a collection of rules to use for hunting
      <path>...    The paths containing event logs to load and hunt through

命令示例

使用 Sigma 规则作为检测逻辑,对所有 evtx 文件进行狩猎

root@kitploit:~
./chainsaw hunt evtx_attack_samples/ -s sigma/ --mapping mappings/sigma-event-logs-all.yml

使用 Sigma 规则和 Chainsaw 规则作为检测逻辑,对所有 evtx 文件进行狩猎,并以 CSV 格式输出到 results 文件夹

root@kitploit:~
./chainsaw hunt evtx_attack_samples/ -s sigma/ --mapping mappings/sigma-event-logs-all.yml -r rules/ --csv --output results

使用 Sigma 规则作为检测逻辑,对所有 evtx 文件进行狩猎,仅搜索特定时间戳之间的内容,并以 JSON 格式输出结果

root@kitploit:~
 ./chainsaw hunt evtx_attack_samples/ -s sigma/ --mapping mappings/sigma-event-logs-all.yml --from "2019-03-17T19:09:39" --to "2019-03-17T19:09:50" --json

输出

root@kitploit:~
$ ./chainsaw hunt -r rules/ evtx_attack_samples -s sigma/rules --mapping mappings/sigma-event-logs-all.yml --level critical

     ██████╗██╗  ██╗ █████╗ ██╗███╗   ██╗███████╗ █████╗ ██╗    ██╗
    ██╔════╝██║  ██║██╔══██╗██║████╗  ██║██╔════╝██╔══██╗██║    ██║
    ██║     ███████║███████║██║██╔██╗ ██║███████╗███████║██║ █╗ ██║
    ██║     ██╔══██║██╔══██║██║██║╚██╗██║╚════██║██╔══██║██║███╗██║
    ╚██████╗██║  ██║██║  ██║██║██║ ╚████║███████║██║  ██║╚███╔███╔╝
     ╚═════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝ ╚══╝╚══╝
        By WithSecure Countercept (@FranticTyping, @AlexKornitzer)

    [+] Loading detection rules from: ../../rules/, /tmp/sigma/rules
    [+] Loaded 129 detection rules (198 not loaded)
    [+] Loading event logs from: ../../evtx_attack_samples (extensions: .evtx)
    [+] Loaded 268 EVTX files (37.5 MB)
    [+] Hunting: [========================================] 268/268

    [+] Group: Antivirus
    ┌─────────────────────┬────────────────────┬──────────┬───────────┬─────────────┬────────────────────────────────┬──────────────────────────────────┬────────────────────┐
    │      timestamp      │     detections     │ Event ID │ Record ID │  Computer   │          Threat Name           │           Threat Path            │        User        │
    ├─────────────────────┼────────────────────┼──────────┼───────────┼─────────────┼────────────────────────────────┼──────────────────────────────────┼────────────────────┤
    │ 2019-07-18 20:40:00 │ ‣ Windows Defender │ 1116     │ 37        │ MSEDGEWIN10 │ Trojan:PowerShell/Powersploit. │ file:_C:\AtomicRedTeam\atomic-   │ MSEDGEWIN10\IEUser │
    │                     │                    │          │           │             │ M                              │ red-team-master\atomics\T1056\   │                    │
    │                     │                    │          │           │             │                                │ Get-Keystrokes.ps1               │                    │
    ├─────────────────────┼────────────────────┼──────────┼───────────┼─────────────┼────────────────────────────────┼──────────────────────────────────┼────────────────────┤
    │ 2019-07-18 20:53:31 │ ‣ Windows Defender │ 1117     │ 106       │ MSEDGEWIN10 │ Trojan:XML/Exeselrun.gen!A     │ file:_C:\AtomicRedTeam\atomic-   │ MSEDGEWIN10\IEUser │
    │                     │                    │          │           │             │                                │ red-team-master\atomics\T1086\   │                    │
    │                     │                    │          │           │             │                                │ payloads\test.xsl                │                    │
    └─────────────────────┴────────────────────┴──────────┴───────────┴─────────────┴────────────────────────────────┴──────────────────────────────────┴────────────────────┘

    [+] Group: Log Tampering
    ┌─────────────────────┬───────────────────────────────┬──────────┬───────────┬────────────────────────────────┬───────────────┐
    │      timestamp      │          detections           │ Event ID │ Record ID │            Computer            │     User      │
    ├─────────────────────┼───────────────────────────────┼──────────┼───────────┼────────────────────────────────┼───────────────┤
    │ 2019-01-20 07:00:50 │ ‣ Security Audit Logs Cleared │ 1102     │ 32853     │ WIN-77LTAPHIQ1R.example.corp   │ Administrator │
    └─────────────────────┴───────────────────────────────┴──────────┴───────────┴────────────────────────────────┴───────────────┘[+] Group: Sigma
    ┌─────────────────────┬────────────────────────────────┬───────┬────────────────────────────────┬──────────┬───────────┬──────────────────────────┬──────────────────────────────────┐
    │      timestamp      │           detections           │ count │     Event.System.Provider      │ Event ID │ Record ID │         Computer         │            Event Data            │
    ├─────────────────────┼────────────────────────────────┼───────┼────────────────────────────────┼──────────┼───────────┼──────────────────────────┼──────────────────────────────────┤
    │ 2019-04-29 20:59:14 │ ‣ Malicious Named Pipe         │ 1     │ Microsoft-Windows-Sysmon       │ 18       │ 8046      │ IEWIN7                   │ ---                              │
    │                     │                                │       │                                │          │           │                          │ Image: System                    │
    │                     │                                │       │                                │          │           │                          │ PipeName: "\\46a676ab7f179e511   │
    │                     │                                │       │                                │          │           │                          │ e30dd2dc41bd388"                 │
    │                     │                                │       │                                │          │           │                          │ ProcessGuid: 365ABB72-D9C4-5CC   │
    │                     │                                │       │                                │          │           │                          │ 7-0000-0010EA030000              │
    │                     │                                │       │                                │          │           │                          │ ProcessId: 4                     │
    │                     │                                │       │                                │          │           │                          │ RuleName: ""                     │
    │                     │                                │       │                                │          │           │                          │ UtcTime: "2019-04-29 20:59:14.   │
    │                     │                                │       │                                │          │           │                          │ 430"                             │
    ├─────────────────────┼────────────────────────────────┼───────┼────────────────────────────────┼──────────┼───────────┼──────────────────────────┼──────────────────────────────────┤
    │ 2019-04-30 20:26:51 │ ‣ CobaltStrike Service         │ 1     │ Microsoft-Windows-Sysmon       │ 13       │ 9806      │ IEWIN7                   │ ---                              │
    │                     │ Installations in Registry      │       │                                │          │           │                          │ Details: "%%COMSPEC%% /b /c st   │
    │                     │                                │       │                                │          │           │                          │ art /b /min powershell.exe -no   │
    │                     │                                │       │                                │          │           │                          │ p -w hidden -noni -c \"if([Int   │
    │                     │                                │       │                                │          │           │                          │ Ptr]::Size -eq 4){$b='powershe   │
    │                     │                                │       │                                │          │           │                          │ ll.exe'}else{$b=$env:windir+'\   │
    │                     │                                │       │                                │          │           │                          │ \syswow64\\WindowsPowerShell\\   │
    │                     │                                │       │                                │          │           │                          │ v1.0\\powershell.exe'};$s=New-   │
    │                     │                                │       │                                │          │           │                          │ Object System.Diagnostics.Proc   │
    │                     │                                │       │                                │          │           │                          │ essStartInfo;$s.FileName=$b;$s   │
    │                     │                                │       │                                │          │           │                          │ .Arguments='-noni -nop -w hidd   │
    │                     │                                │       │                                │          │           │                          │ en -c &([scriptblock]::create(   │
    │                     │                                │       │                                │          │           │                          │ (New-Object IO.StreamReader(Ne   │
    │                     │                                │       │                                │          │           │                          │ w-Object IO.Compression.GzipSt   │
    │                     │                                │       │                                │          │           │                          │ ream((New-Object IO.MemoryStre   │
    │                     │                                │       │                                │          │           │                          │ am(,[Convert]::FromBase64Strin   │
    │                     │                                │       │                                │          │           │                          │ g(''H4sIAIuvyFwCA7VW+2/aSBD+OZ   │
    │                     │                                │       │                                │          │           │                          │ H6P1...                          │
    │                     │                                │       │                                │          │           │                          │ (use --full to show all content) │
    │                     │                                │       │                                │          │           │                          │ EventType: SetValue              │
    │                     │                                │       │                                │          │           │                          │ Image: "C:\\Windows\\system32\   │
    │                     │                                │       │                                │          │           │                          │ \services.exe"                   │
    │                     │                                │       │                                │          │           │                          │ ProcessGuid: 365ABB72-2586-5CC   │
    │                     │                                │       │                                │          │           │                          │ 9-0000-0010DC530000              │
    │                     │                                │       │                                │          │           │                          │ ProcessId: 460                   │
    │                     │                                │       │                                │          │           │                          │ RuleName: ""                     │
    │                     │                                │       │                                │          │           │                          │ TargetObject: "HKLM\\System\\C   │
    │                     │                                │       │                                │          │           │                          │ urrentControlSet\\services\\he   │
    │                     │                                │       │                                │          │           │                          │ llo\\ImagePath"                  │
    │                     │                                │       │                                │          │           │                          │ UtcTime: "2019-04-30 20:26:51.   │
    │                     │                                │       │                                │          │           │                          │ 934"                             │
    ├─────────────────────┼────────────────────────────────┼───────┼────────────────────────────────┼──────────┼───────────┼──────────────────────────┼──────────────────────────────────┤
    │ 2019-05-12 12:52:43 │ ‣ Meterpreter or Cobalt        │ 1     │ Service Control Manager        │ 7045     │ 10446     │ IEWIN7                   │ ---                              │
    │                     │ Strike Getsystem Service       │       │                                │          │           │                          │ AccountName: LocalSystem         │
    │                     │ Installation                   │       │                                │          │           │                          │ ImagePath: "%COMSPEC% /c ping    │
    │                     │                                │       │                                │          │           │                          │ -n 1 127.0.0.1 >nul && echo 'W   │
    │                     │                                │       │                                │          │           │                          │ inPwnage' > \\\\.\\pipe\\WinPw   │
    │                     │                                │       │                                │          │           │                          │ nagePipe"                        │
    │                     │                                │       │                                │          │           │                          │ ServiceName: WinPwnage           │
    │                     │                                │       │                                │          │           │                          │ ServiceType: user mode service   │
    │                     │                                │       │                                │          │           │                          │ StartType: demand start          │
    ├─────────────────────┼────────────────────────────────┼───────┼────────────────────────────────┼──────────┼───────────┼──────────────────────────┼──────────────────────────────────┤
    │ 2019-06-21 07:35:37 │ ‣ Dumpert Process Dumper       │ 1     │ Microsoft-Windows-Sysmon       │ 11       │ 238375    │ alice.insecurebank.local │ ---                              │
    │                     │                                │       │                                │          │           │                          │ CreationUtcTime: "2019-06-21 0   │
    │                     │                                │       │                                │          │           │                          │ 6:53:03.227"                     │
    │                     │                                │       │                                │          │           │                          │ Image: "C:\\Users\\administrat   │
    │                     │                                │       │                                │          │           │                          │ or\\Desktop\\x64\\Outflank-Dum   │
    │                     │                                │       │                                │          │           │                          │ pert.exe"                        │
    │                     │                                │       │                                │          │           │                          │ ProcessGuid: ECAD0485-88C9-5D0   │
    │                     │                                │       │                                │          │           │                          │ C-0000-0010348C1D00              │
    │                     │                                │       │                                │          │           │                          │ ProcessId: 3572                  │
    │                     │                                │       │                                │          │           │                          │ RuleName: ""                     │
    │                     │                                │       │                                │          │           │                          │ TargetFilename: "C:\\Windows\\   │
    │                     │                                │       │                                │          │           │                          │ Temp\\dumpert.dmp"               │
    │                     │                                │       │                                │          │           │                          │ UtcTime: "2019-06-21 07:35:37.   │
    │                     │                                │       │                                │          │           │                          │ 324"                             │
    └─────────────────────┴────────────────────────────────┴───────┴────────────────────────────────┴──────────┴───────────┴──────────────────────────┴──────────────────────────────────┘

分析

Shimcache

root@kitploit:~
COMMAND:
    analyse shimcache                 Create an execution timeline from the shimcache with optional amcache enrichments

USAGE:
    chainsaw analyse shimcache [OPTIONS] <SHIMCACHE>

ARGUMENTS:
    <SHIMCACHE>                       The path to the shimcache artefact (SYSTEM registry file)

OPTIONS:
    -e, --regex <pattern>             A string or regular expression for detecting shimcache entries whose timestamp matches their insertion time
    -r, --regexfile <REGEX_FILE>      The path to a newline delimited file containing regex patterns for detecting shimcache entries whose timestamp matches their insertion time
    -o, --output <OUTPUT>             The path to output the result csv file
    -a, --amcache <AMCACHE>           The path to the amcache artefact (Amcache.hve) for timeline enrichment
    -p, --tspair                      Enable near timestamp pair detection between shimcache and amcache for finding additional insertion timestamps for shimcache entries
    -h, --help                        Print help
  • --regexfile 参数的示例模式文件位于 analysis/shimcache_patterns.txt 中。
  • 正则模式会与 shimcache 条目中的路径进行匹配,这些路径已转换为小写。
命令示例

使用提供的正则模式分析 shimcache 工件,并在启用时间戳近邻配对检测的情况下使用 amcache 丰富化。输出到 csv 文件。

root@kitploit:~
./chainsaw analyse shimcache ./SYSTEM --regexfile ./analysis/shimcache_patterns.txt --amcache ./Amcache.hve --tspair --output ./output.csv

使用提供的正则模式分析 shimcache 工件(不进行 amcache 丰富化)。输出到终端。

root@kitploit:~
./chainsaw analyse shimcache ./SYSTEM --regexfile ./analysis/shimcache_patterns.txt

Gaps(事件日志间隙检测)

检测一个或多个 .evtx 文件中选择性事件日志篡改的两类指标:

  • RecordID 间隙:每个通道的 EventRecordID 值通常单调递增且无空洞。单个 evtx 文件内部出现空洞(即非日志轮转边界)属于异常,这是那些在不触发明显的“日志已清除”事件(EID 1102)的情况下精确删除单条记录的工具(例如 Eventlogedit 风格技术)留下的指纹。

  • 时间间隙:在通常频繁产生事件的通道上,连续事件之间出现异常长的静默窗口,可能表明该窗口内的记录已被删除。阈值可配置;各主机的基线由分析人员自行确定。

    COMMAND: analyse gaps Detect chronological or RecordID gaps in evtx files (possible selective record deletion)

    USAGE: chainsaw analyse gaps [OPTIONS] [PATH]...

    ARGUMENTS: [PATH]... The path(s) to evtx files or directories containing them

    OPTIONS: --min-time-gap-minutes Minimum time gap (in minutes) between consecutive events to flag as suspicious [default: 30] --no-record-id-gaps Skip RecordID gap detection (only flag time gaps) --no-time-gaps Skip time gap detection (only flag RecordID gaps) -j, --json Print the output in json format -o, --output Save the output to a file -q Suppress informational output --skip-errors Continue when an error is encountered -h, --help Print help

命令示例

使用默认的 30 分钟阈值扫描包含 evtx 文件的目录,以查找 RecordID 间隙和时间间隙:

root@kitploit:~
./chainsaw analyse gaps ./Logs/

仅查找被选择性删除的记录(RecordID 空洞),并输出机器可读的 JSON:

root@kitploit:~
./chainsaw analyse gaps ./Logs/ --no-time-gaps --json -o ./gaps.json

SRUM(系统资源使用监视器)

Chainsaw 中实现的 SRUM 数据库解析器与其他解析器不同,因为它不依赖关于表的硬编码值。信息直接从 SOFTWARE 配置单元中提取,该配置单元是必填参数。目标是避免与未知表相关的错误。

root@kitploit:~
COMMAND:
    analyse srum                             Analyse the SRUM database

USAGE:
    chainsaw analyse srum [OPTIONS] --software <SOFTWARE_HIVE_PATH> <SRUM_PATH>

ARGUMENTS:
    <SRUM_PATH>                              The path to the SRUM database

OPTIONS:
    -s, --software <SOFTWARE_HIVE_PATH>      The path to the SOFTWARE hive
        --stats-only                         Only output details about the SRUM database
    -q                                       Suppress informational output
    -o, --output <OUTPUT>                    Save the output to a file
    -h, --help                               Print help
命令示例

分析 SRUM 数据库(SOFTWARE 配置单元为必填项)

root@kitploit:~
./chainsaw analyse srum --software ./SOFTWARE ./SRUDB.dat --output ./output.json
输出
root@kitploit:~
$ ./chainsaw analyse srum --software ./SOFTWARE ./SRUDB.dat -o ./output.json

     ██████╗██╗  ██╗ █████╗ ██╗███╗   ██╗███████╗ █████╗ ██╗    ██╗
    ██╔════╝██║  ██║██╔══██╗██║████╗  ██║██╔════╝██╔══██╗██║    ██║
    ██║     ███████║███████║██║██╔██╗ ██║███████╗███████║██║ █╗ ██║
    ██║     ██╔══██║██╔══██║██║██║╚██╗██║╚════██║██╔══██║██║███╗██║
    ╚██████╗██║  ██║██║  ██║██║██║ ╚████║███████║██║  ██║╚███╔███╔╝
     ╚═════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝ ╚══╝╚══╝
        By WithSecure Countercept (@FranticTyping, @AlexKornitzer)[+] ESE database file loaded from "/home/user/Documents/SRUDB.dat"
    [+] Parsing the ESE database...
    [+] SOFTWARE hive loaded from "/home/user/Documents/SOFTWARE"
    [+] Parsing the SOFTWARE registry hive...
    [+] Analysing the SRUM database...
    [+] Details about the tables related to the SRUM extensions:
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | Table GUID                               | Table Name                                 | DLL Path                             | Timeframe of the data   | Expected Retention Time |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {5C8CF1C7-7257-4F13-B223-970EF5939312}   | App Timeline Provider                      | %SystemRoot%\System32\eeprov.dll     | 2022-03-10 16:34:59 UTC | 7 days                  |
    |                                          |                                            |                                      | 2022-03-10 21:10:00 UTC |                         |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {B6D82AF1-F780-4E17-8077-6CB9AD8A6FC4}   | Tagged Energy Provider                     | %SystemRoot%\System32\eeprov.dll     | No records              | 3 days                  |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {D10CA2FE-6FCF-4F6D-848E-B2E99266FA86}   | WPN SRUM Provider                          | %SystemRoot%\System32\wpnsruprov.dll | 2022-03-10 20:09:00 UTC | 60 days                 |
    |                                          |                                            |                                      | 2022-03-10 21:09:00 UTC |                         |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {D10CA2FE-6FCF-4F6D-848E-B2E99266FA89}   | Application Resource Usage Provider        | %SystemRoot%\System32\appsruprov.dll | 2022-03-10 16:34:59 UTC | 60 days                 |
    |                                          |                                            |                                      | 2022-03-10 21:10:00 UTC |                         |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {FEE4E14F-02A9-4550-B5CE-5FA2DA202E37}   | Energy Usage Provider                      | %SystemRoot%\System32\energyprov.dll | No records              | 60 days                 |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {FEE4E14F-02A9-4550-B5CE-5FA2DA202E37}LT | Energy Usage Provider (Long Term)          | %SystemRoot%\System32\energyprov.dll | No records              | 1820 days               |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {973F5D5C-1D90-4944-BE8E-24B94231A174}   | Windows Network Data Usage Monitor         | %SystemRoot%\System32\nduprov.dll    | 2022-03-10 16:34:59 UTC | 60 days                 |
    |                                          |                                            |                                      | 2022-03-10 21:10:00 UTC |                         |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {7ACBBAA3-D029-4BE4-9A7A-0885927F1D8F}   | vfuprov                                    | %SystemRoot%\System32\vfuprov.dll    | 2022-03-10 20:09:00 UTC | 60 days                 |
    |                                          |                                            |                                      | 2022-03-10 21:10:00 UTC |                         |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {DA73FB89-2BEA-4DDC-86B8-6E048C6DA477}   | Energy Estimation Provider                 | %SystemRoot%\System32\eeprov.dll     | No records              | 7 days                  |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    | {DD6636C4-8929-4683-974E-22C046A43763}   | Windows Network Connectivity Usage Monitor | %SystemRoot%\System32\ncuprov.dll    | 2022-03-10 16:34:59 UTC | 60 days                 |
    |                                          |                                            |                                      | 2022-03-10 21:10:00 UTC |                         |
    +------------------------------------------+--------------------------------------------+--------------------------------------+-------------------------+-------------------------+
    [+] SRUM database parsed successfully
    [+] Saving output to "/home/user/Documents/output.json"
    [+] Saved output to "/home/user/Documents/output.json"
取证洞察

关于此痕迹的新取证洞察信息,可在 wiki 中查看:https://github.com/WithSecureLabs/chainsaw/wiki/SRUM-Analysis。

转储

root@kitploit:~
USAGE:
    chainsaw dump [OPTIONS] <PATH>

ARGUMENTS:
    <PATH>                  The path to an artefact to dump

OPTIONS:
    -j, --json              Dump in json format
        --jsonl             Print the output in jsonl format
        --load-unknown      Allow chainsaw to try and load files it cannot identify
    -o, --output <OUTPUT>   A path to output results to
    -q                      Suppress informational output
        --skip-errors       Continue to hunt when an error is encountered
    -h, --help              Print help

命令示例

转储 SOFTWARE 配置单元

root@kitploit:~
./chainsaw dump ./SOFTWARE.hve --json --output ./output.json

致谢

  • EVTX-ATTACK-SAMPLES,作者 @SBousseaden
  • Sigma 检测规则
  • EVTX parser 库,作者 @OBenamram
  • TAU Engine 库,作者 @AlexKornitzer
  • Shimcache 分析功能是 CC-Driver 项目的一部分,该项目由欧盟地平线 2020 研究与创新计划依据拨款协议编号 883543 资助
  • DFIRArtifactMuseum,作者 Andrew Rathbun(@bunsofwrath12)
下载工具
事件类型事件 ID
进程创建(Sysmon)1
网络连接(Sysmon)3
镜像加载(Sysmon)7
文件创建(Sysmon)11
注册表事件(Sysmon)13
PowerShell 脚本块4104
进程创建4688
计划任务创建4698
服务创建7045