Detection engineering (the work of designing, testing and improving detection rules like software development) means making the rules that alert on suspicious behavior in logs (records the system creates by itself) reliable and owned. A rule written off the cuff tends to alert so often that the team stops paying attention, or stays silent and misses real incidents. This article summarizes how to write rules that work in practice, based on public material from MITRE and the Sigma project.
Start from attacker behavior
MITRE ATT&CK (a knowledge base of attacker methods collected from real incidents) lets rules be written from behavior instead of from malware names or IP addresses that attackers can change easily. The latest version on MITRE's versions page, as we opened it, is v20.1, released on 13 October 2026. Each rule should say which technique (one attack method in ATT&CK) it detects.
MITRE CAR (the Cyber Analytics Repository, a library of example detections mapped to ATT&CK) shows what a good detection example should contain. According to the CAR web page, each entry has a hypothesis, the information domain it uses, ATT&CK technique references, pseudocode (a sketch of the logic that is not tied to any tool) and a unit test (a way to check that the rule really fires). The page gives no last-updated date. Our view is to use it as a model for structure, not to deploy entries without testing. An overview of ATT&CK for executives is in MITRE ATT&CK for executives: how to read and use it.
What one working rule contains
Sigma is an open, product-neutral format for writing log-based detection rules. It is written in YAML (a human-readable text file format) and converted into the query language of each SIEM (a system that collects and analyzes logs from many sources). According to the SigmaHQ page on GitHub and the Sigma rule documentation, the required fields are title, logsource (the log source the rule uses) and detection (the detection condition), while falsepositives (cases likely to alert wrongly) and level (severity) are optional fields that are worth always filling in.
This list is our view of what one rule should contain, whether or not Sigma is used:
- Hypothesis: one sentence on what the attacker does and what trace it leaves in the logs
- Required log source: if that log is not collected, the rule cannot detect; see Log management: what to log and for how long
- A specific condition: narrow the behavior, for example do not alert on every use of PowerShell (the Windows scripting shell) but only on unusual patterns of use
- Known false alerts: note what is normal yet makes the rule fire, and how it will be excluded
- Severity and first step: tell the analyst what to check first when the rule alerts
- Owner and review date: every rule has a person responsible and a date to be checked again
Too broad
- Alert on every PowerShell useconstant false alerts; team ignores them
- No ownernobody tunes or retires it
- Never testedunknown if it really detects
Specific and usable
- Names the unusual patternclear hypothesis and condition
- Narrow, documented exclusionsnamed accounts or machines
- Tested and reviewedhas an owner and review date
Test and tune before going live
A rule that has never been tested is a hypothesis, not a detection. Test two sides. First, the rule must alert when the behavior really happens, by simulating the behavior on a test machine or replaying recorded logs. Second, the rule must not alert wrongly too often on normal use. Run the rule in silent mode, meaning it records results but does not yet reach analysts, for a period, then tune it before going live. Our view is that a new rule should not go straight into the live alert queue without this step.
- Keep exclusions narrow: exclude only named accounts or machines, not so broadly that the rule loses its meaning
- Record why each exclusion exists: so reviewers know the reason and can remove it when no longer needed
- Use real outcomes: each time a rule alerts, have the analyst record whether it was a real incident or a false alert, and feed that back into the rule
- Do not score by technique count: covering many ATT&CK techniques does not mean each rule works
Keep the rule set as files in a system that records edit history such as Git (version control), so it is clear who changed what and when, and changes can be rolled back. This approach is called detection-as-code (managing detection rules like code); it is an industry practice, not a standard. For choosing whether rules should run on a SIEM, XDR (detection and response that combines several data sources such as endpoints and network) or another tool, read SIEM + SOAR vs XDR: strengths, limits and recommendations, and for manual hunting to find gaps in the rules, see Threat hunting: how to get started.
Where to start
- Pick three behaviors: choose three ATT&CK techniques that match the organization's risks; no need to start with all of them
- Check log sources: confirm the needed logs really reach the SIEM
- Write to a template: use a Sigma or CAR style structure with hypothesis, condition, false alerts and owner all filled in
- Run silent first: test and tune before reaching analysts, then review the results on a cycle
If you are not sure how far detection coverage extends, try the self-assessment to choose the gaps to close first.