sigma-hunting
Applies Sigma detection rules against collected log sources to identify threat activity. Supports the bundled forensics-complete Sigma rule library and custom rules. Converts Sigma rules to backend-specific queries for Elasticsearch, Splunk, and grep, enabling hunting across both real-time platforms and offline log files.
Triggers
Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):
- "ATT&CK [technique]" / "MITRE [TID]" → technique-specific threat hunt
- "T1059" / "T1053" (etc.) → ATT&CK technique ID lookups
- "Sigma rules" → rule-based threat hunting
Purpose
Sigma provides a vendor-neutral rule format for expressing detection logic. Writing backend-specific queries for every log source and SIEM is time-consuming and error-prone. This skill translates Sigma rules to the appropriate query format for the available tooling, applies them against collected logs, and reports matches with ATT&CK technique context.
Behavior
When triggered, this skill:
Identify available rule sources:
- Bundled rules:
agentic/code/frameworks/forensics-complete/sigma/
- Custom rules:
.aiwg/forensics/sigma/custom/
- Check for sigma-cli or pySigma installation:
sigma --version 2>/dev/null
- If sigma-cli is unavailable, use built-in grep-based conversion for simple rules
Identify target log sources and backends:
- Detect available log sources: journald, flat files, Elasticsearch index, Splunk index
- Match Sigma
logsource categories to available sources:
category: process_creation → syslog, auditd logs, or EDR telemetry
category: network_connection → firewall logs, VPC flow logs, Zeek conn.log
category: webserver → nginx/Apache access logs
product: linux → auth.log, syslog, journal
product: windows → Windows Event Log exports (.evtx or JSON)
Select applicable rules:
- Filter rule library by
logsource compatibility with available sources
- If a specific MITRE technique is requested (e.g., "hunt for T1059"), filter by
tags: attack.t1059*
- Apply severity filter: default to
medium, high, critical rules only
- List selected rules and their ATT&CK technique mappings before execution
Convert rules to grep (offline log files):
Convert rules via sigma-cli (when available):
Execute hunts and collect matches:
- Run each rule against the target log source
- Record: rule name, ATT&CK technique, match count, first and last match timestamp, sample matching lines
- Group results by ATT&CK tactic for reporting
Triage matches:
- Flag rules with zero matches (coverage gap) vs rules with matches (hits)
- For each hit: extract relevant fields (source IP, username, process name, command line)
- Cross-reference extracted values with IOC list from
ioc-extraction skill
Apply custom rules:
- Load any
.yml files from .aiwg/forensics/sigma/custom/
- Validate YAML structure and required Sigma fields before execution
- Report custom rule coverage alongside bundled rule results
Write hunt report:
- Save to
.aiwg/forensics/findings/<hostname>-sigma-hunt.md
- Include: rules applied, hits per rule, ATT&CK tactic coverage map, sample evidence per hit, coverage gaps
Usage Examples
Example 1 — Full hunt against local logs
sigma hunt
Example 2 — Hunt for specific technique
hunt for T1078
Example 3 — Convert rules for Elasticsearch
sigma rules --backend elasticsearch --output hunt-queries.txt
Output Locations
- Hunt report:
.aiwg/forensics/findings/<hostname>-sigma-hunt.md
- Converted queries:
.aiwg/forensics/sigma/converted/
- Rule hit evidence:
.aiwg/forensics/evidence/sigma-hits.txt
Configuration
sigma_hunting:
bundled_rules_path: agentic/code/frameworks/forensics-complete/sigma/
custom_rules_path: .aiwg/forensics/sigma/custom/
default_severity_filter:
- medium
- high
- critical
default_backend: grep
available_backends:
- grep
- elasticsearch
- splunk
sigma_cli_path: sigma
References
- @$AIWG_ROOT/agentic/code/addons/aiwg-utils/rules/research-before-decision.md — Identify available log sources and rule libraries before executing hunts; check tool availability
- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/rules/evidence-integrity.md — Hunting must not modify log sources; run rules against read-only copies
- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/rules/red-flag-escalation.md — Escalate to human when Sigma hits indicate active compromise or critical severity findings
- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/skills/ioc-extraction/SKILL.md — Cross-reference Sigma rule hits against extracted IOCs for confirmation
- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/skills/log-analysis/SKILL.md — Log analysis skill provides the correlated timeline that Sigma hunting adds detection coverage to
1---
2namespace: aiwg
3name: sigma-hunting
4description: "Apply Sigma rules against log sources for threat hunting; convert rules to Elasticsearch, Splunk, and grep queries"
5tools: Bash, Read, Write, Glob, Grep
6platforms: [all]
7
8metadata:
9 source: https://skillmd.com/skills/aibot88/sigma-hunting
10---
11
12# sigma-hunting
13
14Applies Sigma detection rules against collected log sources to identify threat activity. Supports the bundled forensics-complete Sigma rule library and custom rules. Converts Sigma rules to backend-specific queries for Elasticsearch, Splunk, and grep, enabling hunting across both real-time platforms and offline log files.
15
16## Triggers
17
18
19Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):
20
21- "ATT&CK [technique]" / "MITRE [TID]" → technique-specific threat hunt
22- "T1059" / "T1053" (etc.) → ATT&CK technique ID lookups
23- "Sigma rules" → rule-based threat hunting
24
25## Purpose
26
27Sigma provides a vendor-neutral rule format for expressing detection logic. Writing backend-specific queries for every log source and SIEM is time-consuming and error-prone. This skill translates Sigma rules to the appropriate query format for the available tooling, applies them against collected logs, and reports matches with ATT&CK technique context.
28
29## Behavior
30
31When triggered, this skill:
32
331. **Identify available rule sources**:
34 - Bundled rules: `agentic/code/frameworks/forensics-complete/sigma/`
35 - Custom rules: `.aiwg/forensics/sigma/custom/`
36 - Check for sigma-cli or pySigma installation: `sigma --version 2>/dev/null`
37 - If sigma-cli is unavailable, use built-in grep-based conversion for simple rules
38
392. **Identify target log sources and backends**:
40 - Detect available log sources: journald, flat files, Elasticsearch index, Splunk index
41 - Match Sigma `logsource` categories to available sources:
42 - `category: process_creation` → syslog, auditd logs, or EDR telemetry
43 - `category: network_connection` → firewall logs, VPC flow logs, Zeek conn.log
44 - `category: webserver` → nginx/Apache access logs
45 - `product: linux` → auth.log, syslog, journal
46 - `product: windows` → Windows Event Log exports (.evtx or JSON)
47
483. **Select applicable rules**:
49 - Filter rule library by `logsource` compatibility with available sources
50 - If a specific MITRE technique is requested (e.g., "hunt for T1059"), filter by `tags: attack.t1059*`
51 - Apply severity filter: default to `medium`, `high`, `critical` rules only
52 - List selected rules and their ATT&CK technique mappings before execution
53
544. **Convert rules to grep (offline log files)**:
55 - Parse Sigma YAML detection field
56 - Convert `selection` keywords to extended grep patterns:
57 ```bash
58 grep -Ei 'pattern1|pattern2' /var/log/auth.log
59 ```
60 - Handle `condition: selection and not filter` by piping through a second grep with `-v`
61 - Note: grep conversion handles keyword-only rules; complex field-mapped rules require sigma-cli
62
635. **Convert rules via sigma-cli (when available)**:
64 - Elasticsearch backend:
65 ```bash
66 sigma convert -t elasticsearch -f lucene rules/sigma/linux/ > hunt-queries.txt
67 ```
68 - Splunk backend:
69 ```bash
70 sigma convert -t splunk rules/sigma/linux/ > hunt-spl.txt
71 ```
72 - Execute converted queries against the target index or log source
73
746. **Execute hunts and collect matches**:
75 - Run each rule against the target log source
76 - Record: rule name, ATT&CK technique, match count, first and last match timestamp, sample matching lines
77 - Group results by ATT&CK tactic for reporting
78
797. **Triage matches**:
80 - Flag rules with zero matches (coverage gap) vs rules with matches (hits)
81 - For each hit: extract relevant fields (source IP, username, process name, command line)
82 - Cross-reference extracted values with IOC list from `ioc-extraction` skill
83
848. **Apply custom rules**:
85 - Load any `.yml` files from `.aiwg/forensics/sigma/custom/`
86 - Validate YAML structure and required Sigma fields before execution
87 - Report custom rule coverage alongside bundled rule results
88
899. **Write hunt report**:
90 - Save to `.aiwg/forensics/findings/<hostname>-sigma-hunt.md`
91 - Include: rules applied, hits per rule, ATT&CK tactic coverage map, sample evidence per hit, coverage gaps
92
93## Usage Examples
94
95### Example 1 — Full hunt against local logs
96```
97sigma hunt
98```
99
100### Example 2 — Hunt for specific technique
101```
102hunt for T1078
103```
104
105### Example 3 — Convert rules for Elasticsearch
106```
107sigma rules --backend elasticsearch --output hunt-queries.txt
108```
109
110## Output Locations
111
112- Hunt report: `.aiwg/forensics/findings/<hostname>-sigma-hunt.md`
113- Converted queries: `.aiwg/forensics/sigma/converted/`
114- Rule hit evidence: `.aiwg/forensics/evidence/sigma-hits.txt`
115
116## Configuration
117
118```yaml
119sigma_hunting:
120 bundled_rules_path: agentic/code/frameworks/forensics-complete/sigma/
121 custom_rules_path: .aiwg/forensics/sigma/custom/
122 default_severity_filter:
123 - medium
124 - high
125 - critical
126 default_backend: grep
127 available_backends:
128 - grep
129 - elasticsearch
130 - splunk
131 sigma_cli_path: sigma
132```
133
134## References
135
136- @$AIWG_ROOT/agentic/code/addons/aiwg-utils/rules/research-before-decision.md — Identify available log sources and rule libraries before executing hunts; check tool availability
137- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/rules/evidence-integrity.md — Hunting must not modify log sources; run rules against read-only copies
138- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/rules/red-flag-escalation.md — Escalate to human when Sigma hits indicate active compromise or critical severity findings
139- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/skills/ioc-extraction/SKILL.md — Cross-reference Sigma rule hits against extracted IOCs for confirmation
140- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/skills/log-analysis/SKILL.md — Log analysis skill provides the correlated timeline that Sigma hunting adds detection coverage to