# GHSA-79Q2-MHF4-2J6J: Netty io\_uring Unix-domain SCM\_RIGHTS receive still leaks extra file descriptors (incomplete fix for CVE-2026-45536)

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

## Affected versions

- io.netty:netty-transport-native-io\_uring (Maven): from 4.2.0.Final, through 4.2.18.Final
- io.netty:netty-transport-classes-io\_uring (Maven): from 4.2.0.Final, through 4.2.18.Final

## Description

### Summary

`io.netty:netty-transport-classes-io_uring` / `netty-transport-native-io_uring` implement Unix-domain `recvmsg` in Java. CVE-2026-45536 taught epoll/kqueue to reject truncated cmsgs, compute `nfds` from `cmsg_len`, and close surplus fds in `netty_unix_socket_recvFd()`. io_uring never calls that function. `IoUringDomainSocketChannel.readComplete0()` on `IORING_OP_RECVMSG` takes `readMsgHdrMemory.getScmRightsFd()` → `CmsgHdr.readScmRights()`, which is a single `ByteBuffer.getInt` at the data offset. There is no `MSG_CTRUNC` check, no `nfds`, no close of extras, no `cmsg_level`/`cmsg_type` check. On 64-bit Linux the control buffer sized `CMSG_SPACE(sizeof(int))` is 24 bytes — identical to `CMSG_SPACE(2*sizeof(int))` after 8-byte align — so two fds fit without `MSG_CTRUNC` and the second stays open in the receiver.

### Details

CVE-2026-45536 (epoll/kqueue native path) added:

1. `MSG_CTRUNC` → error;
2. `nfds = (cmsg->cmsg_len - CMSG_LEN(0)) / sizeof(int)`;
3. if `nfds > 1`, close extras (and revoke an already-accepted fd).

io_uring fd-pass receive is:

- `IoUringDomainSocketChannel.readComplete0()` for `IORING_OP_RECVMSG`;
- `MsgHdrMemory.getScmRightsFd()` → `MsgHdr.getCmsgData()` → `CmsgHdr.readScmRights()`;
- `cmsghdr.getInt(cmsghdr.position() + cmsgHdrDataOffset)` only.

`MSGHDR_OFFSETOF_MSG_FLAGS` exists but is unused on this path.

64-bit Linux layout: `sizeof(struct cmsghdr)` = 16; `CMSG_LEN(4)` = 20; `CMSG_SPACE(4)` = `CMSG_ALIGN(20)` = 24; `CMSG_LEN(8)` = 24; `CMSG_SPACE(8)` = 24. Two packed `int` fds occupy the same control buffer Netty allocated for one. Kernel does not set `MSG_CTRUNC`. The second fd is duplicated into the process and never closed.

Trigger: a peer of an `IoUringDomainSocketChannel` in `DomainSocketReadMode.FILE_DESCRIPTORS` sends one `SCM_RIGHTS` cmsg with two fds. Each such message leaks one fd. Repeating hits `RLIMIT_NOFILE` (often 1024). Leaked fds remain in `/proc/self/fd`.

### Vulnerable code

`src/transport-classes-io_uring/src/main/java/io/netty/channel/uring/IoUringDomainSocketChannel.java` (lines 216–236) — RECVMSG completion takes one fd and fires it; no surplus close:

```java
        protected void readComplete0(byte op, int res, int flags, short data, int outstanding) {
            if (op == Native.IORING_OP_RECVMSG) {
                ...
                try {
                    int nativeCallResult = res >= 0 ? res : Errors.ioResult("io_uring recvmsg", res);
                    int nativeFd = readMsgHdrMemory.getScmRightsFd();
                    allocHandle.lastBytesRead(nativeFd);
                    allocHandle.incMessagesRead(1);
                    pipeline.fireChannelRead(new FileDescriptor(nativeFd));
                } catch (Throwable throwable) {
                    handleReadException(pipeline, null, throwable, false, allocHandle);
                } finally {
                    allocHandle.readComplete();
                    pipeline.fireChannelReadComplete();
                }
                return;
            }
```

`src/transport-classes-io_uring/src/main/java/io/netty/channel/uring/CmsgHdr.java` (lines 61–63) — only the first SCM_RIGHTS int:

```java
    static int readScmRights(ByteBuffer cmsghdr, int cmsgHdrDataOffset) {
        return cmsghdr.getInt(cmsghdr.position() + cmsgHdrDataOffset);
    }
```

Contrast: `src/transport-native-unix-common/src/main/c/netty_unix_socket.c` `netty_unix_socket_recvFd()` (CVE-2026-45536) checks `MSG_CTRUNC`, computes `nfds`, and closes extras — never called from io_uring.

### PoC

API recipe (Linux; Unix-domain peer of a Netty io_uring channel in `FILE_DESCRIPTORS` mode — the same control-buffer size Netty uses):

```python
# Create Unix domain socket pair
sock_a, sock_b = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)

# Open 2 files to get fds
fds_to_send = [os.open("/dev/null", os.O_RDONLY) for _ in range(2)]

# Send 2 fds in one SCM_RIGHTS cmsg
sock_a.sendmsg([b'\x00'], [(socket.SOL_SOCKET, 1, struct.pack("2i", *fds_to_send))])

# Close sender's copies
for fd in fds_to_send:
    os.close(fd)

# Receive with control buffer = CMSG_SPACE(sizeof(int)) = 24 bytes (same as Netty io_uring)
msg, ancdata, flags, addr = sock_b.recvmsg(1, 24)

# MSG_CTRUNC is NOT set (flags & MSG_CTRUNC == 0)
# SCM_RIGHTS cmsg contains 2 fds
# CmsgHdr.readScmRights() reads only the first fd
# Second fd is leaked (still open, never closed)
```

On the Netty side the first fd becomes `pipeline.fireChannelRead(new FileDescriptor(nativeFd))`; the second is never returned and never closed.

### Impact

Denial of service by file-descriptor exhaustion: a local (or otherwise connected) peer of an io_uring domain-socket channel in `DomainSocketReadMode.FILE_DESCRIPTORS` can leak one fd per two-fd `SCM_RIGHTS` send until the process cannot open files, sockets, or devices. Leftover fds may also be reachable via `/proc/self/fd`. epoll/kqueue no longer have this hole after CVE-2026-45536; io_uring still does. No extra credentials beyond the ability to send on that Unix socket.

## References

- https://github.com/netty/netty/security/advisories/GHSA-79q2-mhf4-2j6j

Page: https://cve.now/GHSA-79Q2-MHF4-2J6J

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