-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Issue Description
Summary
While reviewing behavior observed during development of a multi-step module (CVE-2024-36401), an inconsistency was identified in the Nettacker engine event pipeline that may allow empty {} responses to be written to the temporary events database.
The async behavior itself was originally observed by @sankalp-b1401 when testing the module with multiple schemas (HTTP/HTTPS). While investigating this further, I traced the root cause to a missing guard in the engine's save_to_temp_events_only event write path.
Observed Behavior
Nettacker uses the asynchronous aiohttp library to execute module payloads concurrently.
When modules define multiple schemas (for example http and https) across multiple ports (e.g. 80, 443, 8080), requests are executed concurrently and there is no guaranteed ordering of responses.
In some cases one request may produce an empty match result while another produces a valid detection result. During this process, the engine may write an empty {} event to the temporary events database.
This behavior was initially observed while debugging a multi-step module that relies on temporary event storage.
Root Cause
The issue appears to originate in:
core/lib/base.py
Specifically in the logic responsible for writing temporary events:
save_to_temp_events_only
In this code path there is currently no guard preventing empty conditions_results from being written.
However, in the normal detection event write path, there is already a guard that prevents empty condition results from being persisted.
This results in inconsistent behavior between:
normal event writes
temporary event writes
Proposed Fix
Add a guard in the save_to_temp_events_only logic similar to the one already used in the normal detection event write path.
For example extending the condition to check:
event["response"]["conditions_results"]
before writing to the temporary event database.
This change would prevent {} responses from being stored and align the behavior of temporary event writes with the existing detection event logic.
Acknowledgement
The async execution behavior leading to {} events was initially observed by @sankalp-b1401 b1401 while testing the module; this issue documents the underlying engine condition that allows the empty events to be written.