Repository navigation
Reject PROXY v2 headers too short for their family - #411
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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