CVE-2026-142456: Io.netty/netty-codec-haproxy: netty: nested haproxy ssl tlvs re-encode with inconsistent proxy v2 length (tlv injection/desync)
A flaw was found in netty-codec-haproxy. When processing PROXY v2 header messages containing nested Secure Sockets Layer (SSL) Type-Length-Value (TLV) entries, the encoder incorrectly calculates message length fields. A remote attacker can exploit this issue by sending a specially crafted header, causing downstream decoders to misinterpret trailing application data as header metadata. This allows an attacker to inject unauthorized proxy metadata or cause a denial of service by disrupting downstream connection streams.
Other sources
When HAProxyMessageDecoder decodes a PROXY v2 header, direct child TLVs of a PP2TYPESSL TLV are exposed both as children of the SSL TLV and as flattened entries in HAProxyMessage.tlvs(). HAProxyMessageEncoder then encodes the SSL TLV's children recursively and also iterates the flattened list as top-level TLVs. The PROXY v2 length field is computed from one TLV layout, while the bytes actually written follow a different one, because the encoder also advances the reader indexes of TLV content while encoding.
As a result, re-encoding a decoded message that contains nested SSL TLVs produces a PROXY v2 frame whose declared length is larger than the number of bytes written. A downstream PROXY v2 decoder consumes bytes from the start of the following application stream to fill the advertised length. An attacker who can send or influence an accepted PROXY v2 header can therefore cause TLV-shaped bytes from the application stream to be interpreted as PROXY metadata, such as an injected ALPN TLV. If the following bytes are not TLV-shaped, downstream PROXY parsing can stall or close the connection.
The impact is integrity loss through TLV injection and stream desynchronization, plus limited denial of service. Downstream routing, ALPN or authority handling, TLS or client-certificate metadata checks, and other decisions that trust PROXY v2 TLVs may be affected.
Affected are users of netty-codec-haproxy who decode PROXY v2 messages with HAProxyMessageDecoder and forward the decoded HAProxyMessage by re-encoding it with HAProxyMessageEncoder, as in multi-hop proxy deployments. The issue affects versions 4.1.49.Final through 4.1.138.Final and 4.2.0.Final through 4.2.18.Final. It is fixed in 4.1.139.Final and 4.2.19.Final.
Affected versions: >= 4.1.49.Final, <= 4.1.138.Final; >= 4.2.0.Final, <= 4.2.18.Final Patched versions: 4.1.139.Final; 4.2.19.Final CVSS: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L (8.2) CWE: CWE-130, CWE-436 Upstream advisory: https://github.com/netty/netty/security/advisories/GHSA-frq3-7pw6-36cg CVE requested by the Netty Project via PSIRTSUPT-32166.
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
netty-codec-haproxyto a version that resolves this vulnerability.Fixed in 4.1.139.Final - Upgrade
Upgrade
netty-codec-haproxyto a version that resolves this vulnerability.Fixed in 4.2.19.Final
Event History
Frequently Asked Questions
What processing path is required for exploitation?
The affected application must decode a PROXY v2 header containing nested SSL TLVs and then re-encode that decoded HAProxyMessage. The flaw occurs because SSL child TLVs are represented both recursively and in the message’s flattened TLV list during encoding.
What can indicate that a malformed frame was generated?
A re-encoded PROXY v2 frame containing nested SSL TLVs can declare a length larger than the number of bytes actually written. Downstream decoders may then consume trailing application data as if it were PROXY header metadata.
What are the practical consequences for downstream systems?
A crafted header can inject unauthorized proxy metadata into downstream processing or disrupt downstream connection streams, resulting in denial of service. The issue can be exploited remotely without privileges or user interaction.