GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — HAProxyMessage: decode TLVs with an empty value at the end of the header by yawkat · Pull Request #17835 · netty/netty

Conversation

@yawkat

@yawkat yawkat commented Oct 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Motivation:

A TLV consists of a 1 byte type, a 2 byte length and a value that may be
empty. HAProxyMessage.readNextTLV requires at least 4 readable bytes, so it
ignores a TLV with an empty value at the end of the header or at the end of
a PP2_TYPE_SSL TLV. Such a TLV is also lost when a decoded message is
encoded and decoded again.

Modification:

  • Read a TLV when at least 3 bytes are readable.
  • Add unit tests.

Result:

TLVs with an empty value are decoded. Three trailing bytes that declare a
non-zero length are now rejected instead of ignored, while one or two
trailing bytes are still ignored. One or two trailing bytes cannot form a TLV header; they are left as is on purpose to stay compatible with lenient or padding senders, and rejecting them could be a separate change.

This change depends on #17834 ("HAProxyMessage: validate the length of all
TLV types"), which makes such a TLV fail with a HAProxyProtocolException.
This branch is based on that PR, so it also contains its commit.

Discovered by fuzzing.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
yawkat and others added 2 commits October 15, 2026 15:04
@yawkat @claude
HAProxyMessage: validate the length of all TLV types
01a9452
Motivation:

HAProxyMessage.readNextTLV checks that the length of a PP2_TYPE_SSL TLV does
not exceed the remaining header, but not the length of the other TLV types.
For those, readRetainedSlice throws an IndexOutOfBoundsException, which
ByteToMessageDecoder wraps in a DecoderException. HAProxyMessageDecoder only
handles HAProxyProtocolException, so it does not close the channel, and it
decodes the following bytes as another header.

Modification:

- Check the TLV length against the readable bytes for all TLV types.
- Add unit tests.

Result:

A TLV that is longer than the header fails with a HAProxyProtocolException
and closes the channel.

Discovered by fuzzing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yawkat @claude
HAProxyMessage: decode TLVs with an empty value at the end of the header
d22db8c
Motivation:

A TLV consists of a 1 byte type, a 2 byte length and a value that may be
empty. HAProxyMessage.readNextTLV requires at least 4 readable bytes, so it
ignores a TLV with an empty value at the end of the header or at the end of
a PP2_TYPE_SSL TLV. Such a TLV is also lost when a decoded message is
encoded and decoded again.

Modification:

- Read a TLV when at least 3 bytes are readable.
- Add unit tests.

Result:

TLVs with an empty value are decoded. Three trailing bytes that declare a
non-zero length are now rejected instead of ignored, while one or two
trailing bytes are still ignored.

This change applies on top of "HAProxyMessage: validate the length of all
TLV types", which makes such a TLV fail with a HAProxyProtocolException.

Discovered by fuzzing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yawkat yawkat added the found by fuzzing label Oct 15, 2026
@yawkat yawkat mentioned this pull request Oct 15, 2026
Add HAProxyMessageDecoder fuzzer micronaut-projects/micronaut-fuzzing#319
Merged
@yawkat
yawkat marked this pull request as ready for review October 15, 2026 13:37
@yawkat yawkat added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Oct 15, 2026
@normanmaurer normanmaurer added this to the 4.2.20.Final milestone Oct 16, 2026
@normanmaurer
normanmaurer merged commit 4a80f41 into netty:4.2 Oct 16, 2026
33 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 5.0.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Oct 16, 2026

Copy link
Copy Markdown
Member

Port for 5.0: #17874

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Oct 16, 2026
@netty-project-bot

netty-project-bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 4.1.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

