Kernel of Truth

Detection Engineering 101

🛠️ Detection Engineering 101

Detection engineering is the process of designing, implementing, testing, and refining alerts that identify malicious or risky activity in your environment. It bridges the gap between threat intel, attacker TTPs, and real-time security monitoring.

🎯 “Good detection starts with knowing what you want to catch—and how attackers will try to hide it.”


🎓 What Is Detection Engineering?

Detection engineering involves:

  • Creating rules and logic for SIEMs, EDRs, and SOARs
  • Mapping detections to MITRE ATT&CK tactics and techniques
  • Validating detections with threat simulations and test data
  • Tuning and suppressing false positives
  • Converting threat intelligence into actionable detections

🧱 Key Components of Detection Engineering

ComponentDescription
Data SourcesLogs from endpoints, firewalls, cloud, DNS, etc.
Normal BaselineWhat’s expected behaviour for users/systems?
Detection LogicRule-based queries, thresholds, anomaly models
ValidationSimulated attacks, threat emulation, red team
Alert QualityLow false positives, high confidence, actionable
Coverage MappingUse MITRE ATT&CK to track what you detect

🧪 Detection Lifecycle

  1. Hypothesis – “What if an attacker was using PowerShell to exfil data?”
  2. Log Availability – Ensure you’re collecting relevant logs (Sysmon, EDR, proxy, etc.)
  3. Rule Creation – Build logic using SPL, KQL, Sigma, or EQL
  4. Validation – Run emulated activity (e.g. Caldera, Atomic Red Team)
  5. Tuning – Eliminate noise; create suppression logic or thresholds
  6. Deployment – Push to SIEM/EDR with alert metadata
  7. Monitoring & Feedback – SOC analysts triage and tune based on response

⚙️ Tools of the Trade

ToolUse
SigmaWrite generic detection rules for SIEMs
Splunk / Sentinel / ElasticImplement and test detection rules
Atomic Red TeamRun small-scale attacker simulations
Caldera / PreludeAdversary emulation and validation
MITRE ATT&CK NavigatorVisualise detection coverage
YARAFile/memory pattern detection (esp. for malware)
Kibana / GrafanaVisualise detection hits and patterns

🔍 Detection Rule Example (Sigma)

yamlCopyEdittitle: Suspicious Encoded PowerShell Command
logsource:
  product: windows
  service: security
detection:
  selection:
    EventID: 4104
    ScriptBlockText|contains: '-enc'
  condition: selection
level: high
tags:
  - attack.execution
  - attack.t1059.001

This Sigma rule looks for PowerShell encoded commands, commonly used in obfuscated attacks.


🧠 Best Practices

  • ✅ Start with high-confidence, low-noise detections
  • ✅ Use MITRE ATT&CK as your detection blueprint
  • ✅ Validate each detection with test data before deploying
  • ✅ Track your detection coverage like a product roadmap
  • ✅ Involve SOC analysts in tuning and feedback loops
  • ✅ Document each detection’s purpose, logic, coverage, and limitations

📊 Detection Engineering Metrics

MetricWhy It Matters
True Positive RateHigh = detection works as intended
False Positive RateLow = fewer wasted analyst hours
Detection-to-Response TimeHelps measure effectiveness
Coverage GapsPrioritise missing tactics/techniques
Detection DecayIdentify rules that no longer trigger or are outdated

✅ Summary

Detection engineering turns logs into insight and insight into action. By aligning detection efforts with real-world threats, security teams can reduce attacker dwell time and catch threats earlier in the kill chain.

🧩 “It’s not about having alerts—it’s about having the right ones.”