Dev.to Security 🔐 Cybersecurity 👁 2 📖 2 min read

Every detector caught 7 of 7 attacks. That number told me nothing.

I compared seven anomaly detectors on BATADAL, a public benchmark of cyberattacks on a simulated water-distribution network: 43 hourly signals, 14 attacks across two files. Every detector caught all 7 attacks in the test

I compared seven anomaly detectors on BATADAL, a public benchmark of cyberattacks on a simulated water-distribution network: 43 hourly signals, 14 attacks across two files. Every detector caught all 7 attacks in the test file. Even the crude ones.

That was the first sign the metric was wrong, not that the detectors were good.

Setup

  • Detectors learn from a year of attack-free data. The headline is a later, unseen test file: attacks 8 to 14, January to March 2017, 407 attack hours out of 2,089 (19.5%).
  • Every detector is held to the same false-alarm budget: at most one alarm segment per attack-free day. Without that, the detector that alarms most wins.
  • The evaluation protocol, including the decision rule below, was fixed before its first run.

Results on the test file

Detector Attacks caught Expected from false alarms alone Precision Attack hours caught PR-AUC
Static limits 7 of 7 6.3 34.1% 39.1% 0.387
Max absolute z-score 7 of 7 6.3 54.9% 26.0% 0.427
EWMA of z-scores 7 of 7 5.9 29.6% 47.9% 0.391
CUSUM 7 of 7 3.3 22.2% 92.1% 0.207
24 h rolling residual 7 of 7 6.3 43.5% 25.6% 0.316
Isolation Forest 7 of 7 6.2 32.1% 12.8% 0.248
Gradient boosting (supervised)* 7 of 7 6.2 39.1% 16.7% 0.322

*Trained on the other file with its published attack intervals. An optimistic reference, not a deployable detector.

A random guess scores a PR-AUC of about 0.195 here.

Why "7 of 7" says so little

The attacks last 24 to 110 hours. A detector that fires one random alarm segment a day will land inside most of them by chance. The third column estimates exactly that: false alarms alone would be expected to touch about 6.3 of the 7 attacks for most detectors. "Caught every attack" is almost guaranteed at this budget.

CUSUM shows the other trap. It covers 92.1% of attack hours, which sounds excellent, but its precision is 22.2% and it alarms during 78% of attack-free hours. Its PR-AUC of 0.207 is barely above random.

The numbers that separate the detectors are precision and PR-AUC against the random baseline. On both, the simplest method, the maximum absolute z-score across signals with no notion of time, comes out on top.

Did adding time help?

The protocol said a temporal detector beats the z-score only if the 95% interval of its paired PR-AUC difference lies entirely above zero (1,000 day-block bootstrap resamples).

Detector PR-AUC minus z-score, 95% interval
EWMA of z-scores -0.088 to 0.041
CUSUM -0.377 to -0.042
24 h rolling residual -0.180 to -0.021

None passes. Two are clearly worse. EWMA does beat the z-score on the 2016 file (0.586 against 0.437), but that file is secondary, and the result did not carry to the test file. Writing the rule down first is what stops that one good number from becoming the headline.

Boundaries

This is one public benchmark from a simulated network, with 7 test attacks. The project's dashboard uses an LLM only to explain a verdict the statistical detector has already made, with a rule-based fallback; the LLM never decides whether something is an attack.

What I keep from it

  • Before trusting a hit rate, ask what a detector firing at random would score.
  • Fix the false-alarm budget first, then compare.
  • A simple baseline that survives a pre-registered test is worth more than a clever model that wins on one file.

Links

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.