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: validate the length of all TLV types by yawkat · Pull Request #17834 · netty/netty

Conversation

@yawkat

@yawkat yawkat commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

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.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

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

All reactions
@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 yawkat added the found by fuzzing label Oct 15, 2026
This was referenced Oct 15, 2026
HAProxyMessage: decode TLVs with an empty value at the end of the header #17835
Merged
Add HAProxyMessageDecoder fuzzer micronaut-projects/micronaut-fuzzing#319
Merged
normanmaurer
normanmaurer approved these changes Oct 15, 2026
View reviewed changes
@normanmaurer normanmaurer added this to the 4.2.20.Final milestone Oct 15, 2026
@normanmaurer normanmaurer 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
@yawkat
yawkat marked this pull request as ready for review October 15, 2026 13:35
@testlens-app

testlens-app Bot commented Oct 15, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 01a9452
▶️ Tests: 24516 executed
⚪️ Checks: 32/32 completed


Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

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

@normanmaurer
normanmaurer merged commit f25d65c into netty:4.2 Oct 15, 2026
33 checks passed

Uh oh!

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

@netty-project-bot

netty-project-bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #17845

All reactions

Sorry, something went wrong.

Uh oh!

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

@netty-project-bot netty-project-bot mentioned this pull request Oct 15, 2026
Auto-port 4.1: HAProxyMessage: validate the length of all TLV types #17845
Merged
@github-actions github-actions Bot removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Oct 15, 2026
@netty-project-bot

netty-project-bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #17847

All reactions

Sorry, something went wrong.

Uh oh!

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

@netty-project-bot netty-project-bot mentioned this pull request Oct 15, 2026
Auto-port 5.0: HAProxyMessage: validate the length of all TLV types #17847
Merged
@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Oct 15, 2026
normanmaurer added a commit that referenced this pull request Oct 16, 2026
@netty-project-bot @yawkat @normanmaurer
Auto-port 4.1: HAProxyMessage: validate the length of all TLV types (#…
4af28c4
…17845)

Auto-port of #17834 to 4.1
Cherry-picked commit: f25d65c

---
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: Jonas Konrad <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
normanmaurer added a commit that referenced this pull request Oct 16, 2026
@netty-project-bot @yawkat @normanmaurer
Auto-port 5.0: HAProxyMessage: validate the length of all TLV types (#…
ca4d013
…17847)

Auto-port of #17834 to 5.0
Cherry-picked commit: f25d65c

---
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: Jonas Konrad <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
normanmaurer pushed a commit that referenced this pull request Oct 16, 2026
@yawkat
HAProxyMessage: decode TLVs with an empty value at the end of the hea…
4a80f41
…der (#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 mentioned this pull request Oct 16, 2026
Port 5.0: HAProxyMessage: decode TLVs with an empty value at the end of the header (#17835) #17874
Merged
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 mentioned this pull request Oct 16, 2026
Port 4.1: HAProxyMessage: decode TLVs with an empty value at the end of the header (#17835) #17877
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
@netty-project-bot @yawkat
@normanmaurer @lltopk
Auto-port 4.1: HAProxyMessage: validate the length of all TLV types (n…
dedcb94
…etty#17845)

Auto-port of netty#17834 to 4.1
Cherry-picked commit: f25d65c

---
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: Jonas Konrad <[email protected]>
Co-authored-by: Norman Maurer <[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]>
@lhotari lhotari mentioned this pull request Nov 2, 2026
[fix][sec] Upgrade Netty to 4.2.20 and netty-tcnative to 2.0.85 to address several CVEs and bugs apache/pulsar#27310
Merged
1 of 11 tasks
@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

@normanmaurer normanmaurer normanmaurer approved these changes

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.