sigma-rules
Skill0 starsChanged 3 days agoMITView on GitHub
Writing, reviewing, testing and converting Sigma detection rules - the vendor-neutral YAML format for log-based detections. Covers the full rule specification (title, id uuid, status, description, references, logsource product/category/service, detection selections and filters, value modifiers contains / startswith / endswith / all / re / base64offset / cidr / windash, condition grammar, falsepositives, level, ATT&CK tags like attack.t1059.001), Sigma correlation rules, good vs bad rule examples, conversion with pySigma and sigma-cli to Splunk SPL, Microsoft Sentinel / Defender XDR KQL, Elasticsearch Lucene / EQL / ES|QL, local testing with Chainsaw, Hayabusa or Zircolite on EVTX, and common mistakes. Use when asked to "write a Sigma rule", "convert this Sigma to KQL/SPL", "why does my Sigma rule not match", "sigma convert", "pySigma pipeline", or to port a detection between SIEMs.
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- timescale/sigma-rulestheir own version, first seen Mar 4, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- timescale/sigma-rules★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository52 other files it gives its agents.
- adversary-emulation-planningSkill
- alert-triageSkill
- atomic-red-teamSkill
- blueteam-methodologySkill
- caldera-operationsSkill
- defender-mindsetSkill
- detection-engineeringSkill
- elastic-eql-esqlSkill
- emulate-network-c2-exfilSkill
- emulate-windows-endpointSkill
- evidence-handlingSkill
- hardening-cloudSkill
- hardening-linuxSkill
- hardening-m365-entraSkill
- hardening-windows-adSkill
- hunt-ad-identity-attacksSkill
- hunt-c2-beaconingSkill
- hunt-cloud-control-planeSkill
- hunt-credential-accessSkill
- hunt-dispatchSkill
- hunt-exfiltrationSkill
- hunt-k8s-runtimeSkill
- hunt-lateral-movementSkill
- hunt-linux-persistenceSkill
- hunt-lolbinsSkill
- hunt-webshellsSkill
- hunt-windows-persistenceSkill
- incident-responseSkill
- ir-azure-entraSkill
- ir-bec-m365Skill
- ir-cloud-awsSkill
- ir-insider-threatSkill
- ir-ransomwareSkill
- ir-report-writingSkill
- kql-sentinel-defenderSkill
- linux-forensicsSkill
- logging-coverageSkill
- malware-triageSkill
- memory-forensicsSkill
- network-detection-suricata-zeekSkill
- phishing-analysisSkill
- post-incident-reviewSkill
- purple-exercise-trackingSkill
- purpleteam-methodologySkill
- purple-team-validationSkill
- spl-splunkSkill
- stratus-red-team-cloudSkill
- threat-intel-iocSkill
- timeline-analysisSkill
- vuln-prioritizationSkill
- windows-forensicsSkill
- yara-rulesSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 36
Write the narrowest selection that captures the behaviour.
- Distinctive: line 40
Run the converted query against the TP sample and against 30 days of production data.
- Very specific: line 97
Prefer modifiers (|contains) over hand-written *value* - clearer and safer.
- Distinctive: line 274
When your index uses non-standard field names, write a processing pipeline instead of editing rules:
- Very specific: line 318
On EVTX without a SIEM: run the rule with Chainsaw (chainsaw hunt <evtx_dir> -s rules/ --mapping <sigma-event-logs-all mapping file>), …
- Distinctive: line 324
Negative test: keep one benign event that must *not* match (the known FP you filtered) and assert zero hits.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sigma rules
Sigma is to log detections what YARA is to files: a portable rule format that backends compile into a SIEM query. Write once, convert per platform, but always check the generated query - conversion is only as good as the field mapping.
When to use
- A detection must run on more than one SIEM, or the SIEM may change.
- Publishing or sharing a detection (SigmaHQ style) with partners.
- Converting a public Sigma rule into Splunk / KQL / Elastic and debugging why it does not fire.
- Reviewing a Sigma rule in a PR (
detection-engineeringchecklist + the specifics below).
Ground rules
- A converted rule is not tested until it has run on the target platform.
sigma checkpassing proves syntax, not that the field names exist in your index. - Every rule needs a true-positive sample (log event that must match) and a
30-day baseline run on the target SIEM before it moves past
status: test(seedetection-engineering). - Never trust a backend's field mapping blindly. Print the converted query, compare each field to a real event from your environment.
- Do not invent ATT&CK IDs. Tag only techniques the rule actually detects.
Workflow
- Get a real event (or a published sample) of the behaviour - Sysmon 1 XML, 4688, MDE row, CloudTrail JSON.
- Pick the
logsourcethat describes the event generically (category: process_creation,product: windows) rather than a vendor-specific service, so pipelines can map it. - Write the narrowest selection that captures the behaviour; add filters for
known benign patterns in separate
filter_*blocks. sigma checkthe file; fix all errors, read the warnings.- Convert to each target with the correct pipeline; review the output query.
- Run the converted query against the TP sample and against 30 days of production data.
- Tune, update
falsepositives, bumpmodified, setstatus, open the PR.
Rule specification (Sigma 2.x)
title: Rundll32 Comsvcs MiniDump of a Process # short, behaviour-focused, < ~70 chars
id: 2b8e4a91-7f3c-4d2e-b6a1-9c0d5e7f1a23 # uuid4; never reuse, never change after publish
related: # optional: link derived/obsolete rules
- id: 00000000-0000-0000-0000-000000000000 # placeholder - put the real related rule id
type: derived # derived | obsolete | merged | renamed | similar
status: test # stable | test | experimental | deprecated | unsupported
description: |
Detects rundll32 invoking the MiniDump export of comsvcs.dll, commonly used
to dump LSASS memory for credential theft.
references:
- https://attack.mitre.org/techniques/T1003/001/
author: Blue Team
date: 2026-11-20 # YYYY-MM-DD in Sigma 2.x
modified: 2026-11-20
tags:
- attack.credential-access
- attack.t1003.001
logsource:
category: process_creation
product: windows
detection:
selection_img:
- Image|endswith: '\rundll32.exe'
- OriginalFileName: 'RUNDLL32.EXE'
selection_cli:
CommandLine|contains|all:
- 'comsvcs'
- 'minidump'
selection_ordinal:
CommandLine|contains|all:
- 'comsvcs'
- '#24'
condition: selection_img and (selection_cli or selection_ordinal)
fields: # optional hint for analysts / output columns
- CommandLine
- ParentImage
- User
falsepositives:
- Unlikely; some backup or diagnostic tools - verify parent process and signer
level: high # informational | low | medium | high | criticalKey semantics:
- Lists of values under one field = OR. Keys inside one map = AND.
A list of maps (as in
selection_img) = OR between the maps. |allturns a value list into AND (CommandLine|contains|all).- Value matching is case-insensitive by default for plain strings;
|reis case-sensitive unless you add|re|i(support varies by backend), and|casedforces case-sensitive plain matching. - Wildcards
*and?are allowed in plain values; escape literal ones with\. Prefer modifiers (|contains) over hand-written*value*- clearer and safer. nullmatches a missing/empty field;|exists: true|falsetests presence.
Value modifiers you will actually use
| Modifier | Meaning | Example |
contains / startswith / endswith | substring / prefix / suffix | Image|endswith: '\powershell.exe' |
all | all listed values must match | CommandLine|contains|all: [' -w ', 'hidden'] |
re | regular expression (sub-modifiers i, m, s) | CommandLine|re: '\s-[eE][nN]?[cC]?\s' |
windash | also match -, / and Unicode dash variants of a flag | CommandLine|contains|windash: ' -enc ' |
base64 | match the base64 encoding of the value (exact) | rarely useful alone |
base64offset | match the value base64-encoded at any of the 3 alignments | CommandLine|base64offset|contains: 'IEX' |
utf16le / wide | encode as UTF-16LE before base64 (PowerShell -enc) | CommandLine|wide|base64offset|contains: 'IEX (' |
cidr | IP in network range | DestinationIp|cidr: ['10.0.0.0/8', '192.168.0.0/16'] |
gt / gte / lt / lte | numeric comparison | EventID|gte: 4624 (rarely needed) |
fieldref | compare to another field's value | TargetUserName|fieldref: SubjectUserName |
exists | field present / absent | ParentImage|exists: false |
expand | placeholder expanded by a pipeline (e.g. %admin_users%) | environment-specific lists |
Condition grammar
- Boolean:
and,or,not, parentheses. - Groups:
1 of selection_*,all of selection_*,1 of them,all of them. - Idiomatic shape:
selection and not 1 of filter_*. - The old aggregation syntax (
| count() by X > 5) is deprecated; use correlation rules instead.
Correlation rules (Sigma 2.x)
# Sigma correlation: >= 10 failed logons for one target account from one source in 5 minutes
# Tune: threshold and timespan per environment; backend support varies (check sigma list targets)
title: Many Failed Logons For One Account
id: 7d3f0c2e-1a4b-4e8d-9f6a-2b5c8e1d0a47
status: test
correlation:
type: event_count # event_count | value_count | temporal | temporal_ordered
rules:
- failed_logon_rule # references the base rule by its `name:` or id
group-by:
- TargetUserName
- IpAddress
timespan: 5m
condition:
gte: 10
level: mediumThe base rule (separate document, --- separated or separate file) carries
name: failed_logon_rule and selects EventID: 4625. Use value_count with
field: for "many distinct users from one IP" (password spray).
Logsource cheat sheet (Windows)
| Behaviour | logsource | Typical source events |
| Process start | category: process_creation | Sysmon 1, Security 4688, MDE process events |
| Network connection | category: network_connection | Sysmon 3 |
| File created | category: file_event | Sysmon 11 |
| Registry value set | category: registry_set | Sysmon 13 |
| DLL load | category: image_load | Sysmon 7 |
| LSASS access | category: process_access | Sysmon 10 |
| DNS query | category: dns_query | Sysmon 22 |
| PowerShell script block | category: ps_script | PowerShell 4104 |
| Security log event | product: windows, service: security | 4624, 4698, 4769... |
| System log event | product: windows, service: system | 7045 |
Other products: product: linux (category: process_creation from auditd/Sysmon for Linux,
service: auditd, service: sshd), product: aws, service: cloudtrail,
product: azure, service: signinlogs | auditlogs | activitylogs,
product: m365, product: okta, product: gcp, service: gcp.audit, product: zeek, service: dns | http | conn.
Good vs bad
# BAD: brittle, case/obfuscation-sensitive, no logsource precision, IOC not behaviour
title: Bad Mimikatz
logsource:
product: windows
detection:
keywords:
- 'mimikatz.exe'
condition: keywords
level: criticalProblems: keyword search across all fields (slow, backend-dependent), detects a file name that attackers rename, no id/status/tags/falsepositives, severity claimed without evidence.
# GOOD: behaviour (encoded PowerShell launched by an Office app), resilient to renaming
title: Office Application Spawning Encoded PowerShell
id: 4c9a1e7b-2d3f-4a8e-b0c6-5e1f7d2a9b34
status: test
description: Detects Word/Excel/PowerPoint/Outlook starting PowerShell with an encoded command, typical of malicious macros.
references:
- https://attack.mitre.org/techniques/T1059/001/
- https://attack.mitre.org/techniques/T1566/001/
author: Blue Team
date: 2026-11-20
tags:
- attack.execution
- attack.t1059.001
- attack.initial-access
- attack.t1566.001
logsource:
category: process_creation
product: windows
detection:
selection_parent:
ParentImage|endswith:
- '\winword.exe'
- '\excel.exe'
- '\powerpnt.exe'
- '\outlook.exe'
selection_child:
- Image|endswith:
- '\powershell.exe'
- '\pwsh.exe'
- OriginalFileName:
- 'PowerShell.EXE'
- 'pwsh.dll'
selection_enc:
CommandLine|contains|windash:
- ' -e '
- ' -en '
- ' -enc '
- ' -enco'
- ' -ec '
condition: all of selection_*
falsepositives:
- Legitimate Office add-ins that launch PowerShell (rare; verify add-in and signer)
level: highWhy it is better: field-scoped, OriginalFileName survives renaming, windash
catches /enc and Unicode dashes, explicit tags and false positives.
Converting with sigma-cli / pySigma
# Install CLI and backends (pin versions in CI)
pip install sigma-cli
sigma plugin list # available backends and pipelines
sigma plugin install splunk
sigma plugin install elasticsearch
sigma plugin install kusto # Microsoft Sentinel / Defender XDR (replaces the older microsoft365defender backend)
sigma list targets # confirm target names in YOUR installed version
sigma list pipelines # confirm pipeline names before using them
# Validate
sigma check rules/
# Splunk SPL (Windows TA field names); -f savedsearches emits savedsearches.conf stanzas
sigma convert -t splunk -p splunk_windows rules/proc_creation_office_enc_ps.yml
sigma convert -t splunk -p splunk_windows -f savedsearches rules/ > savedsearches.conf
# Splunk CIM data model / tstats output (pipeline + format names vary by version - check sigma list)
sigma convert -t splunk -p splunk_cim -f data_model rules/proc_creation_office_enc_ps.yml
# Defender XDR advanced hunting / Sentinel KQL
sigma convert -t kusto -p microsoft_xdr rules/proc_creation_office_enc_ps.yml
sigma convert -t kusto -p sentinel_asim rules/proc_creation_office_enc_ps.yml
# Elastic: Lucene, EQL, ES|QL; ECS mapping pipeline for Winlogbeat / Elastic Agent data
sigma convert -t lucene -p ecs_windows rules/proc_creation_office_enc_ps.yml
sigma convert -t eql -p ecs_windows rules/proc_creation_office_enc_ps.yml
sigma convert -t esql -p ecs_windows rules/proc_creation_office_enc_ps.yml
sigma convert -t lucene -p ecs_windows -f siem_rule_ndjson rules/ > rules.ndjson # import into Kibana; format name: check sigma list formats lucenePipeline names, target names and output formats change between pySigma
releases - always confirm with sigma list targets|pipelines|formats <target>.
Custom field mapping pipeline
When your index uses non-standard field names, write a processing pipeline instead of editing rules:
# pipelines/corp_sysmon.yml - map Sigma fields to local Splunk extractions
# Use: sigma convert -t splunk -p splunk_windows -p pipelines/corp_sysmon.yml rules/
name: corp sysmon field mapping
priority: 100
transformations:
- id: corp_field_names
type: field_name_mapping
mapping:
CommandLine: process_command_line
ParentImage: parent_process_path
rule_conditions:
- type: logsource
category: process_creation
product: windows
- id: corp_index
type: add_condition
conditions:
index: edr_windows
rule_conditions:
- type: logsource
product: windowsPython API (for CI)
# Convert all rules for Splunk in a CI job; fails loudly on unsupported constructs
from sigma.collection import SigmaCollection
from sigma.backends.splunk import SplunkBackend
from sigma.pipelines.splunk import splunk_windows_pipeline
rules = SigmaCollection.load_ruleset(["rules/"])
backend = SplunkBackend(processing_pipeline=splunk_windows_pipeline())
for query in backend.convert(rules):
print(query)Testing
- Syntax:
sigma check rules/(also catches duplicate ids, missing fields). - On EVTX without a SIEM: run the rule with Chainsaw (
chainsaw hunt <evtx_dir> -s rules/ --mapping <sigma-event-logs-all mapping file>), Hayabusa (hayabusa csv-timeline -d <evtx_dir> -r rules/) or Zircolite against an EVTX that contains your TP sample. Check each tool's docs for the current flag names; they evolve. - On the SIEM: paste the converted query, run against the TP sample index
and against 30 days of production, record hit counts (see
detection-engineering). - Negative test: keep one benign event that must not match (the known FP you filtered) and assert zero hits.
False positives & benign look-alikes
| Pattern | Typical cause | Handle with |
| Encoded PowerShell | Management agents (SCCM, Intune scripts), vendor installers | filter_* on ParentImage + signed path; never on CommandLine wildcard alone |
rundll32 with odd exports | Control panel applets, printing, shell extensions | Exact DLL + export allowlist |
| Scheduled task / service creation | Software updaters | Filter by binary path under C:\Program Files\ AND known publisher (if signer field exists) |
Network tools (curl, certutil -urlcache) | Admin scripts, CI | Scope filters to build hosts or accounts via pipeline expand placeholders |
Decision table for a rule that fires after conversion:
| Verdict | Evidence |
| True Positive | Event matches the behaviour, unexplained by owner/change record |
| Benign True Positive | Behaviour real but sanctioned (admin, pentest) - document, consider filter |
| False Positive | Match caused by mapping error, wildcard over-reach, or wrong logsource - fix rule/pipeline |
| Needs more data | Field missing in source (no command line, no OriginalFileName) - fix logging first |
Pitfalls
- Wrong logsource (
service: sysmonwithEventID: 1) instead ofcategory: process_creation- pipelines cannot remap it to 4688/MDE. - Field not populated in your data (e.g.
OriginalFileNameabsent in 4688); an OR branch on a missing field silently never matches - harmless, but an AND on it kills the rule. - Backslash escaping: in single-quoted YAML,
'\rundll32.exe'is one backslash; wildcards and backslashes before*need care - read the converted query. |reportability: lookarounds and some flags are unsupported in Splunk/Lucene/ES|QL backends; keep regexes simple.containson huge fields (raw message) is slow in every backend.- Keyword-only rules (no field) convert to full-text search; avoid outside of very specific services.
- Forgetting
|all- a list undercontainsis OR, which is often far broader than intended. - Changing
idon edit - breaks tracking, metrics and deduplication downstream. - Status inflation -
stablemeans tested broadly; usetestuntil baselined.
Output
- A validated
.ymlSigma rule, the converted query for each target with the pipeline used, TP sample, baseline numbers, and filter rationale. - Hand-offs: platform tuning in
kql-sentinel-defender,spl-splunk,elastic-eql-esql; lifecycle, metadata and ADS indetection-engineering;/sigmato write or convert,/detectfor the full pipeline.
References
- Sigma specification (SigmaHQ
sigma-specificationrepository): rules, modifiers, correlation rules, taxonomy - SigmaHQ rule repository and contribution conventions
- pySigma and sigma-cli documentation; backend plugins: splunk, kusto, elasticsearch
- Chainsaw (WithSecure Labs), Hayabusa (Yamato Security), Zircolite
- MITRE ATT&CK: https://attack.mitre.org/techniques/T1003/001/, https://attack.mitre.org/techniques/T1059/001/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

