CVE-2025-40212: nfsd: fix refcount leak in nfsd_set_fh_dentry()
In the Linux kernel, the following vulnerability has been resolved:
nfsd: fix refcount leak in nfsd_set_fh_dentry()
nfsd exports a "pseudo root filesystem" which is used by NFSv4 to find
the various exported filesystems using LOOKUP requests from a known root
filehandle. NFSv3 uses the MOUNT protocol to find those exported
filesystems and so is not given access to the pseudo root filesystem.
If a v3 (or v2) client uses a filehandle from that filesystem,
nfsd_set_fh_dentry() will report an error, but still stores the export
in "struct svc_fh" even though it also drops the reference (exp_put()).
This means that when fh_put() is called an extra reference will be dropped
which can lead to use-after-free and possible denial of service.
Normal NFS usage will not provide a pseudo-root filehandle to a v3
client. This bug can only be triggered by the client synthesising an
incorrect filehandle.
To fix this we move the assignments to the svc_fh later, after all
possible error cases have been detected.
Security readout for executives and security teams
Plain-English summary
A malformed NFS filehandle sent by an NFSv2 or NFSv3 client can make an affected Linux NFS server release memory incorrectly. This may cause a use-after-free and service disruption. Normal NFS operation does not trigger the flaw; a client must deliberately synthesize an invalid filehandle.
Executive priority
Prioritize exposed NFS servers for prompt remediation, especially where untrusted clients can reach NFSv2/v3. This is not evidence of universal Linux exposure or active attacks. Inventory immediately, reduce network access, and patch affected servers through supported distribution channels.
Technical view
nfsd_set_fh_dentry() rejected a pseudo-root filehandle for NFSv2/v3 but retained an export pointer after dropping its reference. Later fh_put() could drop an additional reference, producing a use-after-free and possible denial of service. The fix delays svc_fh assignments until error checks succeed.
Likely exposure
Exposure is limited to affected Linux kernels running the kernel NFS server and reachable by clients using NFSv2 or NFSv3. The bundle lists 6.12, 6.12.59, 6.17.9, and 6.18 as affected, but distribution backports and the ambiguous โ0โ entry require vendor verification.
Exploitation context
The CVE is not listed as KEV, and the supplied sources provide no evidence of active exploitation or a public exploit. Triggering requires a client-generated invalid pseudo-root filehandle, which normal NFS usage does not provide to NFSv2/v3 clients. The practical concern supported by the description is denial of service.
Researcher notes
The supplied 9.8 CVSS vector claims high confidentiality, integrity, and availability impact, but the narrative directly substantiates only use-after-free and possible denial of service. It does not demonstrate information disclosure, code execution, or privilege escalation. Avoid inferring those outcomes without additional evidence.
Mitigation direction
Apply a vendor-supported kernel update incorporating the nfsd_set_fh_dentry() fix.
Restrict NFS access to trusted clients and networks until remediation is complete.
Disable unneeded NFSv2 or NFSv3 support according to vendor guidance.
Consult distribution guidance for backported package versions and reboot requirements.
Validation and detection
Confirm whether the Linux kernel NFS server is enabled on each host.
Identify whether affected systems accept NFSv2 or NFSv3 requests.
Map NFS reachability from untrusted, tenant, or Internet-connected networks.
Compare kernel package backport metadata with the cited stable fixes.
After updating, verify the running kernel contains the vendor-provided correction.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve ยท low confidence lookup
CVE-2025-40212 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
1CVSS vectors
3Timeline events
0ADP providers
4Source links
CVSS vector scores
1 official score
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.