Skip to content

Harden untrusted payload parsing against out-of-bounds access - #9

Merged
dallison merged 6 commits into
mainfrom
security-bounds-fixes
Sep 2, 2026
Merged

Harden untrusted payload parsing against out-of-bounds access#9
dallison merged 6 commits into
mainfrom
security-bounds-fixes

Conversation

@dallison

Copy link
Copy Markdown
Owner

Summary

  • Validate payload structure in generated CreateReadonly before dereferencing any field offsets
  • Thread received buffer_size through MessageRuntime for size-aware string reads and element-count clamping
  • Add bounds checks to primitive/enum/message/string vector accessors and field iterators
  • Fix ProtoBuffer::Check integer overflow on hostile wire lengths
  • Add adversarial regression test PhaserTest.HostilePayloadIsBounded
  • Pin cpp_toolbelt to dallison/cpp_toolbelt#26 via git_override until 2.1.3 is published

Test plan

  • bazel test //... -//phaser:perf_test (macOS)
  • bazel test //... -//phaser:perf_test (Linux via Colima/Ubuntu 24.04)
  • bazel test --config=asan //... -//phaser:perf_test (Linux — ASan hangs on local macOS clang)
  • Guard Malloc verification on macOS for OOB detection

Dependency

Requires merging and releasing cpp_toolbelt#26, then replacing the temporary git_override with a cpp_toolbelt version bump.

Validate buffers in CreateReadonly, thread received size through field and
vector accessors, clamp hostile string lengths and element counts, and fix
ProtoBuffer overflow so malicious wire data cannot read past the buffer.
Make presence, nested-message slots, string size/data, fixed-array
counts, vector BaseOffset/capacity, and union discriminators size-aware
so hostile payloads cannot read past the received buffer.
libFuzzer found UnionInt64Field::Get SEGVing on hostile inflated
full_size; route union primitives through MessageRuntime::ToAddress.
Pin cpp_toolbelt to the ToAddress sizeof-fit fix and keep ASan crash
inputs as regression corpus.
@dallison
dallison merged commit bbba2eb into main Sep 2, 2026
5 checks passed
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