REDHAT-BUG-2588748: High severity maven/io.netty/netty-codec-haproxy vulnerability
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.
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
Which deployments are exposed to this issue?
Deployments are exposed when they decode an accepted PROXY v2 header containing nested SSL TLVs, re-encode that message, and pass it to a downstream PROXY v2 decoder. The downstream decoder is affected because it trusts the advertised frame length and may consume bytes from the following application stream.
What does an attacker need to control?
An attacker must be able to send or influence a PROXY v2 header that is accepted by the affected processing path. Exploitation specifically requires nested child TLVs within a PP2_TYPE_SSL TLV.
What are the likely operational signs of exploitation or impact?
A re-encoded PROXY v2 frame can declare a length larger than the bytes actually written. Downstream parsing may then interpret following application-stream bytes as PROXY metadata, including TLV-shaped data such as an ALPN TLV, or stall or close the connection when those bytes are not TLV-shaped.