Single-event evaluation
Evaluates an event using only the fields available in that event. No history is required.
How detection logic uses accumulated event context over time to identify behaviour that cannot be understood from a single event in isolation.
A stateless detection rule evaluates an event independently. It may identify a single failed login, an unusual process, or a connection to a particular destination.
Stateful detection keeps relevant information from earlier events and evaluates new activity against that accumulated context. This makes it possible to identify patterns that emerge over time—such as repeated authentication failures from one source within a defined period.
Evaluates an event using only the fields available in that event. No history is required.
Maintains relevant event history or counters and uses that context when evaluating incoming events.
State introduces lifecycle, expiry, memory management, event ordering and reset considerations.
A single failed authentication attempt may be routine. A sequence of failures associated with the same source within a short time window may warrant investigation.
A basic detection model tracks the relevant source, the timestamps of failed attempts, and a configurable threshold. When the number of failures inside the active window reaches the threshold, the detector emits an alert.
N failed authentication events within
T minutes. The threshold and time window should be configurable and tuned to the environment.
Event 1 ── Failed login ──┐
Event 2 ── Failed login ──┤
Event 3 ── Failed login ──┤── Context updated
Event 4 ── Failed login ──┤
└── Threshold reached
│
▼
Alert generated
Accept a normalized authentication event and determine whether it is relevant to the rule.
Record the event in the state associated with its correlation key, such as a source address.
Remove observations that fall outside the configured time window.
Evaluate the remaining observations against the rule's threshold.
When the condition is met, create an alert containing the relevant event context.
Remove inactive keys and prevent tracking data from growing indefinitely.
State should contain only the information required to evaluate the rule. For a simple failed-login detector, the state may be keyed by source address and contain timestamps for recent failures.
state = {
"source_key": [
timestamp_1,
timestamp_2,
timestamp_3
]
}
This is a conceptual representation, not a prescribed implementation. Depending on the rule, state may instead contain counters, sets of affected accounts, last-seen timestamps, or other compact context.
In MiniSOC, stateful detection is separated from parsing. Parsers convert source records into normalized events; detection components consume those events and maintain only the context required by their rules.
A dedicated state-management component can help keep detection rules focused on evaluating conditions rather than duplicating storage and expiry logic.
A stateful detector should be tested across event sequences. Testing only a single event is insufficient to validate accumulation, expiry and threshold behaviour.
Stateful rules can provide stronger behavioural context, but they also introduce operational and design challenges.
A detection rule should be evaluated in the context of its environment. A threshold is a starting point for investigation—not proof of malicious activity.