HackBlue

Tools · SIEM and detection engineering · 13 / 24

The detection engineering lifecycle: from idea to tested, tuned, and retired rules

Follow a detection from a threat idea through data checks, rule writing, testing, deployment, tuning, and review, and learn what to document at each step.

10 min read · practice only with authorization

Stages

A detection starts as a requirement: a technique you need to see, a gap from an incident, or a new threat report. Next, confirm the data exists: which log source, which fields, and whether they are actually collected everywhere. Then write the logic, test it against both malicious examples and normal history, deploy it with a runbook, and watch its alert volume and true positive rate. Finally, review it periodically and retire it when the data or the threat changes.

Skipping the data check is the most common failure: a rule written for command-line arguments is useless where process command lines are not logged.

What to document

Each rule should record its purpose, ATT&CK technique, data sources and required fields, the logic in plain words, known false positives, test cases, severity, owner, and the response steps. This turns a query into something a teammate can maintain.

  • Purpose and threat
  • Data source and fields
  • Logic in plain language
  • Known false positives
  • Test evidence
  • Owner, severity, runbook link

Lab: write one detection card

Choose a behavior such as a new local administrator being added on a workstation. Write the card first, before any query: purpose, technique T1098 or T1136, data source Windows Security 4732 for the Administrators group, fields needed, expected false positives such as IT onboarding scripts, and a response step. Then write the query in your SIEM lab, generate a test event by adding a test user to the group in a VM, and attach the result as test evidence.

Snippet
# generate a benign test event in a lab VM (elevated PowerShell)
New-LocalUser -Name labtest -NoPassword
Add-LocalGroupMember -Group Administrators -Member labtest
Remove-LocalGroupMember -Group Administrators -Member labtest
Remove-LocalUser -Name labtest

Measuring health

Track alerts per week, the share closed as true positive, mean time to triage, and whether the rule fired during exercises. A rule that never fires may be broken; a rule that fires constantly and is always closed as benign is training analysts to ignore it.

Diagram

Detection lifecycle

  1. Requirement

    Technique, gap, or threat report.

  2. Data check

    Confirm the log source and fields exist everywhere it matters.

  3. Build and test

    Write logic; test with lab events and historical data.

  4. Deploy and tune

    Ship with a runbook; tune from analyst feedback.

  5. Review or retire

    Revisit on a schedule; retire when obsolete.

Check yourself

1. Which step is most often skipped and leads to useless rules?

2. Which item belongs in a detection’s documentation?

3. A rule has not fired in a year, including during exercises. What should you suspect?