CVE-2026-31402
Published: 03 April 2026
Description
In the Linux kernel, the following vulnerability has been resolved: nfsd: fix heap overflow in NFSv4.0 LOCK replay cache The NFSv4.0 replay cache uses a fixed 112-byte inline buffer (rp_ibuf[NFSD4_REPLAY_ISIZE]) to store encoded operation responses. This size was calculated based…
more
on OPEN responses and does not account for LOCK denied responses, which include the conflicting lock owner as a variable-length field up to 1024 bytes (NFS4_OPAQUE_LIMIT). When a LOCK operation is denied due to a conflict with an existing lock that has a large owner, nfsd4_encode_operation() copies the full encoded response into the undersized replay buffer via read_bytes_from_xdr_buf() with no bounds check. This results in a slab-out-of-bounds write of up to 944 bytes past the end of the buffer, corrupting adjacent heap memory. This can be triggered remotely by an unauthenticated attacker with two cooperating NFSv4.0 clients: one sets a lock with a large owner string, then the other requests a conflicting lock to provoke the denial. We could fix this by increasing NFSD4_REPLAY_ISIZE to allow for a full opaque, but that would increase the size of every stateowner, when most lockowners are not that large. Instead, fix this by checking the encoded response length against NFSD4_REPLAY_ISIZE before copying into the replay buffer. If the response is too large, set rp_buflen to 0 to skip caching the replay payload. The status is still cached, and the client already received the correct response on the original request.
Mitigating Controls (NIST 800-53 r5)AI
Flaw remediation directly prevents exploitation by applying kernel patches that add bounds checking to the NFSv4.0 replay cache buffer copy in nfsd4_encode_operation().
Memory protection mechanisms such as heap hardening and randomization mitigate the impact of the slab-out-of-bounds heap write triggered by oversized LOCK denied responses.
Vulnerability monitoring and scanning identifies the presence of CVE-2026-31402 in Linux kernels, enabling timely remediation of the NFSv4.0 replay cache overflow.
Security SummaryAI
CVE-2026-31402 is a heap overflow vulnerability in the Linux kernel's nfsd implementation for NFSv4.0. The NFSv4.0 replay cache employs a fixed 112-byte inline buffer to store encoded operation responses, sized based on OPEN responses. However, LOCK denied responses include a variable-length conflicting lock owner field up to 1024 bytes, exceeding the buffer capacity. During encoding, nfsd4_encode_operation() copies the full response into the undersized buffer without bounds checking via read_bytes_from_xdr_buf(), resulting in a slab-out-of-bounds write of up to 944 bytes, corrupting adjacent heap memory.
An unauthenticated remote attacker can exploit this vulnerability using two cooperating NFSv4.0 clients. One client sets a lock with a large owner string, while the other requests a conflicting lock, provoking a denial response that triggers the overflow. Successful exploitation leads to arbitrary heap memory corruption, with a CVSS v3.1 base score of 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H), potentially enabling code execution or denial of service on the NFS server.
Patches, available in multiple stable kernel commits such as 0f0e2a54a31a7f9ad2915db99156114872317388 and others linked from kernel.org, mitigate the issue by checking the encoded response length against the NFSD4_REPLAY_ISIZE (112 bytes) before copying into the replay buffer. If the response exceeds this size, the patch sets rp_buflen to 0, skipping caching of the payload while still caching the operation status, ensuring clients receive correct responses without enabling the overflow.
Details
- CWE(s)
MITRE ATT&CK Enterprise TechniquesAI
Why these techniques?
Unauthenticated remote heap overflow in Linux kernel NFSd enables exploitation of remote services (T1210) and kernel privilege escalation (T1068) via arbitrary code execution.