Skip to content

Reject PROXY v2 headers too short for their family - #411

Merged
bneradt merged 1 commit into
yahoo:masterfrom
bneradt:reject-short-pp-v2-headers
Oct 14, 2026
Merged

bneradt merged 1 commit into
yahoo:masterfrom
bneradt:reject-short-pp-v2-headers

Conversation

@bneradt

@bneradt bneradt commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

verifier-server checked only that it had received as many bytes as a
PROXY v2 header's length field declared. A peer could declare a length
of zero, or one shorter than the address block for the advertised
TCP4 or TCP6 family, and the parser would still read the source and
destination addresses. Those 12 or 36 bytes came from past the
received data in the server's stack buffer and were then written to
the server log, disclosing uninitialized stack memory
(GHSA-q86g-vh3v-7r4q).

This patch addresses this by rejecting PROXY commands whose declared
length does not cover the family's address block before any address
is read. As defense in depth, the server also zeroes its peek buffer
so bytes past the peeked data can never hold stale stack contents.
Unit and Uranium tests cover short TCP4 and TCP6 headers alongside a
well-formed header.

Thanks to Gengyskan (https://github.com/Gengyskan) for reporting this
issue.
🤖 Generated with Claude Code

verifier-server checked only that it had received as many bytes as a
PROXY v2 header's length field declared. A peer could declare a length
of zero, or one shorter than the address block for the advertised
TCP4 or TCP6 family, and the parser would still read the source and
destination addresses. Those 12 or 36 bytes came from past the
received data in the server's stack buffer and were then written to
the server log, disclosing uninitialized stack memory
(GHSA-q86g-vh3v-7r4q).

This patch addresses this by rejecting PROXY commands whose declared
length does not cover the family's address block before any address
is read. As defense in depth, the server also zeroes its peek buffer
so bytes past the peeked data can never hold stale stack contents.
Unit and Uranium tests cover short TCP4 and TCP6 headers alongside a
well-formed header.

Thanks to Gengyskan (https://github.com/Gengyskan) for reporting this
issue.

Reported-by: Gengyskan <https://github.com/Gengyskan>
Co-Authored-By: Claude Opus 5.5 (low reasoning) <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 21:33
@bneradt bneradt added the bug Something isn't working label Oct 14, 2026
@bneradt bneradt self-assigned this Oct 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bneradt
bneradt merged commit c27d9a5 into yahoo:master Oct 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants