KernelScan.io

HIGH

nfsd ExportCache UAF

CVE-2026-31403

CVSS 7.8 / 10.0 NVD

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI7.8HIGH

01

In the Linux kernel, the following vulnerability has been resolved: NFSD: Hold net reference for the lifetime of /proc/fs/nfs/exports fd The /proc/fs/nfs/exports proc entry is created at module init and persists for the module's lifetime. exports_proc_open() captures the caller's current network namespace and stores its svc_export_cache in seq->private, but takes no reference on the namespace. If the namespace is subsequently torn down (e.g. container destruction after the opener does setns() to a different namespace), nfsd_net_exit() calls nfsd_export_shutdown() which frees the cache. Subsequent reads on the still-open fd dereference the freed cache_detail, walking a freed hash table. Hold a reference on the struct net for the lifetime of the open file descriptor. This prevents nfsd_net_exit() from running -- and thus prevents nfsd_export_shutdown() from freeing the cache -- while any exports fd is open. cache_detail already stores its net pointer (cd->net, set by cache_create_net()), so exports_release() can retrieve it without additional per-file storage.

02

Engine v0.2.0

Risk summary

Local users with low privileges can trigger a use-after-free vulnerability in the NFSD export cache by opening /proc/fs/nfs/exports in a network namespace and subsequently destroying that namespace while the file descriptor remains open. Subsequent reads dereference the freed cache_detail and hash table, leading to information disclosure, memory corruption, and potential kernel panic.

Affectedfs/nfsd/nfsctl.c (NFSD)

Vulnerability analysis

The vulnerability occurs because exports_proc_open() captures the caller's network namespace and stores its svc_export_cache in seq->private without taking a reference on the namespace. When the namespace is subsequently torn down (e.g., container destruction after setns() or process exit), nfsd_net_exit() calls nfsd_export_shutdown() which frees the cache while file descriptors remain open. Subsequent reads on the still-open fd dereference the freed cache_detail, walking a freed hash table and causing a use-after-free condition. The fix adds get_net() in exports_net_open() and put_net() in a new exports_release() function to hold a network namespace reference for the lifetime of the open file descriptor, preventing premature cache destruction.

03

BranchFixed inPatch commit
5.105.10.25376740c28050d
6.16.1.167c7f406fb341d
6.126.12.78e3d77f935639
6.186.18.20db4a9f99b12a
6.196.19.106a8d70e2ad6a
6.66.6.130d1a19217995d
mainline7.0e7fcf179b82d