HIGH
nfsd ExportCache UAF
CVE-2026-31403
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
KernelScan AI7.8HIGH
01Description
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.
02KernelScan AI Analysis
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.
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.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 5.10 | 5.10.253 | 76740c28050d |
| 6.1 | 6.1.167 | c7f406fb341d |
| 6.12 | 6.12.78 | e3d77f935639 |
| 6.18 | 6.18.20 | db4a9f99b12a |
| 6.19 | 6.19.10 | 6a8d70e2ad6a |
| 6.6 | 6.6.130 | d1a19217995d |
| mainline | 7.0 | e7fcf179b82d |