CVE-2025-40205: Out-of-bounds write in Linux kernel Btrfs file-handle encoding
- Vendor
- Linux
CVE-2025-40205 is an out-of-bounds write vulnerability in the Linux kernel Btrfs btrfs_encode_fh() function, introduced in Linux 2.6.29. The function accounts for file handles requiring 20 or 32 bytes but fails to correctly validate the 40-byte format needed when a parent exists and its root ID differs from the inode's root ID. With an insufficient buffer length, assigning the parent root object ID causes an 8-byte out-of-bounds write. The flaw can corrupt kernel memory, although a realistic trigger has not been fully demonstrated and the condition is considered difficult to trigger.
Impact, mitigation & remediation
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
Impact
What an attacker gets, and what they’ve been doing with it.
Potential kernel memory corruption, system instability, and denial of service through an 8-byte out-of-bounds write. Severity assessments differ on confidentiality and integrity consequences; arbitrary code execution, privilege escalation, and information disclosure have not been demonstrated.
Mitigation
If you can’t patch tonight, do this now.
No vulnerability-specific workaround is established. Until the kernel can be updated, limit untrusted local access and restrict access to affected kernel interfaces where operationally feasible. These measures reduce exposure but do not correct the buffer-length validation flaw.
Remediation
Patch, then assume compromise.
Upgrade to a supported distribution kernel containing the fix and reboot into the updated kernel. Upstream fixed releases include 5.4.301, 5.10.246, 5.15.195, 6.1.157, 6.6.113, 6.12.54, 6.17.4, and 6.18-rc1. The fix calculates the required size for all three file-handle formats and checks *max_len before writing any data. Distribution backports may use different version numbers. Prefer a current supported kernel update rather than cherry-picking individual commits.
Exploits
No public exploits tracked yet. Mallory keeps watching.
Affected products & vendors
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
References
Frequently asked questions
- Is CVE-2025-40205 exploited in the wild?
- As of Dec 4, 2026, Mallory has no reports of CVE-2025-40205 being exploited in the wild. It is not listed in CISA KEV.
- Is there a public exploit for CVE-2025-40205?
- As of Dec 4, 2026, Mallory has found no public exploit for CVE-2025-40205.
- Is there a patch for CVE-2025-40205?
- Upgrade to a supported distribution kernel containing the fix and reboot into the updated kernel. Upstream fixed releases include 5.4.301, 5.10.246, 5.15.195, 6.1.157, 6.6.113, 6.12.54, 6.17.4, and 6.18-rc1.
- What products are affected by CVE-2025-40205?
- Linux Kernel.
- How severe is CVE-2025-40205?
- CVE-2025-40205 has a CVSS v3.1 score of 7.8 (High) and an EPSS score of 0.16% (5th percentile) as of Dec 4, 2026.
Recent activity
21 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.