Skip to content

Lesson 10 of 13 · 14m

If You Didn't Fire It, You Didn't Ship It

Atomic Red Team positive and negative tests, replayed event corpora, and the CI checks that catch rules broken by field renames.

A rule that has never fired is not a detection; it is a YAML file with aspirations. The silent-failure modes are legion: the logsource maps to a field your pipeline renamed, the modifier compiled to syntax the target doesn't support, the event ID is right but the field exists only when a GPO you never checked is enabled. None of these produce an error. They produce a rule that matches nothing, forever, while the coverage map stays green.

Atomic Red Team

Red Canary's Atomic Red Team (github.com/redcanaryco/atomic-red-team) is a library of small, per-technique tests indexed by ATT&CK ID. Invoke-AtomicTest T1003.001 runs the LSASS-access tests on a Windows box — including the rundll32 comsvcs.dll MiniDump variant. Run it in a lab, watch Sysmon 10 events flow, confirm the rule fires. That is the positive test: proof the telemetry path and the detection logic both work end to end. Invoke-AtomicTest also carries -CheckPrereqs and -Cleanup — the tests leave artifacts (created files, dropped binaries), and a lab box full of leftover test malware is its own false-positive factory on the next run.

The negative test is the one people skip. A detection needs a benign near-miss it must not fire on — antivirus touching LSASS, an admin running procdump, a service account's normal ticket requests. If your rule can't tell mimikatz from MsMpEng, you didn't write a detection; you wrote a noise source. Run the benign activity deliberately and record the non-fire as a test result, not an assumption.

MITRE CALDERA and Splunk Attack Range do the same job at campaign scale — full attack chains, not single techniques — for validating temporal correlations that need a sequence to fire.

Replay is cheaper than adversaries

You don't need to rerun the attack to retest the rule. Capture the events the first atomic test produced — exported EVTX, JSON dumps, Zeek logs — and commit them beside the rule. Every change to the rule or the parser gets tested by replaying the corpus: positive samples must still fire, negative samples must still not. This is detection-as-code's actual payoff: the test suite is real telemetry, replayed deterministically in CI, and it catches the field-rename breakage that production never would.

The CI that catches it

Three checks in the pipeline:

  1. Conversion — sigma convert every rule for every backend you deploy to. Failure here is a syntax/portability bug caught before deploy.
  2. Replay test — stored event corpus through the compiled rule; assert fire/don't-fire per sample.
  3. Field presence — the rule references CommandLine; the corpus proves CommandLine exists in your actual 4688 events. If your domain never enabled command-line auditing, the corpus shows empty fields and the rule fails its own test.

A fourth belongs on the schedule, not in CI: re-run the atomic tests against the production pipeline periodically. The lab proves the rule works; the production replay proves the source still feeds it. The gap between them is where detections rot — sources change format without announcing it, a Windows update renames a field, a firmware update reorders syslog fields, and the stored corpus keeps passing while the live feed silently changed.

Purple teaming is the honest version

The most effective test cadence isn't automated at all: a red operator executes the technique while a blue operator watches the console, live. The automation proves the mechanism; the live exercise proves the analyst recognizes what the mechanism looks like when it fires. Both results matter, and only one of them fits in CI.

The bar for "tested" is a timestamped record — which test ran, which rule version it ran against, and whether it fired — committed alongside the rule. "We ran Atomic Red Team once last year" is not a test record; it is a rumor.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.