Skip to content

Harden the USDT note parser against malformed input - #179

Merged
nickschuch merged 1 commit into
mainfrom
fix/usdt-parser-hardening
Sep 4, 2026
Merged

Harden the USDT note parser against malformed input#179
nickschuch merged 1 commit into
mainfrom
fix/usdt-parser-hardening

Conversation

@nickschuch

Copy link
Copy Markdown
Contributor

getLocationFromProbe parsed .note.stapsdt without bounds checks, so a truncated or corrupt extension binary could crash the sidecar during runtime discovery: an unterminated provider or probe string made bytes.IndexByte return -1 and the following slice expression panic, a negative descsz wrapped through uint64 into a multi-gigabyte allocation, and a 32-bit ELF drove Uint64 across a four-byte field.

Reject non-64-bit binaries and out-of-range namesz/descsz up front, and extract the descriptor-body decode into parseNoteDesc, which guards the address-field length and both string terminators and returns an error instead of panicking. Add unit tests for the rejects and a fuzz target asserting no descriptor body can panic.

getLocationFromProbe parsed .note.stapsdt without bounds checks, so a
truncated or corrupt extension binary could crash the sidecar during runtime
discovery: an unterminated provider or probe string made bytes.IndexByte
return -1 and the following slice expression panic, a negative descsz wrapped
through uint64 into a multi-gigabyte allocation, and a 32-bit ELF drove
Uint64 across a four-byte field.

Reject non-64-bit binaries and out-of-range namesz/descsz up front, and
extract the descriptor-body decode into parseNoteDesc, which guards the
address-field length and both string terminators and returns an error
instead of panicking. Add unit tests for the rejects and a fuzz target
asserting no descriptor body can panic.
@nickschuch
nickschuch merged commit ac2fa5e into main Sep 4, 2026
5 checks passed
@nickschuch
nickschuch deleted the fix/usdt-parser-hardening branch September 4, 2026 03:39
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.

1 participant