| name | chainsaw |
| description | Operate Chainsaw — a fast Windows event log (EVTX) analysis tool with Sigma rule integration for rapid threat hunting and incident response. Use when analyzing Windows event logs for lateral movement, credential access, persistence, execution, or defense evasion artifacts. Covers installation (cargo, releases), hunt mode with Sigma rules, search mode, dump mode, supported formats (EVTX, JSON), output formats (ASCII table, CSV, JSON), writing custom detection rules, key detection categories, and incident response triage workflows.
|
| metadata | {"author":"redhoundinfosec","version":"1.0","repo":"https://github.com/WithSecureLabs/chainsaw","stars":"3.4k","language":"Rust"} |
chainsaw Agent Skill
When to Use This Skill
Use this skill when:
- Conducting incident response and need to triage Windows event logs quickly
- Running threat hunting exercises against collected EVTX files
- Processing Windows event logs from disk images or evidence collection
- Applying Sigma rules to event logs without a SIEM
- Searching for specific keywords, process names, or IOCs across large EVTX sets
- The user asks about Windows event log analysis, EVTX parsing, or Sigma detection
What Chainsaw Does
Chainsaw is a Rust-based CLI tool that reads Windows Event Log (EVTX) files and either hunts them
against a library of Sigma detection rules or searches them for keywords/patterns. It is designed for
speed — parsing millions of events in seconds — and produces structured output in ASCII table, CSV,
or JSON format. In incident response engagements, Chainsaw replaces slow manual review in Windows
Event Viewer when logs are collected offline.
Installation
Method 1 — Download Pre-compiled Release (recommended)
VERSION=$(curl -s https://api.github.com/repos/WithSecureLabs/chainsaw/releases/latest \
| grep tag_name | cut -d '"' -f4)
wget "https://github.com/WithSecureLabs/chainsaw/releases/download/${VERSION}/chainsaw_x86_64-unknown-linux-musl.tar.gz"
tar -xzf chainsaw_x86_64-unknown-linux-musl.tar.gz
chmod +x chainsaw
./chainsaw --version
Method 2 — Build from Source (Cargo)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
git clone https://github.com/WithSecureLabs/chainsaw.git
cd chainsaw
cargo build --release
Get Sigma Rules and Mappings
Chainsaw ships with its own rule set and mappings, but supplementing with upstream Sigma rules
improves coverage significantly.
git clone https://github.com/SigmaHQ/sigma.git
ls chainsaw/
Core Concepts
EVTX Format
Windows Event Log files (.evtx) are binary files containing structured XML records. Each record has:
System.EventID — event type (e.g., 4624 = Logon, 4688 = Process Creation)
System.TimeCreated — timestamp
System.Computer — host that generated the event
System.Channel — log channel (Security, System, Application, PowerShell, etc.)
EventData — payload fields specific to the event type
Chainsaw parses EVTX files using the evtx Rust crate and converts records to JSON internally.
Sigma Rules
Sigma is a generic signature format for SIEM detection rules. A Sigma rule specifies:
detection.selection — field/value conditions
detection.condition — logical combination of selections
logsource — which log channel/category the rule applies to
Chainsaw uses mapping files (mappings/) to translate Sigma's generic field names to EVTX's
actual XML field paths, enabling direct application of Sigma rules to raw EVTX files.
Modes
| Mode | Purpose |
|---|
hunt | Apply Sigma rules to EVTX files; output matching events with rule names |
search | Full-text or field-specific keyword search across EVTX files |
dump | Convert EVTX files to JSON/CSV for external processing |
analyse | Pre-built analysis modules (shimcache, shimdb, etc.) |
CLI Reference
Hunt Mode
Hunt mode applies Sigma rules to event logs and surfaces matches with rule name, severity, and event detail.
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml
./chainsaw hunt Security.evtx -s rules/ -m mappings/sigma-event-logs-all.yml
./chainsaw hunt EVTX_DIR/ -s rules/windows/process_creation/proc_creation_win_psexec_execution.yml \
-m mappings/sigma-event-logs-all.yml
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml \
--output results.json --json
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml \
--output results.csv --csv
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml --full
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml \
--from "2026-03-01 00:00:00" --to "2026-04-01 00:00:00"
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml \
--level high
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml \
--status stable
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml \
--skip-errors
./chainsaw hunt EVTX_DIR/ -s rules/ -m mappings/sigma-event-logs-all.yml --progress
./chainsaw hunt /mnt/evidence/C/Windows/System32/winevt/Logs/ \
-s rules/ -m mappings/sigma-event-logs-all.yml --output hunt_results.json --json
Search Mode
Search mode does keyword or field-level search across all events without requiring Sigma rules.
./chainsaw search "mimikatz" EVTX_DIR/
./chainsaw search "powershell" Security.evtx
./chainsaw search -i "cobalt strike" EVTX_DIR/
./chainsaw search -e "cmd\.exe.*\/c.*whoami" EVTX_DIR/
./chainsaw search --event-id 4624 Security.evtx
./chainsaw search --event-id 4688 Security.evtx
./chainsaw search --event-id 7045 System.evtx
./chainsaw search "lateral" EVTX_DIR/ \
--from "2026-03-15 00:00:00" --to "2026-03-16 23:59:59"
./chainsaw search "powershell" EVTX_DIR/ --output search_results.json --json
./chainsaw search --tau "EventID: 4624 AND LogonType: 3" Security.evtx
Dump Mode
Dump mode converts EVTX files to structured JSON or CSV for external analysis (Splunk, ELK, Excel).
./chainsaw dump Security.evtx --json --output security_dump.json
./chainsaw dump Security.evtx --csv --output security_dump.csv
./chainsaw dump EVTX_DIR/ --json --output all_events.json
./chainsaw dump Security.evtx --json \
--from "2026-04-01 00:00:00" --to "2026-04-02 00:00:00" \
--output incident_window.json
./chainsaw dump Security.evtx --json --event-id 4624 --output logon_events.json
Analyse Mode
Pre-built analysis for specific forensic artifacts.
./chainsaw analyse shimcache SYSTEM --output shimcache.json --json
./chainsaw analyse amcache Amcache.hve --output amcache.json --json
Key Detections and Event IDs
Lateral Movement
| Event ID | Channel | Description | Sigma Rule Category |
|---|
| 4624 | Security | Successful logon (Type 3 = Network, Type 10 = Remote Interactive) | lateral_movement |
| 4648 | Security | Logon with explicit credentials (Pass-the-Hash indicator) | credential_access |
| 7045 | System | New service installed (PsExec creates services) | lateral_movement |
| 4698 | Security | Scheduled task created | persistence |
Credential Access
| Event ID | Channel | Description |
|---|
| 4661 | Security | SAM/LSA object access (credential dumping) |
| 4663 | Security | Object access — NTDS.dit, SAM hive access |
| 4769 | Security | Kerberos service ticket request (Kerberoasting: RC4 enc type) |
| 4768 | Security | Kerberos TGT request |
| 4771 | Security | Kerberos pre-auth failure (brute force) |
Execution and PowerShell
| Event ID | Channel | Description |
|---|
| 4688 | Security | Process creation (requires audit policy) |
| 4104 | PowerShell | Script block logging — full PS command |
| 4103 | PowerShell | Module logging |
| 400/403 | PowerShell | Engine start/stop |
Persistence
| Event ID | Channel | Description |
|---|
| 4698 | Security | Scheduled task created |
| 4702 | Security | Scheduled task updated |
| 7045 | System | New service registered |
| 4657 | Security | Registry value modified (Run keys, etc.) |
Defense Evasion
| Event ID | Channel | Description |
|---|
| 1102 | Security | Audit log cleared |
| 104 | System | System log cleared |
| 4719 | Security | Audit policy changed |
Incident Response Workflow
Step 1 — Evidence Collection
Step 2 — Initial Hunt (High Severity)
mkdir -p ir_results/
./chainsaw hunt /evidence/Logs/ \
-s rules/ -m mappings/sigma-event-logs-all.yml \
--level high --json --output ir_results/high_sev_hits.json
cat ir_results/high_sev_hits.json | jq '.[].name' | sort -u
Step 3 — Targeted Event ID Search
./chainsaw dump /evidence/Logs/Security.evtx --json --event-id 4624 \
--output ir_results/logon_events.json
./chainsaw dump /evidence/Logs/Security.evtx --json --event-id 4688 \
--output ir_results/process_creation.json
./chainsaw dump /evidence/Logs/Microsoft-Windows-PowerShell%4Operational.evtx \
--json --event-id 4104 --output ir_results/powershell_scriptblocks.json
Step 4 — IOC Search
./chainsaw search -i "C2_domain.com" /evidence/Logs/ \
--json --output ir_results/ioc_c2.json
./chainsaw search -e "(cobalt|cobaltstrike|beacon\.dll)" /evidence/Logs/ \
--json --output ir_results/ioc_cobalt.json
./chainsaw search "net user" /evidence/Logs/ \
--from "2026-04-01 00:00:00" --json --output ir_results/net_user_cmds.json
Step 5 — Full Dump for Timeline
./chainsaw dump /evidence/Logs/ --json --output ir_results/full_evtx_dump.json
./chainsaw dump /evidence/Logs/ --csv --output ir_results/full_evtx_dump.csv
Custom Detection Rules
Write Sigma rules targeting specific TTPs. Example — detecting PsExec service installation:
title: PsExec Service Installation
status: stable
description: Detects PSEXESVC service creation indicative of PsExec lateral movement
logsource:
product: windows
service: system
detection:
selection:
EventID: 7045
ServiceName: 'PSEXESVC'
condition: selection
falsepositives:
- Legitimate PsExec use by administrators
level: high
tags:
- attack.lateral_movement
- attack.t1569.002
./chainsaw hunt /evidence/Logs/System.evtx \
-s rules/custom/detect_psexec_service.yml \
-m mappings/sigma-event-logs-all.yml
Integration with Other Tools
With Velociraptor / KAPE Evidence Collections
./chainsaw hunt KAPE_Output/C/Windows/System32/winevt/Logs/ \
-s rules/ -m mappings/sigma-event-logs-all.yml \
--json --output chainsaw_kape_results.json
With Hayabusa (complementary tool)
Chainsaw focuses on Sigma rules; Hayabusa is another EVTX tool with its own rule format.
Run both for maximum detection coverage, then merge JSON outputs for timeline analysis.
Troubleshooting
| Issue | Cause | Fix |
|---|
No events found | EVTX path wrong | Verify path; check ls EVTX_DIR/*.evtx |
Rule parse error | Incompatible Sigma rule version | Use --skip-errors flag |
Mapping file not found | Missing -m flag | Always specify -m mappings/sigma-event-logs-all.yml |
| Very slow hunt | Large EVTX set, many rules | Filter by --level high, use --from/--to |
| Empty JSON output | No matches | Normal; reduce --level threshold, check rule coverage |
| Permission denied on EVTX | Locked by OS | Copy EVTX files off live system with VSS shadow copy |
| Binary not found on Windows | Missing VC++ runtime | Install Microsoft Visual C++ Redistributable |
Built by Red Hound InfoSec — On-demand offensive security expertise for SMBs.
20+ years of Fortune 500 experience. Penetration testing, attack surface analysis, and security consulting.
Related reading: Your Company Just Got Hit with Ransomware: A 48-Hour Survival Playbook for SMBs
redhound.us | GitHub | Book a consultation