Detection engineering: writing, testing and mapping detections
In short: Detection engineering treats alert rules as software: each one starts from a clear hypothesis, is tested against real or simulated activity, and is tuned over time. Mapping rules to MITRE ATT&CK shows coverage gaps, and Sigma lets you write once and convert to many SIEMs.
What detection engineering is
Detection engineering is the discipline of building and maintaining the rules that turn logs into alerts. In immature SOCs, rules are switched on from vendor packs and never reviewed. In mature ones, every rule has an owner, a purpose, a test and a record of how well it performs. This approach is often called detection as code: rules live in version control, changes are reviewed, and deployment is automated.
Writing a good detection
Start with a hypothesis about attacker behaviour, not a single indicator. "Attackers dump credentials from LSASS memory" is a better starting point than "block this one hash", because it still works when the tool changes. Then ask which data source shows that behaviour (for example Sysmon process access events or EDR telemetry) and whether you actually collect it.
Good detections are:
- Specific enough to avoid drowning analysts, but not so narrow that a renamed tool slips past.
- Explained: each has a short runbook saying why it matters and how to triage it.
- Tested: you have proved it fires on the behaviour and noted known false positives.
Sigma: a common rule language
Sigma is an open, YAML-based format for describing log detections independently of any SIEM. Converters such as the pySigma-based sigma-cli translate a rule into Splunk, KQL, Elastic and other query languages. A simplified example that flags an office application starting PowerShell:
title: Office application spawning PowerShell
status: experimental
logsource:
product: windows
category: process_creation
detection:
selection:
ParentImage|endswith:
- '\winword.exe'
- '\excel.exe'
Image|endswith: '\powershell.exe'
condition: selection
falsepositives:
- Approved macros used by finance
level: high
tags:
- attack.execution
- attack.t1059.001
The tags link the rule to MITRE ATT&CK technique T1059.001 (PowerShell). Public repositories hold thousands of community Sigma rules, which are a useful starting point, but always test and tune them for your environment.
Testing, mapping and measuring
- Reproduce the behaviour safely in an isolated lab you own. Open frameworks such as Atomic Red Team provide small, documented tests mapped to ATT&CK techniques.
- Confirm the logs arrive and the rule fires; save the test as a regression check.
- Run the rule over several weeks of historical data to estimate false positives before going live.
- Map each rule to ATT&CK techniques and keep a coverage view; tools such as ATT&CK Navigator can colour in what you detect.
- Track each rule's alert count and true positive rate, and retire or fix rules that only create noise.
Tip: coverage maps can mislead. One weak rule against a technique does not mean the technique is "covered"; record confidence too.
Practice
Why is "detect credential dumping from LSASS" a better hypothesis than "detect hash X"?
What does a Sigma converter do?
How can you estimate a rule's false positive rate before deploying it?
Key takeaways
- Treat detections as code: version control, review, testing and owners.
- Start from attacker behaviour, then confirm you collect the right data.
- Sigma is a vendor-neutral YAML rule format that converts to many SIEMs.
- Test rules safely in a lab and map them to MITRE ATT&CK.
- Measure rule performance and retire noisy detections.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.