Skip to content

Fix parsing when chunk header offsets are too large (#197)#273

Merged
omerbenamram merged 1 commit intomasterfrom
fix-197-zero-magic-slack
Dec 21, 2025
Merged

Fix parsing when chunk header offsets are too large (#197)#273
omerbenamram merged 1 commit intomasterfrom
fix-197-zero-magic-slack

Conversation

@omerbenamram
Copy link
Owner

@omerbenamram omerbenamram commented Dec 21, 2025

What

Some EVTX producers emit incorrect chunk header metadata (notably free_space_offset / last_event_record_id). This can cause the iterator to walk into zero-padded chunk slack and fail with Invalid EVTX record header magic, expected \2a2a0000`, found [0,0,0,0]` (see #197).

Repro: the SANS Tech Tuesday Cobalt Strike lab Sysmon EVTX (Microsoft-Windows-Sysmon%4Operational.evtx) fails right after record id 188711.

Fix

  • Clamp free_space_offset to the actual chunk length to avoid OOB slicing.
  • If the next record header magic is 00000000, treat it as end-of-chunk slack (stop iterating this chunk) rather than emitting an error.

Tests

  • Added a regression test that simulates too-large free_space_offset/last_event_record_id and asserts iteration ends cleanly.
  • Updated dirty-sample expected error counts since the spurious 00000000 header error is no longer emitted.

Fixes #197.

Treat all-zero record header magic as end-of-chunk slack to avoid failing on incorrect free_space_offset/last_event_record_id (issue #197). Adds a regression test and updates dirty-sample expected error counts.
@omerbenamram omerbenamram merged commit 51206fa into master Dec 21, 2025
4 checks passed
@omerbenamram omerbenamram deleted the fix-197-zero-magic-slack branch December 21, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parser fails if last_event_record_id and free_space_offset are set wrong in the Chunk Header

1 participant