normanmaurer pushed a commit that referenced this pull request Oct 16, 2026
@yawkat @normanmaurer
Port 5.0: HAProxyMessage: decode TLVs with an empty value at the end …
0a6e0b6
…of the header (#17835)

Motivation:

A TLV consists of a 1 byte type, a 2 byte length and a value that may be
empty. HAProxyMessage.readNextTLV requires at least 4 readable bytes, so
it
ignores a TLV with an empty value at the end of the header or at the end
of
a PP2_TYPE_SSL TLV. Such a TLV is also lost when a decoded message is
encoded and decoded again.

Modification:

- Read a TLV when at least 3 bytes are readable.
- Add unit tests.

Result:

TLVs with an empty value are decoded. Three trailing bytes that declare
a
non-zero length are now rejected instead of ignored, while one or two
trailing bytes are still ignored. One or two trailing bytes cannot form
a TLV header; they are left as is on purpose to stay compatible with
lenient or padding senders, and rejecting them could be a separate
change.

This change depends on #17834 ("HAProxyMessage: validate the length of
all
TLV types"), which makes such a TLV fail with a
HAProxyProtocolException.
This branch is based on that PR, so it also contains its commit.

Discovered by fuzzing.
@normanmaurer

normanmaurer commented Oct 16, 2026

Copy link
Copy Markdown
Member

Port for 4.1 #17877

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Oct 16, 2026
@normanmaurer normanmaurer mentioned this pull request Oct 16, 2026
Port 4.1: Honor maxAllocation for brotli in DelegatingDecompressorFrameListener #17881
Merged
normanmaurer added a commit that referenced this pull request Oct 16, 2026
@normanmaurer @yawkat
Port 5.0: HAProxyMessage: decode TLVs with an empty value at the end …
d9c5725
…of the header (#17835) (#17874)

Motivation:

A TLV consists of a 1 byte type, a 2 byte length and a value that may be
empty. HAProxyMessage.readNextTLV requires at least 4 readable bytes, so
it
ignores a TLV with an empty value at the end of the header or at the end
of
a PP2_TYPE_SSL TLV. Such a TLV is also lost when a decoded message is
encoded and decoded again.

Modification:

- Read a TLV when at least 3 bytes are readable.
- Add unit tests.

Result:

TLVs with an empty value are decoded. Three trailing bytes that declare
a
non-zero length are now rejected instead of ignored, while one or two
trailing bytes are still ignored. One or two trailing bytes cannot form
a TLV header; they are left as is on purpose to stay compatible with
lenient or padding senders, and rejecting them could be a separate
change.

This change depends on #17834 ("HAProxyMessage: validate the length of
all
TLV types"), which makes such a TLV fail with a
HAProxyProtocolException.
This branch is based on that PR, so it also contains its commit.

Discovered by fuzzing.

Co-authored-by: Jonas Konrad <[email protected]>
normanmaurer added a commit that referenced this pull request Oct 16, 2026
@normanmaurer @yawkat
Port 4.1: HAProxyMessage: decode TLVs with an empty value at the end …
1bd0a79
…of the header (#17835) (#17877)

Motivation:

A TLV consists of a 1 byte type, a 2 byte length and a value that may be
empty. HAProxyMessage.readNextTLV requires at least 4 readable bytes, so
it
ignores a TLV with an empty value at the end of the header or at the end
of
a PP2_TYPE_SSL TLV. Such a TLV is also lost when a decoded message is
encoded and decoded again.

Modification:

- Read a TLV when at least 3 bytes are readable.
- Add unit tests.

Result:

TLVs with an empty value are decoded. Three trailing bytes that declare
a
non-zero length are now rejected instead of ignored, while one or two
trailing bytes are still ignored. One or two trailing bytes cannot form
a TLV header; they are left as is on purpose to stay compatible with
lenient or padding senders, and rejecting them could be a separate
change.

This change depends on #17834 ("HAProxyMessage: validate the length of
all
TLV types"), which makes such a TLV fail with a
HAProxyProtocolException.
This branch is based on that PR, so it also contains its commit.

Discovered by fuzzing.

Co-authored-by: Jonas Konrad <[email protected]>
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@normanmaurer @yawkat @lltopk
Port 4.1: HAProxyMessage: decode TLVs with an empty value at the end …
8e58186
…of the header (netty#17835) (netty#17877)

Motivation:

A TLV consists of a 1 byte type, a 2 byte length and a value that may be
empty. HAProxyMessage.readNextTLV requires at least 4 readable bytes, so
it
ignores a TLV with an empty value at the end of the header or at the end
of
a PP2_TYPE_SSL TLV. Such a TLV is also lost when a decoded message is
encoded and decoded again.

Modification:

- Read a TLV when at least 3 bytes are readable.
- Add unit tests.

Result:

TLVs with an empty value are decoded. Three trailing bytes that declare
a
non-zero length are now rejected instead of ignored, while one or two
trailing bytes are still ignored. One or two trailing bytes cannot form
a TLV header; they are left as is on purpose to stay compatible with
lenient or padding senders, and rejecting them could be a separate
change.

This change depends on netty#17834 ("HAProxyMessage: validate the length of
all
TLV types"), which makes such a TLV fail with a
HAProxyProtocolException.
This branch is based on that PR, so it also contains its commit.

Discovered by fuzzing.

Co-authored-by: Jonas Konrad <[email protected]>
@yawkat yawkat mentioned this pull request Nov 9, 2026
Remove known-bug filters for fixes released in Netty 4.2.20 micronaut-projects/micronaut-fuzzing#340
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

found by fuzzing

Projects

None yet

Milestone

4.2.20.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@yawkat @netty-project-bot @normanmaurer
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.