# GHSA-C7HC-M259-XHCR: Signed/Unsigned Conversion in SocksInitRequestDecoder Leads to Auth-Scheme Bypass and Protocol Desynchronization

- Database: GitHub
- Severity: CVSS 5.3 (Medium)
- Published: 2026-12-02
- Modified: 2026-12-02

## Tracked as

- [CVE-2026-142442](https://cve.now/CVE-2026-142442.md): Io.netty/netty-codec-socks: netty: signed/unsigned conversion in socksinitrequestdecoder leads to auth-scheme bypass

## Affected versions

- io.netty:netty-codec-socks (Maven): through 4.1.138.Final
- io.netty:netty-codec-socks (Maven): from 4.2.0.Final, through 4.2.18.Final

## Description

`SocksInitRequestDecoder` is the legacy SOCKS5 handshake decoder in the `io.netty.handler.codec.socks` package (shipped in the `netty-codec-socks` jar). It handles the initial client greeting that declares which authentication methods the client supports (RFC 1928 §3). Any Netty application that explicitly adds `new SocksInitRequestDecoder()` to its channel pipeline is affected.

**The defect — signed `readByte()` for an unsigned protocol field.** At [`SocksInitRequestDecoder.java:49`](https://github.com/netty/netty/blob/8e7f51d8a6b5ea0bc6bd0c27ef12f04410b2842f/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitRequestDecoder.java#L49), the decoder reads the NMETHODS octet using `ByteBuf.readByte()`, which returns a signed Java `byte` in the range `[-128, 127]`. The SOCKS5 protocol defines this field as an unsigned octet with valid values `1`–`255`. Wire values `0x80`–`0xFF` (representing 128–255 offered authentication methods, all spec-legal) sign-extend to `−128` through `−1` in Java. The guard at [line 51](https://github.com/netty/netty/blob/8e7f51d8a6b5ea0bc6bd0c27ef12f04410b2842f/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitRequestDecoder.java#L51), `if (authSchemeNum > 0)`, evaluates to false for all of these values, causing the decoder to take the `else` branch at [line 57](https://github.com/netty/netty/blob/8e7f51d8a6b5ea0bc6bd0c27ef12f04410b2842f/codec-socks/src/main/java/io/netty/handler/codec/socks/SocksInitRequestDecoder.java#L57) (`authSchemes = Collections.emptyList()`) and emit a successful `SocksInitRequest` with an empty authentication-scheme list — consuming zero of the N method bytes that follow.

## References

- https://github.com/netty/netty/security/advisories/GHSA-c7hc-m259-xhcr

Page: https://cve.now/GHSA-C7HC-M259-XHCR

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
