WithSecureLabs/chainsaw

GitHub: WithSecureLabs/chainsaw

基于Rust的高性能Windows取证分析工具,支持Sigma规则检测和多类artifacts快速搜索与威胁猎杀。

Stars: 3460 | Forks: 297

Rapidly Search and Hunt through Windows Forensic Artefacts

Chainsaw 提供强大的“即时响应”能力,可快速识别 Windows 取证 artifacts(如 Event Logs 和 MFT 文件)中的威胁。Chainsaw 提供了一种通用且快速的方法,可通过关键字搜索事件日志,并通过内置的 Sigma 检测规则支持以及自定义 Chainsaw 检测规则来识别威胁。 ## 功能特性 - :dart: 使用 [Sigma](https://github.com/SigmaHQ/sigma) 检测规则和自定义 Chainsaw 检测规则 hunting 威胁 - :mag: 通过字符串匹配和正则表达式模式搜索并提取取证 artifacts - :date: 通过分析 Shimcache artifacts 并利用 Amcache 数据进行丰富化,创建执行时间线 - :bulb: 分析 SRUM 数据库并提供相关洞察 - :arrow_down: 转储取证 artifacts(MFT、注册表配置单元、ESE 数据库)的原始内容 - :zap: 极速高效,使用 Rust 编写,封装了 [@OBenamram](https://twitter.com/obenamram?lang=en) 的 [EVTX parser](https://github.com/omerbenamram/evtx) 库 - :feather: 简洁轻量的执行和输出格式,无多余臃肿 - :fire: 由 [TAU Engine](https://github.com/WithSecureLabs/tau-engine) 库提供的文档标记(检测逻辑匹配) - :bookmark_tabs: 支持多种格式输出结果,如 ASCII 表格格式、CSV 格式和 JSON 格式 - :computer: 可在 MacOS、Linux 和 Windows 上运行 ## 目录 - [功能特性](#features) - [为什么选择 Chainsaw?](#why-chainsaw) - [Windows 事件日志的 Hunting 逻辑](#hunting-logic-for-windows-event-logs) - [快速入门指南](#quick-start-guide) - [下载与运行](#downloading-and-running) - [使用 Nix 安装/构建](#installbuild-with-nix) - [EDR 和 AV 警告](#edr-and-av-warnings) - [Chainsaw v2 有哪些变化](#what-changed-in-chainsaw-v2) - [示例](#examples) - [搜索](#searching) - [Hunting](#hunting) - [分析](#analysis) - [Shimcache](#shimcache) - [SRUM (系统资源使用监控)](#srum-system-resource-usage-monitor) - [转储](#srum) - [致谢](#acknowledgements) 更多扩展信息可在该工具的 Wiki 中找到:https://github.com/WithSecureLabs/chainsaw/wiki ## 为什么选择 Chainsaw? 在 WithSecure Countercept,我们通过 EDR 代理从端点摄取广泛的遥测源,以提供托管检测和响应服务。然而,在某些情况下,我们需要快速分析未被 EDR 捕获的取证 artifacts,一个常见的例子是在受损时未安装 EDR 的环境进行事件响应调查。Chainsaw 的创建是为了在这种情况下为我们的威胁猎手和事件响应顾问提供一种工具,以对取证 artifacts 进行快速分类。 ### Windows 事件日志 Windows 事件日志为威胁 hunting 和事件响应调查提供了丰富的取证信息来源。不幸的是,处理和搜索事件日志可能是一个缓慢且耗时的过程,并且在大多数情况下需要依赖周围的基础设施开销——例如 ELK stack 或 Splunk 实例——以便有效地搜索日志数据并应用检测逻辑。这种开销通常意味着蓝队无法快速分类 Windows 事件日志,从而无法提供推进调查所需的方向和结论。Chainsaw 解决了这个问题,因为它允许快速搜索和 hunting Windows 事件日志。 在撰写本文时,很少有开源、独立的工具能提供简单快速的方法来分类 Windows 事件日志、识别日志中的有趣元素并应用检测逻辑规则格式(如 Sigma)。在我们的测试中,现有的工具难以有效地将检测逻辑应用于大量事件日志,使其不适用于需要快速分类的场景。 ## Windows 事件日志的 Hunting 逻辑 ### Sigma 规则匹配 使用 `--sigma` 和 `--mapping` 参数,你可以指定一个包含 SIGMA 检测规则子集的目录(或整个 SIGMA git repo),chainsaw 将自动加载、转换并针对提供的事件日志运行这些规则。映射文件告诉 chainsaw 使用事件日志中的哪些字段进行规则匹配。默认情况下,Chainsaw 支持广泛的 Event Log 类型,包括但不限于: |Event Type|Event ID | |--|--| |Process Creation (Sysmon)| 1 | |Network Connections (Sysmon)|3| |Image Loads (Sysmon)|7| |File Creation (Sysmon)|11| |Registry Events (Sysmon)|13| |Powershell Script Blocks|4104| |Process Creation|4688| |Scheduled Task Creation|4698| |Service Creation|7045| 有关用于规则检测的完整字段列表,请参阅映射文件,并可根据需要随意扩展。 ### 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 规则和示例 Event logs 的多合一包,可以从该 GitHub 仓库的 [releases section](https://github.com/WithSecureLabs/chainsaw/releases) 下载。在这个 releases section 中,你还可以找到适用于各种平台和架构的 Chainsaw 预编译二进制文件版本。 如果你想自己编译 Chainsaw,可以克隆 Chainsaw 仓库: `git clone https://github.com/WithSecureLabs/chainsaw.git` 并通过运行以下命令自行编译代码:`cargo build --release`。构建完成后,你将在 target/release 文件夹中找到编译后的二进制文件副本。 **请务必使用 `--release` 标志进行构建,因为这能确保显著更快的执行速度。** 如果你想快速查看 Chainsaw 运行时的样子,可以克隆 [Sigma Rules](https://github.com/SigmaHQ/sigma) 和 [EVTX-Attack-Samples](https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES) 仓库: ``` git clone https://github.com/SigmaHQ/sigma git clone https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES.git ``` 然后使用以下参数运行 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' ``` 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 ``` 但是,如果你想使用 Nix 自己构建 chainsaw,你可以再次使用本仓库提供的 `flake.nix`。 要构建二进制文件,请在克隆仓库的根目录下运行以下命令: ``` nix build .# ``` 这将创建 `./result` 目录,chainsaw 二进制文件位于 `./result/bin/chainsaw`。 ### EDR 和 AV 警告 在下载和运行 chainsaw 时,你可能会发现你的本地 EDR / AntiVirus 引擎将 Chainsaw 检测为恶意软件。你可以在以下 GitHub issues 中看到此类示例:[Example1](https://github.com/WithSecureLabs/chainsaw/issues/12),[Example2](https://github.com/WithSecureLabs/chainsaw/issues/47)。 这些警告通常是由于示例事件日志和/或 Sigma 规则包含对恶意字符串(例如 "mimikatz")的引用。我们也曾看到 Chainsaw 二进制文件被少数 Anti-Virus 引擎检测到的情况,这可能是由于某种形式的启发式检测。 ### Chainsaw v2 有哪些变化? 2022 年 7 月,我们发布了 Chainsaw 的第 2 版,这是对 Chainsaw 运作方式的重大改革。Chainsaw v2 包含几项重大改进,包括以下亮点: - 改进的 Sigma 规则映射方法,显著增加了支持的 Chainsaw 规则和 Event Log 事件类型的数量。 - 改进的 CLI 输出,显示包含检测结果的事件日志的所有 Event Data 的快照。 - 支持加载和解析 JSON 和 XML 格式的 Event Logs。 - 更简洁、更简单的 Hunt 和 Search 功能命令行参数。 - 额外的可选输出信息,如 Rule Author、Rule Status、Rule Level 等。 - 能够按状态、种类和严重级别过滤加载的规则。 - 内置 Chainsaw 检测规则已被拆分为专用的 Chainsaw 规则文件 - Chainsaw 代码的清理和重写,以提高可读性并减少社区贡献的门槛。 如果你仍希望使用 Chainsaw 的版本 1,可以在 [releases section](https://github.com/WithSecureLabs/chainsaw/releases) 中找到编译好的二进制文件,或者可以在 [v1.x.x branch](https://github.com/WithSecureLabs/chainsaw/tree/v1.x.x) 中访问源代码。请注意,Chainsaw v1 不再维护,所有用户都应考虑迁移到 Chainsaw v2。 非常感谢 [@AlexKornitzer](https://twitter.com/AlexKornitzer?lang=en),他成功地将 Chainsaw v1 的“圣诞项目”代码库转变为 v2 中完善的产品。 ## 示例 ### 搜索 ``` USAGE: chainsaw search [FLAGS] [OPTIONS] [--] [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 ... Only search through files with the provided extension --from The timestamp to search from. Drops any documents older than the value provided -o, --output The path to output results to -e, --regex ... A string or regular expression pattern to search for -t, --tau ... Tau expressions to search with. e.g. 'Event.System.EventID: =4104' --timestamp The field that contains the timestamp --timezone Output the timestamp using the timezone provided --to The timestamp to search up to. Drops any documents newer than the value provided ARGS: A string or regular expression pattern to search for. Not used when -e or -t is specified ... The paths containing event logs to load and hunt through ``` #### 命令示例 *在所有 .evtx 文件中搜索不区分大小写的字符串 "mimikatz"* ``` ./chainsaw search mimikatz -i evtx_attack_samples/ ``` *在所有 .evtx 文件中搜索 powershell script block 事件 (Event ID 4014)* ``` ./chainsaw search -t 'Event.System.EventID: =4104' evtx_attack_samples/ ``` *在特定的 evtx 日志中搜索登录事件,使用匹配的正则表达式模式,并以 JSON 格式输出* ``` ./chainsaw search -e "DC[0-9].insecurebank.local" evtx_attack_samples --json ``` ### Hunting ``` 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 Set the column width for the tabular output --extension ... Only hunt through files with the provided extension --from The timestamp to hunt from. Drops any documents older than the value provided --kind ... Restrict loaded rules to specified kinds --level ... Restrict loaded rules to specified levels -m, --mapping ... A mapping file to tell Chainsaw how to use third-party rules -o, --output A path to output results to -r, --rule ... A path containing additional rules to hunt with -s, --sigma ... A path containing Sigma rules to hunt with --status ... Restrict loaded rules to specified statuses --timezone Output the timestamp using the timezone provided --to The timestamp to hunt up to. Drops any documents newer than the value provided ARGS: The path to a collection of rules to use for hunting ... The paths containing event logs to load and hunt through ``` #### 命令示例 *使用 Sigma 规则作为检测逻辑,hunt 所有 evtx 文件* ``` ./chainsaw hunt evtx_attack_samples/ -s sigma/ --mapping mappings/sigma-event-logs-all.yml ``` *使用 Sigma 规则和 Chainsaw 规则作为检测逻辑 hunt 所有 evtx 文件,并将结果以 CSV 格式输出到 results 文件夹* ``` ./chainsaw hunt evtx_attack_samples/ -s sigma/ --mapping mappings/sigma-event-logs-all.yml -r rules/ --csv --output results ``` *使用 Sigma 规则作为检测逻辑 hunt 所有 evtx 文件,仅搜索特定时间戳之间的内容,并以 JSON 格式输出结果* ``` ./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 ``` #### 输出 ``` $ ./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 ``` COMMAND: analyse shimcache Create an execution timeline from the shimcache with optional amcache enrichments USAGE: chainsaw analyse shimcache [OPTIONS] ARGUMENTS: The path to the shimcache artefact (SYSTEM registry file) OPTIONS: -e, --regex A string or regular expression for detecting shimcache entries whose timestamp matches their insertion time -r, --regexfile The path to a newline delimited file containing regex patterns for detecting shimcache entries whose timestamp matches their insertion time -o, --output The path to output the result csv file -a, --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](analysis/shimcache_patterns.txt) 中。 - 正则表达式模式匹配的对象是 shimcache 条目中**转换为小写**的路径。 ##### 命令示例 *使用提供的正则表达式模式分析 shimcache artifact,并启用带有时间戳近对检测的 amcache 丰富化。输出到 csv 文件。* ``` ./chainsaw analyse shimcache ./SYSTEM --regexfile ./analysis/shimcache_patterns.txt --amcache ./Amcache.hve --tspair --output ./output.csv ``` *使用提供的正则表达式模式分析 shimcache artifact(不使用 amcache 丰富化)。输出到终端。* ``` ./chainsaw analyse shimcache ./SYSTEM --regexfile ./analysis/shimcache_patterns.txt ``` #### SRUM (系统资源使用监控) Chainsaw 中实现的 SRUM 数据库解析器与其他解析器不同,因为它不依赖于关于表的硬编码值。信息直接从 SOFTWARE 配置单元中提取,这是一个强制参数。目标是避免与未知表相关的错误。 ``` COMMAND: analyse srum Analyse the SRUM database USAGE: chainsaw analyse srum [OPTIONS] --software ARGUMENTS: The path to the SRUM database OPTIONS: -s, --software The path to the SOFTWARE hive --stats-only Only output details about the SRUM database -q Suppress informational output -o, --output Save the output to a file -h, --help Print help ``` ##### 命令示例 *分析 SRUM 数据库(SOFTWARE 配置单元是必需的)* ``` ./chainsaw analyse srum --software ./SOFTWARE ./SRUDB.dat --output ./output.json ``` ##### 输出 ``` $ ./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" ``` ##### 取证洞察 有关与此 artifact 相关的新取证洞察的信息可以在 wiki 中找到:https://github.com/WithSecureLabs/chainsaw/wiki/SRUM-Analysis。 ### 转储 ``` USAGE: chainsaw dump [OPTIONS] ARGUMENTS: 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 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 配置单元* ``` ./chainsaw dump ./SOFTWARE.hve --json --output ./output.json ``` ## 致谢 - [@SBousseaden](https://twitter.com/SBousseaden) 的 [EVTX-ATTACK-SAMPLES](https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES) - [Sigma](https://github.com/SigmaHQ/sigma) 检测规则 - [@OBenamram](https://twitter.com/obenamram?lang=en) 的 [EVTX parser](https://github.com/omerbenamram/evtx) 库 - [@AlexKornitzer](https://twitter.com/AlexKornitzer?lang=en) 的 [TAU Engine](https://github.com/WithSecureLabs/tau-engine) 库 - Shimcache 分析功能作为 [CC-Driver](https://www.ccdriver-h2020.com/) 项目的一部分开发,由欧盟 Horizon 2020 研究与创新计划资助(资助协议号 No. 883543) - Andrew Rathbun ([@bunsofwrath12](https://twitter.com/bunsofwrath12)) 的 [DFIRArtifactMuseum](https://github.com/AndrewRathbun/DFIRArtifactMuseum)
标签:Amcache, API安全, EDR, HTTPS请求, JSON输出, MFT文件分析, Rust, Shimcache, Sigma规则, SRUM数据库, Windows取证, 事件日志分析, 可视化界面, 子域名变形, 库, 应急响应, 数字取证, 正则表达式搜索, 目标导入, 端点检测, 网络流量审计, 脆弱性评估, 自动化脚本, 通知系统, 通知系统