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

CVE-2026-108985: libnfs Buffer Overflow Vulnerability

CVE-2026-108985 is a buffer overflow vulnerability in libnfs through version 6.0.2 that causes out-of-bounds writes in ZDR decoding functions. This post explains its technical details, affected versions, impact, and mitigation steps.

Published:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-108985 Overview

CVE-2026-108985 is an out-of-bounds write vulnerability in libnfs, an open-source client library for accessing Network File System (NFS) shares. The flaw resides in the eXternal Data Representation (XDR) decoding logic implemented in lib/libnfs-zdr.c. Three routines fail to honor the caller-supplied maxsize parameter: libnfs_zdr_bytes(), libnfs_zdr_string(), and libnfs_zdr_array(). An attacker who controls encoded NFS/RPC messages can trigger memory corruption in applications linked against affected versions. The issue impacts libnfs through 6.0.2 prior to commit 7613236. The weakness is tracked as CWE-787.

Critical Impact

Remote attackers can trigger out-of-bounds writes in NFS clients and tools linked against libnfs, enabling denial of service and potential integrity compromise of adjacent memory.

Affected Products

  • libnfs versions through 6.0.2
  • All builds prior to upstream commit 7613236464317bee2d9636f087f995148de4db27
  • Downstream applications and distributions bundling vulnerable libnfs releases

Discovery Timeline

  • 2026-10-12 - CVE-2026-108985 published to NVD
  • 2026-10-16 - Last updated in NVD database

Technical Details for CVE-2026-108985

Vulnerability Analysis

The vulnerability resides in the ZDR (libnfs' XDR implementation) decoding path. XDR is the serialization format used by Open Network Computing Remote Procedure Call (ONC RPC), which NFS uses to transport messages. The functions libnfs_zdr_bytes(), libnfs_zdr_string(), and libnfs_zdr_array() accept a maxsize argument that callers use to bound the deserialized element count. Vulnerable versions do not enforce this bound, so an on-the-wire size field larger than the destination buffer causes the subsequent write to overflow the caller-allocated memory region.

Because the overflow is reached while parsing untrusted RPC payloads, the attack surface includes any process that uses libnfs to communicate with an attacker-controlled NFS or RPC endpoint. Exploitation requires user interaction such as mounting or connecting to a malicious server. Successful exploitation can corrupt heap or stack memory, crash the client, or alter adjacent data structures.

Root Cause

The root cause is missing input validation [CWE-787]. The ZDR decoders trusted the size value read from the wire and skipped comparison against the caller-supplied maxsize. The upstream fix introduces a helper, libnfs_zdr_size_ok(), which treats maxsize == 0 and maxsize == ~0u as sentinel values meaning "no limit" and rejects any size greater than maxsize for all other values.

Attack Vector

The attack vector is network-based with low complexity and requires user interaction. An attacker hosts a malicious NFS/RPC server and induces a victim client to connect, mount, or process a reply. Crafted ZDR-encoded responses carrying oversized length fields reach the vulnerable decoders and trigger the out-of-bounds write.

c
// Upstream patch excerpt - lib/libnfs-zdr.c
// Source: https://github.com/sahlberg/libnfs/commit/7613236464317bee2d9636f087f995148de4db27

/*
 * Positive maxsize values are hard limits. ~0 is what rpcgen emits when
 * the protocol states no limit. Zero is unlimited too: the AUTH
 * credential and verifier paths pass the live length, and a zeroed
 * object still has length zero.
 */
static bool_t libnfs_zdr_size_ok(uint32_t size, uint32_t maxsize)
{
        if (maxsize == 0 || maxsize == ~(uint32_t)0) {
                return TRUE;
        }
        return size <= maxsize;
}

bool_t libnfs_zdr_bytes(ZDR *zdrs, char **bufp, uint32_t *size, uint32_t maxsize)
{
        uint32_t zero = 0;
        int pad;

        if (zdrs->x_op == ZDR_ENCODE && !libnfs_zdr_size_ok(*size, maxsize)) {
                return FALSE;
        }

        if (!libnfs_zdr_u_int(zdrs, size)) {
                return FALSE;
        }

The patch adds the bound check at the entry of the affected routines and rejects oversized elements before any write occurs. See the upstream commit 7613236 for the full change.

Detection Methods for CVE-2026-108985

Indicators of Compromise

  • Unexpected crashes, aborts, or heap corruption diagnostics in processes linked against libnfs (for example kodi, qemu, nfs-ls, or custom clients).
  • Outbound NFS/RPC connections from endpoints to untrusted or newly-observed hosts on TCP/UDP ports 111 and 2049.
  • RPC replies containing length fields that exceed documented NFS record size limits for the given opcode.

Detection Strategies

  • Inventory binaries that dynamically link libnfs.so and statically track their versions against the upstream fix commit 7613236.
  • Deploy network monitoring that inspects RPC/NFS payloads and flags opaque elements where the on-the-wire length exceeds expected protocol bounds.
  • Enable AddressSanitizer or compiler hardening (-D_FORTIFY_SOURCE=3, stack canaries) during pre-production testing to surface the out-of-bounds write.

Monitoring Recommendations

  • Alert on crash telemetry (SIGSEGV, SIGABRT) from NFS client processes and correlate against recent outbound NFS sessions.
  • Monitor DNS and connection logs for new NFS server destinations introduced outside change management.
  • Centralize endpoint, application, and network telemetry to detect post-exploitation behavior following a client crash.

How to Mitigate CVE-2026-108985

Immediate Actions Required

  • Upgrade libnfs to a build that includes commit 7613236464317bee2d9636f087f995148de4db27 or later.
  • Rebuild and redistribute downstream applications that statically link libnfs.
  • Restrict outbound NFS traffic to known, trusted servers using host or network firewall policy.

Patch Information

The upstream fix is published in the libnfs repository as commit 7613236, titled "ZDR: enforce the maxsize bound." The patch introduces libnfs_zdr_size_ok() and applies the bound check in libnfs_zdr_bytes(), libnfs_zdr_string(), and libnfs_zdr_array(). See the GitHub libnfs commit for the full diff. Distribution maintainers should backport this change to packaged releases of libnfs 6.0.2 and earlier.

Workarounds

  • Avoid mounting or connecting to untrusted NFS servers until patched builds are deployed.
  • Block egress to TCP/UDP 111 (portmapper) and 2049 (nfs) at perimeter firewalls where NFS is not required.
  • Run NFS client applications under reduced privileges and with memory-hardening flags enabled.
bash
# Verify installed libnfs version and rebuild from patched source
ldconfig -p | grep libnfs

git clone https://github.com/sahlberg/libnfs.git
cd libnfs
git checkout 7613236464317bee2d9636f087f995148de4db27
./bootstrap && ./configure && make && sudo make install

# Restrict outbound NFS at the host firewall (example: nftables)
sudo nft add rule inet filter output tcp dport {111, 2049} ip daddr != 10.0.0.0/8 drop

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.