Use this when writing a single detection rule with logic, data source, ATT&CK mapping and response.
Detection Rule
A detection rule is logic that searches telemetry for a specific suspicious condition and raises an alert, with a description, severity, MITRE ATT&CK mapping, data source and tested response steps.
1. A detection rule needs logic, data source, severity, ATT&CK mapping, triage guide, test.
2. Keep logic readable.
3. Test positives and negatives.
4. Version control.
5. Document false positives.
data → rule → alert with guidance
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Rules without test data or owner.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Document purpose, data source, logic and response.
- Map the rule to MITRE ATT&CK.
- Test before deploying.
- Rule metadata: ATT&CK ID, data source, severity, triage steps — quality
sigma check <rule.yml>— validate Sigma- Unit test with sample events — expected hit
ReferenceWhy it matters1 section · depth on demand
Anatomy of a good rule
| Part | Example |
|---|---|
| Name and description | "LSASS memory access by non-system process" |
| Data source | Sysmon event 10 / EDR process access |
| Logic | TargetImage ends with lsass.exe and GrantedAccess includes 0x10 |
| Severity and ATT&CK mapping | High, T1003.001 |
| Exclusions | Known security and backup tools |
| Response steps | Isolate host, collect memory, reset credentials |
Write rules in a portable format (Sigma) where possible, test them against real attack simulations (Atomic Red Team) and track false-positive rates.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
A detection rule defines conditions in telemetry that indicate malicious or suspicious activity, producing an alert when matched. Good rules target attacker behaviour, are tested, documented and maintained like code.
Rule anatomy:
| Part | Example |
|---|---|
| Data source | Windows process creation (Sysmon 1 / 4688) |
| Logic | Office application spawning PowerShell with encoded command |
| Severity and confidence | High / medium |
| ATT&CK mapping | T1059.001 |
| False positives | Known add-ins |
| Response | Isolate host if confirmed |
Write rules in a portable format (Sigma) where possible, store them in Git, test them against sample data in CI, and track their performance.
ReferenceConfiguration & state1 section · depth on demand
Example (Sigma)
title: Suspicious Encoded PowerShell
logsource: { product: windows, category: process_creation }
detection:
selection:
Image|endswith: '\powershell.exe'
CommandLine|contains: [' -enc ', ' -EncodedCommand ']
condition: selection
falsepositives: [ 'Some management tools' ]
level: medium
tags: [ attack.execution, attack.t1059.001 ]
Documented example, not captured output.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Detection Engineering → Detection Rule. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://sigmahq.io/docs/basics/rules.html · confidence 94%