CVE-2026-31403
Description
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.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
NFSD in the Linux kernel fails to hold a network namespace reference for open /proc/fs/nfs/exports file descriptors, leading to a use-after-free when the namespace is torn down.
Vulnerability
Overview
CVE-2026-31403 describes a use-after-free vulnerability in the Linux kernel's NFS server (NFSD). The /proc/fs/nfs/exports proc entry is created at module init and persists for the module's lifetime. When exports_proc_open() is called, it captures the caller's current network namespace and stores a pointer to its svc_export_cache in the seq_file's private data, but it does not take a reference on the namespace. This means that if the namespace is subsequently torn down (for example, when a container is destroyed after the opener calls setns() to a different namespace), nfsd_net_exit() will call nfsd_export_shutdown(), which frees the cache. Any subsequent read on the still-open file descriptor will then dereference the freed cache_detail, walking a freed hash table [1][2].
Exploitation
Scenario
The attack surface is local; an attacker must have the ability to open /proc/fs/nfs/exports and then trigger namespace teardown while keeping the file descriptor open. This is plausible in container environments where a process inside a container opens the file, switches namespaces, and then the container is destroyed. The attacker does not need any special privileges beyond being able to read the proc file and influence namespace lifecycle [3][4].
Impact
Successful exploitation leads to a use-after-free condition. This can result in a kernel crash (denial of service) or potentially arbitrary code execution, depending on the state of the freed memory. The CVSS v3 score of 7.8 (High) reflects the possibility of local privilege escalation or system compromise [1][2].
Mitigation
The fix, committed in the Linux kernel stable tree (commits db4a9f99b12a, c7f406fb341d, d1a19217995, e3d77f93563), holds a reference on the struct net for the lifetime of the open file descriptor. This prevents nfsd_net_exit() from running while any exports fd is open, thus preventing the cache from being freed prematurely. Users should apply the latest kernel updates to resolve this vulnerability [1][2][3][4].
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
2Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
7- git.kernel.org/stable/c/6a8d70e2ad6aad2c345a5048edcb8168036f97d6nvdPatch
- git.kernel.org/stable/c/76740c28050dc6db2f5550f1325b00a11bbb3255nvdPatch
- git.kernel.org/stable/c/c7f406fb341d6747634b8b1fa5461656e5e56076nvdPatch
- git.kernel.org/stable/c/d1a19217995df9c7e4118f5a2820c5032fef2945nvdPatch
- git.kernel.org/stable/c/db4a9f99b12a7ee1c19d86c83a3b752c7effa6c6nvdPatch
- git.kernel.org/stable/c/e3d77f935639e6ae4b381c80464c31df998d61f4nvdPatch
- git.kernel.org/stable/c/e7fcf179b82d3a3730fd8615da01b087cc654d0bnvdPatch
News mentions
0No linked articles in our index yet.