REDHAT-BUG-2588734: Medium severity maven/io.netty/netty-codec-socks vulnerability
SocksInitRequestDecoder, the legacy SOCKS5 handshake decoder in the io.netty.handler.codec.socks package of netty-codec-socks, reads the NMETHODS field of the client greeting with the signed ByteBuf.readByte(). The SOCKS5 protocol defines this field as an unsigned octet. Valid wire values 0x80-0xFF (128-255 offered authentication methods) are therefore read as negative numbers. The decoder's authSchemeNum > 0 check fails for them, so it emits a successful SocksInitRequest with an empty authentication-scheme list. It consumes none of the method bytes that follow.
A remote client can send a spec-legal greeting that advertises 128 or more authentication methods. The server then sees a request with no offered schemes, so authentication-scheme negotiation is bypassed or misjudged. The unconsumed method bytes remain in the buffer and are interpreted as the start of the next SOCKS message, which desynchronizes the protocol stream.
Only applications that explicitly add new SocksInitRequestDecoder() to a channel pipeline are affected. This is the legacy decoder in netty-codec-socks, in versions up to and including 4.1.138.Final, and in 4.2.0.Final through 4.2.18.Final. The issue is fixed in 4.1.139.Final and 4.2.19.Final.
Affected versions: <= 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:L/A:N (5.3) CWE: CWE-115 Upstream advisory: https://github.com/netty/netty/security/advisories/GHSA-c7hc-m259-xhcr 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-socksto a version that resolves this vulnerability.Fixed in 4.1.139.Final - Upgrade
Upgrade
netty-codec-socksto a version that resolves this vulnerability.Fixed in 4.2.19.Final
Event History
Frequently Asked Questions
Which deployments are affected?
Only applications that explicitly add a new SocksInitRequestDecoder() to a channel pipeline are affected. The issue is limited to the legacy SOCKS5 handshake decoder in the io.netty.handler.codec.socks package of netty-codec-socks.
What must an attacker do to trigger the issue?
A remote client must send a spec-compliant SOCKS5 greeting whose NMETHODS value is between 128 and 255. This causes the decoder to treat the offered-method count as negative, produce an empty authentication-scheme list, and leave the method bytes unconsumed.
What is the practical impact on the connection?
The server can incorrectly treat the request as having no offered authentication schemes, causing authentication negotiation to be bypassed or misjudged. The remaining method bytes are then parsed as the next SOCKS message, desynchronizing the protocol stream.
Which versions are affected?
Affected versions include netty-codec-socks through 4.1.138.Final, and versions from 4.2.0.Final through 4.2.18.Final. The provided data indicates that a fix exists but does not identify the fixed version.