
Sigma Rules
- 11 installs
- 2 repo stars
- Updated March 4, 2026
- timescale/sigma-rules
Helps with ai & agent building tasks.
About
sigma-rules is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- sigma-rules
- AI & Agent Building
- AI-coding skill
Sigma Rules by the numbers
- 11 all-time installs (skills.sh)
- Ranked #11,769 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/timescale/sigma-rules --skill sigma-rulesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 11 |
|---|---|
| repo stars | ★ 2 |
| Last updated | March 4, 2026 |
| Repository | timescale/sigma-rules ↗ |
What it does
Helps with ai & agent building tasks.
Files
Sigma Rules
Write Sigma detection, correlation, and filter rules plus processing pipelines per the Sigma v2.1.0 specification. This version is backward-compatible with v2.0.0.
Detection Rules
A detection rule matches log events against field conditions.
Template
title: <concise description of what is detected>
id: <UUIDv4>
status: <stable|test|experimental|deprecated|unsupported>
description: <what this rule detects and why it matters>
author: <name>
date: YYYY-MM-DD
modified: YYYY-MM-DD
references:
- <URL>
tags:
- attack.<tactic>
- attack.<technique_id>
logsource:
category: <category>
product: <product>
service: <service>
detection:
<selection_name>:
<FieldName|modifier1|modifier2>: <value or list>
<filter_name>:
<FieldName>: <value>
condition: <selection_name> and not <filter_name>
falsepositives:
- <known false positive scenario>
level: <informational|low|medium|high|critical>Detection Block
The detection section maps named identifiers to field conditions, then combines them with a condition expression.
YAML mapping (AND-linked fields):
selection:
EventID: 1
Image|endswith: '\whoami.exe'YAML list of mappings (OR-linked):
selection:
- EventID: 1
Image|endswith: '\whoami.exe'
- EventID: 4688
NewProcessName|endswith: '\whoami.exe'Keyword list (field-agnostic search):
keywords:
- 'mimikatz'
- 'sekurlsa'Field Modifiers
Modifiers chain with | on the field name. Common modifiers:
| Modifier | Effect |
|---|---|
contains | Substring match (wraps value in *...*) |
startswith | Prefix match (appends *) |
endswith | Suffix match (prepends *) |
all | AND-link all values (default is OR) |
re | Value is a regex (disables wildcard parsing) |
cidr | CIDR network match |
base64 / base64offset | Match base64-encoded value |
wide | UTF-16LE encoding |
windash | Match both - and / dash styles |
exists | Field existence check (value: true/false) |
gt, gte, lt, lte | Numeric comparison |
cased | Case-sensitive match |
fieldref | Value references another field name |
For the full list of 30 modifiers, incompatible combinations, and encoding chains, see references/modifiers.md.
Condition Expressions
Conditions combine named detections with boolean logic:
condition: selection and not filter
condition: 1 of selection* or keywords
condition: all of themPrecedence: not > and > or. Quantifiers: 1 of, all of, any of, N of. Wildcard patterns match detection names (selection*). them matches all identifiers except _-prefixed ones.
For the full grammar, see references/condition-syntax.md.
Wildcards in Values
* matches any number of characters, ? matches exactly one. Escape with backslash: \*, \?, \\. Non-special backslash sequences like \W are preserved literally (important for Windows paths).
Worked Example
Request: "Detect use of the Windows command line to delete shadow copies"
title: Shadow Copy Deletion via Vssadmin or WMIC
id: c947b146-0abc-4f7a-a55e-bf2fcb8dbb60
status: test
description: >
Detects the use of vssadmin or wmic to delete volume shadow copies,
a common ransomware and anti-forensics technique.
author: Security Team
date: 2025-01-15
references:
- https://attack.mitre.org/techniques/T1490/
tags:
- attack.impact
- attack.t1490
logsource:
category: process_creation
product: windows
detection:
selection_vssadmin:
Image|endswith: '\vssadmin.exe'
CommandLine|contains|all:
- 'delete'
- 'shadows'
selection_wmic:
Image|endswith: '\wmic.exe'
CommandLine|contains|all:
- 'shadowcopy'
- 'delete'
condition: 1 of selection_*
falsepositives:
- Legitimate backup rotation scripts
level: highFor the full detection rule reference (metadata fields, logsource, multi-document YAML, tags), see references/detection-rules.md.
---
Correlation Rules
Correlation rules aggregate or sequence events matched by detection rules over a time window, grouped by key fields.
Template
title: <what the correlation detects>
id: <UUIDv4>
correlation:
type: <correlation_type>
rules:
- <rule-id or wildcard>
group-by:
- <field>
timespan: <duration>
condition:
gte: <threshold>
level: <level>Correlation Types
| Type | Purpose | Condition |
|---|---|---|
event_count | Count matching events per group | Threshold: {gte: N} |
value_count | Count distinct values of a field per group | Threshold with field: {field: X, gte: N} |
temporal | Multiple rule types fire in same window | Extended: "rule_a and rule_b" or default |
temporal_ordered | Same as temporal, rules must fire in order | Extended: "rule_a and rule_b" |
value_sum | Sum a numeric field across events | Threshold with field |
value_avg | Average a numeric field | Threshold with field |
value_percentile | Percentile of a numeric field | Threshold with field |
value_median | Median of a numeric field | Threshold with field |
Condition Block
Threshold (mapping): for count/metric types:
condition:
gte: 100With field (required for value_count, value_sum, value_avg, value_percentile, value_median):
condition:
field: SourceIP
gte: 5Operators: gt, gte, lt, lte, eq, neq. Values must be numeric.
Extended (string): for temporal types:
condition: "recon_scan and lateral_movement"Timespan
Format: integer + unit suffix. Units: s (seconds), m (minutes), h (hours), d (days), w (weeks), M (months, uppercase), y (years). Both timespan and timeframe keys are accepted.
Worked Example
Request: "Alert on brute force: more than 5 failed logins from the same user within 5 minutes"
title: Failed Login
id: d4c9a825-fdb3-472e-9b0e-fa4709aba44c
status: test
logsource:
category: authentication
product: windows
detection:
selection:
EventType: failed_login
condition: selection
level: low
---
title: Brute Force Detection
id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
correlation:
type: event_count
rules:
- d4c9a825-fdb3-472e-9b0e-fa4709aba44c
group-by:
- User
timespan: 5m
condition:
gte: 5
level: criticalFor all 8 correlation types with full examples, see references/correlation-rules.md.
---
Filter Rules
Filter rules inject AND NOT exclusion conditions into referenced detection rules, enabling centralized tuning without modifying original rules.
Template
title: <what is being filtered>
logsource:
category: <must match target rule>
product: <must match target rule>
filter:
rules:
- <target-rule-id>
selection:
<FieldName|modifier>: <value>
condition: selectionKey Points
selection,condition, andrulesall live inside thefiltersectionrules: [](empty) applies the filter globally to all matching rules- Filter rules should not have
levelorstatusfields - Multiple filters on the same rule use independent detection namespaces (no collision)
Worked Example
Request: "Exclude service accounts from the brute force rule"
title: Exclude Service Accounts from Brute Force
logsource:
category: authentication
product: windows
filter:
rules:
- d4c9a825-fdb3-472e-9b0e-fa4709aba44c
selection:
User|startswith: 'svc_'
condition: selectionFor global vs targeted filters and multi-filter patterns, see references/filter-rules.md.
---
Processing Pipelines
Pipelines transform Sigma rule ASTs before evaluation -- typically for field name mapping between generic Sigma field names and backend-specific schemas (ECS, Splunk CIM, etc.).
Template
name: <pipeline name>
priority: <integer, lower runs first>
transformations:
- type: field_name_mapping
mapping:
<SigmaField>: <backend_field>
rule_conditions:
- type: logsource
product: <product>Common Transformations
| Type | Purpose | Key Parameters |
|---|---|---|
field_name_mapping | Rename fields | mapping: {old: new} |
field_name_prefix | Add prefix to all fields | prefix: string |
replace_string | Regex replacement in values | regex, replacement |
drop_detection_item | Remove matching detection items | (none) |
change_logsource | Rewrite logsource fields | category, product, service |
add_condition | Inject extra conditions | conditions: {field: value} |
Rule Conditions
Transformations only apply when all rule_conditions match:
| Type | Matches When |
|---|---|
logsource | Rule logsource matches category/product/service |
contains_detection_item | Rule has a detection item with the given field |
tag | Rule has the given tag |
is_sigma_rule | Document is a detection rule |
is_sigma_correlation_rule | Document is a correlation rule |
Worked Example
Request: "Map generic Sigma fields to Elastic Common Schema for Windows process creation rules"
name: ECS Windows Process Creation
priority: 10
transformations:
- type: field_name_mapping
mapping:
CommandLine: process.command_line
Image: process.executable
ParentImage: process.parent.executable
User: user.name
OriginalFileName: process.pe.original_file_name
Hashes: process.hash
ParentCommandLine: process.parent.command_line
IntegrityLevel: winlog.event_data.IntegrityLevel
LogonId: winlog.logon.id
rule_conditions:
- type: logsource
product: windows
category: process_creation
- type: change_logsource
product: windows
category: process_creation
rule_conditions:
- type: logsource
product: windows
category: process_creationFor the full list of 26 transformations, all condition types, variables, and expression syntax, see references/pipelines.md.
---
Authoring Checklist
When writing or reviewing Sigma rules, verify:
- [ ]
titleis present and under 256 characters - [ ]
idis a valid UUIDv4 (8-4-4-4-12hex format) - [ ]
statusis one of:stable,test,experimental,deprecated,unsupported - [ ]
levelis one of:informational,low,medium,high,critical - [ ]
dateandmodifieduseYYYY-MM-DDformat;modified>=date - [ ]
logsourceis present with at least one ofcategory,product,service - [ ] Logsource values are lowercase
- [ ] Detection has at least one named identifier and a
condition - [ ] Condition only references identifiers that exist in the detection block
- [ ] Tags match
^[a-z0-9_-]+\.[a-z0-9._-]+$(e.g.attack.t1059) - [ ] No incompatible modifier combinations (e.g.
contains|startswith,re|contains) - [ ]
deprecatedrules have arelatedentry - [ ] Correlation rules have
type,rules,group-by, andtimespan - [ ] Filter rules have
rules,selection, andconditioninside thefiltersection - [ ] Filter rules do not have
levelorstatus
Multi-Document YAML
Multiple rules in one file are separated by ---. Collection actions control template inheritance:
action: global-- store as template merged into all subsequent rulesaction: reset-- clear the templateaction: repeat-- clone the previous rule and merge current fields on top
This is commonly used to share logsource across detection + correlation rule pairs.
Additional References
- Detection rules deep dive -- metadata, logsource, multi-document, tags
- Correlation rules -- all 8 types with examples
- Filter rules -- global vs targeted, multi-filter patterns
- Pipelines -- all 26 transformations and conditions
- Field modifiers -- all 30 modifiers, chaining, compatibility
- Condition syntax -- grammar, precedence, quantifiers
Sigma Rules Skill
An Agent Skill for authoring Sigma detection rules, correlation rules, filter rules, and processing pipelines.
What This Skill Does
This skill teaches AI agents the full Sigma v2.1.0 specification so they can:
- Write correct detection rules from natural language descriptions
- Create correlation rules (event_count, value_count, temporal, and 5 more types)
- Author filter rules for centralized tuning
- Build processing pipelines for field mapping (ECS, Splunk CIM, etc.)
- Use proper field modifiers, condition expressions, and multi-document YAML
- Validate rules against the specification checklist
Install
npx skills add timescale/sigma-rules -g -yOr install for a specific agent:
npx skills add timescale/sigma-rules -g -a cursor -y
npx skills add timescale/sigma-rules -g -a claude-code -yStructure
sigma-rules/
├── SKILL.md # Main skill — templates, examples, checklist
└── references/
├── detection-rules.md # Detection rule format deep dive
├── correlation-rules.md # All 8 correlation types with examples
├── filter-rules.md # Filter rule format and usage
├── pipelines.md # Pipeline transforms and conditions
├── modifiers.md # All 30 field modifiers
└── condition-syntax.md # Condition expression grammarThe main SKILL.md covers the essential authoring workflow with templates and worked examples. Reference files provide deeper detail and are loaded on demand.
Coverage
- Sigma Specification v2.1.0 (backward-compatible with v2.0.0)
- 30 field modifiers with compatibility rules
- 8 correlation types (event_count, value_count, temporal, temporal_ordered, value_sum, value_avg, value_percentile, value_median)
- 26 pipeline transformation types
- Multi-document YAML (global, reset, repeat actions)
- Condition expression grammar (not > and > or, quantifiers, wildcards)
References
License
MIT
Condition Expression Syntax
Full reference for Sigma condition expressions per the v2.1.0 specification.
Overview
The condition field in a detection block combines named detection identifiers with boolean logic and quantifiers.
detection:
selection:
EventID: 1
filter:
User: 'SYSTEM'
condition: selection and not filterOperator Precedence
| Precedence (highest first) | Operator | Type |
|---|---|---|
| 1 | not | Prefix (unary) |
| 2 | and | Infix (binary), left-associative |
| 3 | or | Infix (binary), left-associative |
a or not b and c parses as a or ((not b) and c).
Use parentheses to override: (a or b) and not c.
Boolean Operators
# AND: all must match
condition: selection1 and selection2
# OR: any must match
condition: selection1 or selection2
# NOT: negate
condition: selection and not filter
# Parentheses: grouping
condition: (selection1 or selection2) and not filter
# Complex
condition: selection_parent and (selection_download or selection_encoded) and not filterNested same-type binary operators are flattened: a and b and c becomes And([a, b, c]), not And(a, And(b, c)).
Quantifiers
Quantifiers aggregate multiple detection identifiers.
| Quantifier | Meaning |
|---|---|
1 of X | At least one of the matched identifiers fires |
any of X | Same as 1 of X |
all of X | All matched identifiers must fire |
N of X | At least N of the matched identifiers fire |
Where X is one of:
- A wildcard pattern:
selection*,filter_* them-- all identifiers except_-prefixed ones
Examples
# At least one selection fires
condition: 1 of selection*
# All selections must fire
condition: all of selection*
# At least 2 of the matched identifiers
condition: 2 of selection*
# Any named identifier (except _-prefixed)
condition: 1 of them
# All identifiers must fire
condition: all of themWildcard Patterns
selection* matches identifiers named selection, selection1, selection_cmd, etc. The * matches any suffix.
them Keyword
them matches all detection identifiers in the block except those starting with _:
detection:
_helper:
ParentImage|endswith: '\services.exe'
selection1:
Image|endswith: '\svchost.exe'
selection2:
Image|endswith: '\lsass.exe'
condition: 1 of themHere 1 of them matches selection1 or selection2 but ignores _helper. Use _-prefixed identifiers for reusable sub-detections that should not be included in quantifier aggregation.
Combining Quantifiers with Boolean Logic
condition: 1 of selection* and not 1 of filter*
condition: all of selection* or keywords
condition: (1 of selection_network* or 1 of selection_process*) and not filterMultiple Conditions
The condition field can be a YAML list, producing independent rule evaluations:
detection:
selection1:
EventID: 1
selection2:
EventID: 4688
condition:
- selection1
- selection2Each condition is evaluated separately, potentially producing multiple matches from a single rule.
Parsing Notes
- Identifiers cannot be Sigma keywords (
and,or,not,of,them,all,any). An identifier likeand_filteris valid because the parser uses lookahead to distinguish keywords from identifier prefixes. - Whitespace between operators and operands is required:
aand bis an identifier, nota and b. - Condition expressions are case-sensitive:
ANDis not recognized as a boolean operator (use lowercaseand).
Correlation Condition Expressions
In temporal correlation rules, the condition is a string referencing rule IDs (not detection identifiers):
correlation:
type: temporal
rules:
- rule-a
- rule-b
condition: "rule-a and rule-b"This uses the same boolean syntax (and, or, not, parentheses) but over rule references instead of detection names.
Correlation Rules Reference
Full reference for all 8 Sigma correlation rule types per the v2.1.0 specification.
Structure
A correlation rule always requires the correlation section:
title: <description>
id: <UUIDv4>
correlation:
type: <correlation_type>
rules:
- <rule-id or wildcard pattern>
group-by:
- <field_name>
timespan: <duration>
condition: <threshold or expression>
generate: <boolean> # optional, default false
level: <level>Required Fields
| Field | Required For | Notes |
|---|---|---|
type | All | One of the 8 correlation types |
rules | All | List of rule IDs or wildcard patterns |
group-by | All | Fields to partition events by |
timespan | All | Sliding window duration |
condition | Non-temporal | Threshold mapping or boolean expression |
condition.field | value_count, value_sum, value_avg, value_percentile, value_median | Which field to aggregate |
Timespan Units
| Unit | Suffix | Example |
|---|---|---|
| Seconds | s | 30s |
| Minutes | m | 5m |
| Hours | h | 1h |
| Days | d | 7d |
| Weeks | w | 1w |
| Months (uppercase) | M | 1M |
| Years | y | 1y |
Both timespan and timeframe are accepted as key names.
Generate Flag
When generate: true, the correlation rule produces an alert even when detecting rules do not individually fire. Used for metric-based correlations where the aggregate threshold is the alert trigger.
---
Count Types
event_count
Count matching events per group key within the time window.
title: Brute Force Login Attempts
correlation:
type: event_count
rules:
- <failed-login-rule-id>
group-by:
- User
- SourceIP
timespan: 5m
condition:
gte: 10
level: highvalue_count
Count distinct values of a specific field per group key.
title: Login From Many Sources
correlation:
type: value_count
rules:
- <login-rule-id>
group-by:
- User
timespan: 10m
condition:
field: SourceIP
gte: 5
level: highThe field key in the condition specifies which field's distinct values to count.
---
Metric Types
value_sum
Sum a numeric field across matching events per group.
title: Large Data Exfiltration
correlation:
type: value_sum
rules:
- <outbound-transfer-rule-id>
group-by:
- SourceIP
timespan: 1h
condition:
field: BytesSent
gte: 1073741824
level: criticalvalue_avg
Average of a numeric field per group.
title: Abnormal Average Request Size
correlation:
type: value_avg
rules:
- <http-request-rule-id>
group-by:
- ClientIP
timespan: 30m
condition:
field: RequestSize
gte: 10000
level: mediumvalue_percentile
Compute a percentile of a numeric field per group.
title: 95th Percentile Response Time
correlation:
type: value_percentile
rules:
- <response-time-rule-id>
group-by:
- ServiceName
timespan: 15m
condition:
field: ResponseTime
gte: 5000
level: mediumvalue_median
Compute the median of a numeric field per group.
title: Median Payload Size Spike
correlation:
type: value_median
rules:
- <payload-rule-id>
group-by:
- DestinationIP
timespan: 1h
condition:
field: PayloadSize
gte: 4096
level: medium---
Temporal Types
temporal
Require multiple detection rules to fire within the same time window for the same group. No ordering requirement.
title: Recon Then Lateral Movement
correlation:
type: temporal
rules:
- <recon-rule-id>
- <lateral-movement-rule-id>
group-by:
- SourceIP
timespan: 15m
condition: "<recon-rule-id> and <lateral-movement-rule-id>"
level: criticalWhen no condition is specified, temporal defaults to {gte: 1} -- at least one match of each referenced rule.
temporal_ordered
Same as temporal, but the rules must fire in the order they appear in the condition expression.
title: Credential Dump Then Exfiltration
correlation:
type: temporal_ordered
rules:
- <credential-dump-rule-id>
- <exfiltration-rule-id>
group-by:
- User
timespan: 30m
condition: "<credential-dump-rule-id> and <exfiltration-rule-id>"
level: critical---
Condition Operators
For threshold-style conditions (count and metric types):
| Operator | Meaning |
|---|---|
gt | Greater than |
gte | Greater than or equal |
lt | Less than |
lte | Less than or equal |
eq | Equal |
neq | Not equal |
Multiple operators can be combined in a single condition:
condition:
gt: 10
lte: 100All operator values must be numeric.
---
Multi-Document Pattern
Detection and correlation rules are commonly paired in the same file using --- separators:
title: Failed SSH Login
id: ssh-failed-login
logsource:
category: authentication
product: linux
detection:
selection:
EventType: ssh_failed
condition: selection
level: low
---
title: SSH Brute Force
id: ssh-brute-force
correlation:
type: event_count
rules:
- ssh-failed-login
group-by:
- User
- SourceIP
timespan: 5m
condition:
gte: 10
level: criticalUse action: global to share logsource when the detection and correlation share the same platform:
action: global
logsource:
product: windows
category: process_creation
level: medium
---
title: Detect Cmd Execution
id: detect-cmd
detection:
selection:
CommandLine|contains: 'cmd'
condition: selection
---
action: repeat
title: Detect PowerShell Execution
id: detect-ps
detection:
selection:
CommandLine|contains: 'powershell'
condition: selection
---
title: Recon Burst
correlation:
type: event_count
rules:
- detect-cmd
- detect-ps
group-by:
- User
timespan: 60s
condition:
gte: 3
level: highRule References with Wildcards
The rules field supports wildcard patterns to match multiple rule IDs:
correlation:
rules:
- "recon-*" # matches recon-cmd, recon-ps, etc.Detection Rules Reference
Full reference for Sigma detection rules per the v2.1.0 specification.
Metadata Fields
| Field | Required | Format | Notes |
|---|---|---|---|
title | Yes | String, max 256 chars | Concise description of what is detected |
id | Recommended | UUIDv4 (8-4-4-4-12 hex) | Stable identifier; never reuse |
status | Recommended | Enum | stable, test, experimental, deprecated, unsupported |
description | Recommended | String | What the rule detects, why it matters |
author | Recommended | String | Comma-separated names |
date | Recommended | YYYY-MM-DD | Day-of-month must be valid |
modified | Optional | YYYY-MM-DD | Must be >= date |
references | Optional | List of URLs | Sources, blog posts, documentation |
tags | Optional | List of strings | Format: namespace.value (see Tags below) |
level | Recommended | Enum | informational, low, medium, high, critical |
falsepositives | Optional | List of strings | Known FP scenarios (min 2 chars each) |
related | Optional | List of mappings | Cross-references to other rules |
scope | Optional | List of strings | Scoping information |
name | Optional | String, max 256 chars | Machine-readable name |
Related Field
related:
- id: <UUIDv4>
type: derived # derived | obsolete | merged | renamed | similarRules with status: deprecated should have at least one related entry.
Logsource
At least one of category, product, or service is required. All values must be lowercase.
logsource:
category: process_creation # what kind of event
product: windows # which platform/product
service: sysmon # specific log source
definition: > # optional free-text for readers
Requires Sysmon with process creation logging enabledcategory describes the event type (e.g. process_creation, file_event, network_connection, authentication). product is the platform (e.g. windows, linux, macos, aws, azure). service narrows to a specific log source within the product.
Custom fields are allowed per the spec but may not be portable.
Detection Block
Parsing Rules
| YAML Structure | Interpretation |
|---|---|
Mapping (key: value pairs) | AllOf -- all field conditions AND-linked |
| List of mappings | AnyOf -- each mapping OR-linked |
| List of plain values | Keywords -- field-agnostic search across all fields |
Multiple Values for a Field
A list of values is OR-linked by default:
selection:
EventID:
- 1
- 4688Add |all to AND-link values:
selection:
CommandLine|contains|all:
- 'delete'
- 'shadows'Multiple Conditions
The condition field can be a list, producing independent rule evaluations:
condition:
- selection1
- selection2Underscore-Prefixed Identifiers
Identifiers starting with _ are excluded from them and bare all of / 1 of quantifiers. Use them for helper or reusable sub-detections.
Value Types
| Type | Example | Notes |
|---|---|---|
| String | 'whoami' or whoami | Wildcards: * (multi), ? (single) |
| Integer | 4688 | Numeric matching |
| Float | 3.14 | Numeric matching |
| Boolean | true / false | Used with exists modifier |
| Null | null | Matches field absence |
Wildcard Escaping
| Input | Parsed As |
|---|---|
\* | Literal * (not a wildcard) |
\? | Literal ? |
\\ | Literal \ |
\W | Literal \W (both chars kept) |
Backslash only escapes *, ?, and \. This preserves Windows paths like C:\Windows\System32.
Tags
Format: namespace.value matching ^[a-z0-9_-]+\.[a-z0-9._-]+$.
| Namespace | Purpose | Example |
|---|---|---|
attack | MITRE ATT&CK | attack.execution, attack.t1059.001 |
car | MITRE CAR | car.2019-04-001 |
cve | CVE identifiers | cve.2021-44228 |
d3fend | MITRE D3FEND | d3fend.d3-psep |
detection | Detection metadata | detection.dfir |
stp | Sigma Taxonomy Project | stp.1a |
tlp | Traffic Light Protocol | tlp.white |
No duplicate tags allowed.
Multi-Document YAML
Separate documents with ---. Collection actions control template merging:
action: global
Stores the document as a template that merges into all subsequent rules. The action key itself is removed. No rule is produced.
action: global
logsource:
product: windows
category: process_creation
level: medium
---
title: Detect Cmd
detection:
selection:
CommandLine|contains: 'cmd'
condition: selection
---
title: Detect Powershell
detection:
selection:
CommandLine|contains: 'powershell'
condition: selectionBoth rules inherit logsource and level from the global template.
action: reset
Clears the current global template. No rule is produced.
action: repeat
Clones the previous document, deep-merges the current document on top, then applies the global template. Useful for rules that differ only slightly.
action: global
logsource:
product: windows
---
title: Detect Cmd
id: detect-cmd
detection:
selection:
CommandLine|contains: 'cmd'
condition: selection
---
action: repeat
title: Detect Powershell
id: detect-ps
detection:
selection:
CommandLine|contains: 'powershell'
condition: selectionMerge Order
- Normal documents:
merged = deep_merge(global, document) - Repeat documents:
merged = deep_merge(global, deep_merge(previous, repeat_doc))
deep_merge is recursive: source mappings override destination keys; non-mapping source replaces destination entirely.
Complete Real-World Example
title: Suspicious PowerShell Download Cradle
id: 3b6ab547-0998-4d6b-8e34-f1e7016c37a2
status: test
description: >
Detects PowerShell download cradles using common cmdlets
and .NET classes to fetch remote payloads.
author: Security Operations
date: 2025-03-01
modified: 2025-06-15
references:
- https://attack.mitre.org/techniques/T1059/001/
- https://attack.mitre.org/techniques/T1105/
tags:
- attack.execution
- attack.t1059.001
- attack.command_and_control
- attack.t1105
logsource:
category: process_creation
product: windows
detection:
selection_parent:
ParentImage|endswith:
- '\powershell.exe'
- '\pwsh.exe'
selection_download:
CommandLine|contains:
- 'Invoke-WebRequest'
- 'IWR '
- 'wget '
- 'curl '
- 'Net.WebClient'
- 'DownloadString'
- 'DownloadFile'
- 'Invoke-RestMethod'
- 'Start-BitsTransfer'
selection_encoded:
CommandLine|contains:
- '-enc '
- '-EncodedCommand'
CommandLine|re: '(http|ftp)s?://'
condition: selection_parent and (selection_download or selection_encoded)
falsepositives:
- Legitimate admin scripts that download tools
- Software deployment systems
level: highFilter Rules Reference
Full reference for Sigma filter rules per the v2.1.0 specification. Filters inject AND NOT exclusion conditions into referenced detection rules, enabling centralized tuning without modifying original rule files.
Structure
title: <what is being filtered out>
description: <optional explanation>
author: <name>
logsource:
category: <should match target rule>
product: <should match target rule>
filter:
rules:
- <target-rule-id>
selection:
<FieldName|modifier>: <value>
condition: selectionRequired Fields
All three of rules, selection (at least one named detection), and condition must be inside the filter section.
| Field | Required | Notes |
|---|---|---|
filter | Yes | The filter section (must be a mapping) |
filter.rules | Yes | List of target rule IDs |
filter.selection | Yes | At least one named detection identifier |
filter.condition | Yes | Condition expression referencing the detections |
logsource | Recommended | Should match target rules for proper scoping |
title | Yes | Describes what is being filtered |
Fields That Should NOT Be Present
| Field | Why |
|---|---|
level | Filters don't have their own severity |
status | Filters don't have lifecycle status |
Global vs Targeted Filters
Targeted Filter
References specific rule IDs. The filter only applies to those rules:
title: Exclude Admin Users from Brute Force Detection
logsource:
category: authentication
product: windows
filter:
rules:
- d4c9a825-fdb3-472e-9b0e-fa4709aba44c
selection:
User|startswith: 'adm_'
condition: selectionGlobal Filter
An empty rules list applies the filter to all rules with a matching logsource:
title: Exclude Test Environment Events
logsource:
product: windows
filter:
rules: []
selection:
Environment: test
condition: selectionMultiple Filters on the Same Rule
Multiple filters can reference the same detection rule. Each filter operates independently -- detection identifier names (like selection) in different filters do not collide.
title: Rule A
id: rule-a
logsource:
product: windows
detection:
sel:
EventID: 1
condition: sel
---
title: Filter Out Test Environment
filter:
rules:
- rule-a
selection:
Environment: test
condition: selection
---
title: Filter Out Service Accounts
filter:
rules:
- rule-a
selection:
User|startswith: 'svc_'
condition: selectionBoth filters use selection as their detection name without conflict. The resulting logic for rule-a becomes:
sel AND NOT (test-env-filter.selection) AND NOT (svc-filter.selection)Complex Filter Conditions
Filter detections support the same syntax as regular detection blocks -- multiple identifiers and boolean conditions:
title: Exclude Known Good Processes on DC
logsource:
category: process_creation
product: windows
filter:
rules:
- <target-rule-id>
svchost:
Image|endswith: '\svchost.exe'
ParentImage|endswith: '\services.exe'
lsass:
Image|endswith: '\lsass.exe'
ParentImage|endswith: '\wininit.exe'
dc_env:
ComputerName|startswith: 'DC-'
condition: (svchost or lsass) and dc_envCombined: Global + Targeted
When both global and targeted filters exist, all applicable filters are applied. The order of filter application does not affect the result (they are all AND NOT):
title: Base Rule
id: base-rule
logsource:
product: windows
detection:
sel:
EventID: 1
condition: sel
---
title: Global Filter -- Test Env
filter:
rules: []
env_match:
Environment: test
condition: env_match
---
title: Targeted Filter -- Svc Account
filter:
rules:
- base-rule
svc_match:
User: svc_account
condition: svc_matchResult for base-rule: sel AND NOT env_match AND NOT svc_match
Field Modifiers Reference
Full reference for all 30 Sigma field modifiers per the v2.1.0 specification. Modifiers are chained on the field name with | separators.
Syntax
FieldName|modifier1|modifier2: valueModifiers are applied left-to-right. Some modifiers transform the value, others change matching behavior.
Modifier Categories
String Matching
| Modifier | Effect | Example |
|---|---|---|
contains | Substring match (wraps value in *...*) | `CommandLine\ |
startswith | Prefix match (appends *) | `Image\ |
endswith | Suffix match (prepends *) | `Image\ |
These are mutually exclusive -- do not combine them with each other.
Value Linking
| Modifier | Effect | Example |
|---|---|---|
all | AND-link all values (default is OR) | `CommandLine\ |
Without all, a list of values means "match any one." With all, all values must match.
Do not use all with a single value (redundant). Do not combine all with re.
Encoding
| Modifier | Alias | Effect |
|---|---|---|
base64 | Match base64-encoded form of the value | |
base64offset | Match base64 at any of the 3 encoding offsets | |
wide | utf16le | Match UTF-16LE encoded form |
utf16be | Match UTF-16BE encoded form | |
utf16 | Match both UTF-16LE and UTF-16BE |
Encoding modifiers can be chained: FieldName|wide|base64offset: 'payload'
Pattern Matching
| Modifier | Effect | Notes |
|---|---|---|
re | Value is a regular expression | Disables wildcard parsing (*, ? are literal) |
cidr | CIDR network range match | Value must be CIDR notation: 10.0.0.0/8 |
When re is present, the value is treated as a raw regex string. Backslash sequences are not interpreted as Sigma wildcards.
Case Sensitivity
| Modifier | Effect |
|---|---|
cased | Case-sensitive match (default is case-insensitive) |
Field Existence
| Modifier | Effect | Values |
|---|---|---|
exists | Check whether the field exists | true (must exist) or false (must not exist) |
A lone * wildcard value is equivalent to exists: true. Prefer the explicit form.
Placeholder
| Modifier | Effect |
|---|---|
expand | Mark value as a placeholder for pipeline expansion |
Field Reference
| Modifier | Effect |
|---|---|
fieldref | Value is a field name, not a literal. Matches when the referenced field's value equals this field's value |
Numeric Comparison
| Modifier | Effect |
|---|---|
gt | Greater than |
gte | Greater than or equal |
lt | Less than |
lte | Less than or equal |
neq | Not equal |
Do not combine numeric modifiers with string matching modifiers (contains, startswith, endswith).
Regex Flags
| Modifier | Alias | Effect |
|---|---|---|
i | ignorecase | Case-insensitive regex |
m | multiline | Multiline mode (^/$ match line boundaries) |
s | dotall | Dot matches newline |
Regex flags require the re modifier to be present.
Timestamp Parts
| Modifier | Effect |
|---|---|
minute | Match the minute component of a timestamp field |
hour | Match the hour component |
day | Match the day-of-month component |
week | Match the week number |
month | Match the month component |
year | Match the year component |
These were introduced in v2.1.0 and allow time-based filtering on timestamp fields.
---
Incompatible Modifier Combinations
The following combinations are invalid:
| Combination | Why |
|---|---|
| `contains\ | startswith` |
| `contains\ | endswith` |
| `startswith\ | endswith` |
| `re\ | contains` |
| `re\ | startswith` |
| `re\ | endswith` |
| `gt\ | contains` (and other numeric + string) |
i without re | Regex flag needs regex modifier |
m without re | Regex flag needs regex modifier |
s without re | Regex flag needs regex modifier |
| `all\ | re` |
Modifier Chaining Examples
# Substring match, all values must be present (AND)
CommandLine|contains|all:
- 'net'
- 'user'
- '/add'
# Case-insensitive regex
CommandLine|re|i: 'invoke-(expression|command)'
# Base64-encoded wide string at any offset
CommandLine|wide|base64offset: 'http://evil.com'
# Windash: matches both -exec and /exec
CommandLine|windash|contains: '-exec'
# Field existence check
TargetFilename|exists: true
# Numeric comparison
EventID|gte: 4688
# Field reference: match events where SourceIP equals DestinationIP
SourceIP|fieldref: DestinationIP
# Timestamp-based detection
Timestamp|hour|gte: 22Common Patterns
OR Values (default)
selection:
Image|endswith:
- '\cmd.exe'
- '\powershell.exe'
- '\pwsh.exe'Matches if Image ends with any of the three values.
AND Values (with all)
selection:
CommandLine|contains|all:
- 'net'
- 'localgroup'
- 'administrators'Matches only if CommandLine contains all three strings.
Negation via Condition (not a modifier)
Negation is handled in the condition expression, not via modifiers:
detection:
selection:
EventID: 1
filter:
User: 'SYSTEM'
condition: selection and not filterProcessing Pipelines Reference
Full reference for Sigma processing pipelines. Pipelines transform Sigma rule ASTs before evaluation or backend conversion -- typically for field name mapping between generic Sigma fields and backend-specific schemas.
Pipeline Structure
name: <pipeline name>
priority: <integer> # lower runs first, default 0
vars: # variables for %name% placeholder expansion
var_name: <string or list>
transformations: # ordered list of transformation items
- id: <optional string> # for processing_item_applied conditions
type: <transformation_type>
# ... type-specific parameters
rule_conditions: [] # optional: all must match for transform to apply
rule_cond_expression: "" # optional: logical expression over conditions
detection_item_conditions: []
field_name_conditions: []
field_name_cond_not: false # negate field name conditions
finalizers: # for query backends (not used in eval mode)
- type: <concat|json|template>Multiple pipelines are sorted by priority (ascending) and applied in order.
---
Transformation Types (26)
Field Transformations
| Type | Parameters | Effect |
|---|---|---|
field_name_mapping | mapping: {old: new} | Rename specific fields |
field_name_prefix_mapping | mapping: {prefix: replacement} | Replace field name prefixes |
field_name_prefix | prefix: string | Add prefix to all field names |
field_name_suffix | suffix: string | Add suffix to all field names |
field_name_transform | `transform_func: lower\ | upper\ |
add_field | field: string | Add a field to detection items |
remove_field | field: string | Remove a field from detection items |
set_field | fields: [list] | Set detection item fields |
Value Transformations
| Type | Parameters | Effect |
|---|---|---|
replace_string | regex, replacement, skip_special: bool | Regex replacement in values |
map_string | mapping: {val: [alternatives]} | Map values to alternatives |
set_value | value: any | Set detection item value |
convert_type | `target_type: str\ | int\ |
regex | (none) | Convert plain strings to regex |
case_transformation | `case_type: lower\ | upper\ |
hashes_fields | valid_hash_algos: [list], field_prefix, drop_algo_prefix: bool | Normalize hash field names |
Detection Structure Transformations
| Type | Parameters | Effect |
|---|---|---|
drop_detection_item | (none) | Remove matching detection items |
add_condition | conditions: {field: value}, negated: bool | Inject extra field conditions |
change_logsource | category, product, service | Rewrite logsource fields |
Placeholder Transformations
| Type | Parameters | Effect |
|---|---|---|
value_placeholders | (none) | Expand %name% from pipeline vars |
wildcard_placeholders | (none) | Replace unresolved %name% with * |
query_expression_placeholders | expression: string | Backend query expression (no-op for eval) |
State and Control Transformations
| Type | Parameters | Effect |
|---|---|---|
set_state | key, value | Store key-value in pipeline state |
set_custom_attribute | attribute, value | Set custom attribute on the rule |
rule_failure | message | Fail the rule with message |
detection_item_failure | message | Fail a detection item with message |
nest | items or transformations: [list] | Group transformations |
---
Condition Types
Transformations are gated by conditions. All conditions in a list are AND-linked by default. Use rule_cond_expression for custom logic.
Rule Conditions (rule_conditions)
Applied at the rule level -- the transformation only runs if the rule matches.
| Type | Parameters | Matches When |
|---|---|---|
logsource | category, product, service | Rule logsource matches (omitted fields match any) |
contains_detection_item | field, value (optional) | Rule has detection with that field (and value) |
processing_item_applied | processing_item_id | An earlier transform with that id was applied |
processing_state | key, val | Pipeline state key equals value |
is_sigma_rule | (none) | Document is a detection rule |
is_sigma_correlation_rule | (none) | Document is a correlation rule |
rule_attribute | attribute, value | Rule metadata matches (level, status, author, title, id, date, description) |
tag | tag | Rule has this tag |
Detection Item Conditions (detection_item_conditions)
Applied per detection item within a rule.
| Type | Parameters | Matches When |
|---|---|---|
match_string | pattern, negate | Value matches regex pattern |
is_null | negate | Value is null |
processing_item_applied | processing_item_id | Transform was applied to this item |
processing_state | key, val | Pipeline state matches |
Field Name Conditions (field_name_conditions)
Applied per field name. Use field_name_cond_not: true to negate.
| Type | Parameters | Matches When |
|---|---|---|
include_fields | fields: [list], `match_type: plain\ | regex` |
exclude_fields | fields: [list], `match_type: plain\ | regex` |
processing_item_applied | processing_item_id | Transform was applied |
processing_state | key, val | Pipeline state matches |
Rule Condition Expression
Override the default AND behavior with rule_cond_expression:
rule_conditions:
- type: logsource
product: windows
- type: tag
tag: attack.execution
rule_cond_expression: "cond_0 and not cond_1"Conditions are referenced as cond_0, cond_1, ... by index. Supports and, or, not, and parentheses.
---
Common Pipeline Patterns
ECS Field Mapping
name: Elastic Common Schema
priority: 10
transformations:
- type: field_name_mapping
mapping:
CommandLine: process.command_line
Image: process.executable
ParentImage: process.parent.executable
User: user.name
SourceIP: source.ip
DestinationIP: destination.ip
DestinationPort: destination.port
rule_conditions:
- type: logsource
product: windowsConditional Transform with State
name: Stateful Pipeline
transformations:
- id: windows-mapped
type: field_name_mapping
mapping:
CommandLine: process.command_line
rule_conditions:
- type: logsource
product: windows
- type: field_name_prefix
prefix: "winlog."
rule_conditions:
- type: processing_item_applied
processing_item_id: windows-mappedDrop Unsupported Detection Items
name: Drop Unsupported
transformations:
- type: drop_detection_item
field_name_conditions:
- type: include_fields
fields:
- Imphash
- md5
match_type: plainPlaceholder Expansion
name: Placeholder Resolution
vars:
admin_users:
- Administrator
- Domain Admins
- Enterprise Admins
transformations:
- type: value_placeholders
- type: wildcard_placeholdersLogsource Rewrite
name: Splunk Logsource
transformations:
- type: change_logsource
category: endpoint
product: splunk
rule_conditions:
- type: logsource
product: windows
category: process_creationCustom Attributes
name: Engine Config
transformations:
- type: set_custom_attribute
attribute: rsigma.timestamp_field
value: event.ingested
- type: set_custom_attribute
attribute: rsigma.suppress
value: 5m---
Finalizers
Finalizers produce final query output. They are parsed from the pipeline YAML but not used in evaluation mode (only relevant for query backends).
| Type | Parameters | Effect |
|---|---|---|
concat | separator, prefix, suffix | Concatenate query parts |
json | indent | Output as JSON |
template | template | Apply a template string |