sigma-hunting
Apply Sigma rules against log sources for threat hunting; convert rules to Elasticsearch, Splunk, and grep queries
Best use case
sigma-hunting is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
It is a strong fit for teams already working in Codex.
Apply Sigma rules against log sources for threat hunting; convert rules to Elasticsearch, Splunk, and grep queries
Teams using sigma-hunting should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/sigma-hunting/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How sigma-hunting Compares
| Feature / Agent | sigma-hunting | Standard Approach |
|---|---|---|
| Platform Support | Codex | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Apply Sigma rules against log sources for threat hunting; convert rules to Elasticsearch, Splunk, and grep queries
Which AI agents support this skill?
This skill is designed for Codex.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
SKILL.md Source
# 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:
1. **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
2. **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)
3. **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
4. **Convert rules to grep (offline log files)**:
- Parse Sigma YAML detection field
- Convert `selection` keywords to extended grep patterns:
```bash
grep -Ei 'pattern1|pattern2' /var/log/auth.log
```
- Handle `condition: selection and not filter` by piping through a second grep with `-v`
- Note: grep conversion handles keyword-only rules; complex field-mapped rules require sigma-cli
5. **Convert rules via sigma-cli (when available)**:
- Elasticsearch backend:
```bash
sigma convert -t elasticsearch -f lucene rules/sigma/linux/ > hunt-queries.txt
```
- Splunk backend:
```bash
sigma convert -t splunk rules/sigma/linux/ > hunt-spl.txt
```
- Execute converted queries against the target index or log source
6. **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
7. **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
8. **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
9. **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
```yaml
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 toRelated Skills
aiwg-orchestrate
Route structured artifact work to AIWG workflows via MCP with zero parent context cost
venv-manager
Create, manage, and validate Python virtual environments. Use for project isolation and dependency management.
pytest-runner
Execute Python tests with pytest, supporting fixtures, markers, coverage, and parallel execution. Use for Python test automation.
vitest-runner
Execute JavaScript/TypeScript tests with Vitest, supporting coverage, watch mode, and parallel execution. Use for JS/TS test automation.
eslint-checker
Run ESLint for JavaScript/TypeScript code quality and style enforcement. Use for static analysis and auto-fixing.
repo-analyzer
Analyze GitHub repositories for structure, documentation, dependencies, and contribution patterns. Use for codebase understanding and health assessment.
pr-reviewer
Review GitHub pull requests for code quality, security, and best practices. Use for automated PR feedback and approval workflows.
YouTube Acquisition
yt-dlp patterns for acquiring content from YouTube and video platforms
Quality Filtering
Accept/reject logic and quality scoring heuristics for media content
Provenance Tracking
W3C PROV-O patterns for tracking media derivation chains and production history
Metadata Tagging
opustags and ffmpeg patterns for applying metadata to audio and video files
Audio Extraction
ffmpeg patterns for extracting audio from video files and transcoding between formats