Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-57918

CVE-2026-57918: libnfs Integer Underflow Vulnerability

CVE-2026-57918 is an xid integer underflow vulnerability in libnfs through version 6.0.2 that occurs during NFS server connections. This article covers the technical details, affected versions, security impact, and mitigation.

Published:

CVE-2026-57918 Overview

CVE-2026-57918 is an integer underflow vulnerability [CWE-191] in libnfs through version 6.0.2, before commit 935b8db. The flaw resides in the READ_IOVEC case of rpc_read_from_socket in lib/socket.c. A crafted Network File System (NFS) server can trigger the underflow when the expected Protocol Data Unit (PDU) size exceeds the absolute PDU size derived from the xid/record-marker. The condition affects clients that connect to a malicious NFS server, corrupting the transaction identifier (xid) tracking used to reassemble RPC responses.

Critical Impact

A malicious NFS server can trigger memory corruption in connecting libnfs clients, leading to high confidentiality and integrity impact with potential availability loss.

Affected Products

  • libnfs versions through 6.0.2
  • Any application or client linking against vulnerable libnfs builds prior to commit 935b8db
  • Downstream projects and distributions bundling libnfs 6.x

Discovery Timeline

  • 2026-06-26 - CVE CVE-2026-57918 published to NVD
  • 2026-06-26 - Last updated in NVD database

Technical Details for CVE-2026-57918

Vulnerability Analysis

The vulnerability occurs in the READ_IOVEC state machine branch of rpc_read_from_socket inside lib/socket.c. libnfs tracks the remaining bytes of an RPC record using rpc->rm_xid[0], which is decremented by rpc->pdu_size as data is consumed. When a crafted server advertises a record marker smaller than the expected PDU size, the subtraction wraps around, producing a very large unsigned value.

This underflow desynchronizes the record parser and causes the client to read attacker-controlled data as if it belonged to a valid RPC transaction. Downstream code paths handling the corrupted rm_xid[0] value can produce out-of-bounds memory access and process instability during NFS operations.

Root Cause

The root cause is missing bounds validation before an unsigned subtraction. The code subtracted rpc->pdu_size from rpc->rm_xid[0] without verifying that rm_xid[0] was at least as large as pdu_size. Any smaller value produced an integer underflow, classified as [CWE-191].

Attack Vector

Exploitation requires the victim to initiate or accept a connection to an attacker-controlled NFS server. The server returns malformed record markers whose xid field encodes a length smaller than the parser's expected PDU size. User interaction is required because the client must mount or open a resource served by the malicious host.

c
// Patch: lib/socket.c - prevent underflow in xid subtraction
                                break;
                        case READ_IOVEC:
                                rpc->pdu->read_count -= rpc->pdu_size;
+                               if (rpc->rm_xid[0] < rpc->pdu_size) {
+                                       return -1;
+                               }
                                rpc->rm_xid[0] -= rpc->pdu_size;
                                if (!rpc->rm_xid[0]) {
                                        rpc_finished_pdu(rpc);

Source: libnfs commit 935b8db. The patch adds an explicit bounds check that aborts RPC processing when the record-marker value is smaller than the current PDU size.

Detection Methods for CVE-2026-57918

Indicators of Compromise

  • Unexpected crashes or aborts in processes linking against libnfs.so during NFS mount or read operations
  • Outbound NFS/RPC connections from clients to untrusted or non-corporate NFS servers on TCP/2049 or portmapper ports
  • Malformed RPC record markers where the declared length is smaller than the payload size actually transmitted

Detection Strategies

  • Inventory hosts, containers, and applications that ship or dynamically link libnfs and flag versions at or below 6.0.2 lacking commit 935b8db
  • Deploy network monitoring rules to detect NFS traffic to destinations outside approved server ranges
  • Correlate process crash telemetry with concurrent NFS client activity to identify triggered underflow attempts

Monitoring Recommendations

  • Log and alert on new outbound NFS/RPC sessions initiated by workloads that do not normally consume network file systems
  • Monitor Endpoint Detection and Response (EDR) telemetry for repeated segmentation faults in processes using libnfs
  • Track package inventory changes to confirm libnfs updates are deployed across Linux distributions and container images

How to Mitigate CVE-2026-57918

Immediate Actions Required

  • Upgrade libnfs to a build that includes commit 935b8db or a later release beyond 6.0.2
  • Audit all applications, containers, and virtual machine images for bundled or statically linked libnfs copies and rebuild them against the patched library
  • Restrict outbound NFS connectivity to a defined allowlist of trusted server addresses at the network firewall

Patch Information

The fix is available in the upstream libnfs repository as commit 935b8db712b3c6649bc57ddc276526c4a31680de, titled "socket: prevent an underflow in xid." See the libnfs commit reference for the exact change to lib/socket.c. Distribution maintainers should backport this commit to any supported libnfs 6.x package.

Workarounds

  • Block client connections to untrusted NFS servers using host or perimeter firewall rules until patched binaries are deployed
  • Disable or remove NFS client functionality in applications that do not require it
  • Enforce network segmentation so that workloads consuming libnfs can only reach approved internal NFS servers
bash
# Example: restrict outbound NFS traffic to an approved server allowlist
iptables -A OUTPUT -p tcp --dport 2049 -d 10.10.20.0/24 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 2049 -j REJECT
iptables -A OUTPUT -p udp --dport 2049 -j REJECT

# Verify installed libnfs version on Debian/Ubuntu
dpkg -l | grep libnfs

# Verify installed libnfs version on RHEL/Fedora
rpm -q libnfs

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.