Skip to content

Harden malformed packet handling and split reassembly#59

Open
HashimTheArab wants to merge 2 commits into
Sandertv:masterfrom
HashimTheArab:agent/split-reassembly-hardening
Open

Harden malformed packet handling and split reassembly#59
HashimTheArab wants to merge 2 commits into
Sandertv:masterfrom
HashimTheArab:agent/split-reassembly-hardening

Conversation

@HashimTheArab

@HashimTheArab HashimTheArab commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Reject split counts outside the supported 1..8192 range on both listener and dialer connections.
  • Use a 256-slot split-ID ring to bound concurrent reassembly state while tolerating legitimate interleaving.
  • Ignore duplicate split fragments and distinguish missing fragments from received empty fragments.
  • Return io.ErrUnexpectedEOF when ConnectionRequestAccepted ends before SystemIndex.

Why

Invalid split counts could previously panic or allocate excessive memory on dialer connections. The listener-only limits also rejected valid servers using more than 512 fragments or interleaving more than 16 split packets. Duplicate fragments could overwrite retained data, and a truncated accepted-connection packet could panic during decoding.

@HashimTheArab
HashimTheArab marked this pull request as ready for review July 10, 2026 02:15
@HashimTheArab
HashimTheArab force-pushed the agent/split-reassembly-hardening branch from 8efe495 to 2febe30 Compare July 10, 2026 02:24
@HashimTheArab
HashimTheArab force-pushed the agent/split-reassembly-hardening branch from 2febe30 to 28fd907 Compare July 10, 2026 02: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.

1 participant