Skip to content

Lesson 9 of 13 · 15m

Single Events Lie; Sequences Tell the Truth

event_count vs value_count, temporal joins, window sizing against attacker pacing, and the memory cost of stateful detection.

A single 4625 means a user mistyped a password. Ten thousand 4625s against distinct usernames from one IP mean password spraying. The same event ID, the same failure code — the difference exists only in the aggregate, and capturing it requires state.

The correlation types

Sigma's correlation spec (the correlation: section, a newer layer on top of selection rules) names four:

  • event_count — N events matching a rule, grouped by a field, inside timespan. "≥10 failed logons on one account in 5 minutes" is event_count over TargetUserName.
  • value_count — N distinct values of a field. "≥20 distinct usernames failed from one SourceIp" — the spray signature — is value_count over TargetUserName grouped by IpAddress. This is the type juniors get backwards: spray detection counts distinct users; brute force counts repeated failures on one user.
  • temporal — two or more rules' events on the same entity within a window. "4624 type 3 from IP X then 4688 launching powershell.exe within 5 minutes on the same host" — the sequence, not either event alone.
  • temporal_ordered — temporal with strict ordering required.

Where the state lives

Correlation needs per-key counters inside sliding windows. In Splunk that's scheduled searches over lookback windows; in Sentinel it's scheduled analytics rules where queryFrequency and queryPeriod define how often the window is evaluated and how far back it looks; in Sigma-correlation backends it compiles to whatever the target's aggregation syntax is. The mechanics differ; the resource cost is the same shape: window length × cardinality of the group-by key = memory. group-by: IpAddress over a 5-minute window is small; group-by: UserName over 24 hours on a 10k-seat estate is not.

Join-based correlation has a second cost: the join explodes combinatorially before it filters. "Every 4624 joined to every 4688 on the same host within 5m" on a busy estate is millions of candidate pairs per evaluation. Correlations keyed on specific field values — the same IpAddress, the same SubjectLogonId — prune before joining; correlations on broad entity fields multiply first.

Windows and lookbacks

The temporal window has to outlast the attacker's pacing and your pipeline lag. Spray campaigns run slowly on purpose — 30 attempts per hour to stay under naive thresholds — so a 5-minute window misses a slow spray and a 24-hour window catches it at 10× memory cost. Layered windows answer this: a tight event_count for fast bursts, a slow value_count over a longer lookback for deliberate pacing. The password-spray detection Microsoft published for ADFS estates in the 2020 era worked exactly this way: distinct-user counting over hours, not failed-logon counting over minutes.

The late-events problem compounds it: an event buffered through a Kafka stall and indexed 40 minutes late belongs in a window that already closed. Correlations evaluated on event.created with lookback longer than measured worst-case ingest lag survive; correlations on arrival time do not.

Dedup is correlation's twin

The same incident producing 400 events shouldn't produce 400 alerts. Aggregation keys — (rule, entity, time bucket) — turn a spray into one alert naming the source and the affected account count. Splunk Enterprise Security's risk-based alerting (RBA, shipped with ES 6.4 in 2020) goes further: risk scores accumulate on entities, and the alert fires when aggregate risk crosses a threshold rather than when any single rule fires. The sequence of small anomalies becomes the signal — a spray, a successful logon, and a new MFA enrollment on the same account in one shift is one alert at 90 risk, not three alerts at 30.

The correct practice: start single-event rules to validate signal, then express multi-event hypotheses as temporal correlations on the entity fields — host, user, source ip — and measure the memory cost of each window before you multiply them.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.