Detection Engineering: From Hypothesis to Alert
Design useful security detections by starting with behaviour, telemetry coverage, test cases and measurable alert quality.
Educational reference drafted for the Nullwire archive. This is not a claim of completed training or original research; verify examples and customise before presenting it as finished work.
Objective
Build a detection that answers a clear security question rather than producing alerts for every unusual event.
Begin with a hypothesis
Example: A service account executing an unexpected interactive shell may merit investigation.
This is a hypothesis, not a universal sign of compromise. Some maintenance workflows legitimately spawn shells, and not every endpoint produces the same telemetry.
Detection design workflow
- Behaviour: Define what you want to observe.
- Data source: Identify the events required — process creation, user context or network connections.
- Logic: Specify conditions and exclusions.
- Validation: Test on synthetic or authorised lab events.
- Response: State what an analyst should inspect next.
- Tuning: Measure false positives and data gaps.
Pseudocode
WHEN process_created
IF parent_category == "service"
AND child_category == "interactive_shell"
AND host_role NOT IN approved_maintenance_hosts
THEN create_investigation_candidate
This is conceptual pseudocode, not a drop-in SIEM query. Translate it only after documenting actual event fields and expected behaviour.
Test matrix
| Scenario | Expected outcome |
|---|---|
| Planned maintenance on approved host | No alert |
| Synthetic shell launch outside approved host | Alert |
| Process lacks parent metadata | Coverage gap |
| Routine scheduled task | No alert after validation |
Quality measurements
Track alert volume, false-positive rate, time to triage and detection coverage. Distinguish a rule not firing from a rule that had no matching telemetry.
Practical takeaway
A good detection package includes a threat hypothesis, required log sources, query implementation, tests, tuning notes and a response playbook.
Related: Linux Services, Processes & Logs.