CVE-2025-40205
btrfs: avoid potential out-of-bounds in btrfs_encode_fh()
Mitigation
- No fix listed yet: follow the vendor advisory.
Who should check
- Anyone running Linux >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 742b44342204e5dfe3926433823623c1a0c581df; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d3a9a8e1275eb9b87f006b5562a287aea3f6885f; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d91f6626133698362bba08fbc04bd72c466806d3; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 0276c8582488022f057b4cec21975a5edf079f47; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 361d67276eb8ec6be8f27f4ad6c6090459438fee; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 43143776b0a7604d873d1a6f3e552a00aa930224; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < dff4f9ff5d7f289e4545cc936362e01ed3252742
- Anyone running Linux 2.6.29
Vulnerability facts
- Affected
- Linux >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 742b44342204e5dfe3926433823623c1a0c581df; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d3a9a8e1275eb9b87f006b5562a287aea3f6885f; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d91f6626133698362bba08fbc04bd72c466806d3; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 0276c8582488022f057b4cec21975a5edf079f47; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 361d67276eb8ec6be8f27f4ad6c6090459438fee; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 43143776b0a7604d873d1a6f3e552a00aa930224; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < dff4f9ff5d7f289e4545cc936362e01ed3252742; Linux 2.6.29
- Fixed in
- Linux 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db, Linux 742b44342204e5dfe3926433823623c1a0c581df, Linux 0276c8582488022f057b4cec21975a5edf079f47, Linux 361d67276eb8ec6be8f27f4ad6c6090459438fee, Linux 43143776b0a7604d873d1a6f3e552a00aa930224
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 7.8 (v3.1, CNA)CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: Low
- Privileges required: Low
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: High
- EPSS
- 0.23% chance of exploitation in 30 days (percentile 9, 2026-11-26)
- Modified
Description
In the Linux kernel, the following vulnerability has been resolved: btrfs: avoid potential out-of-bounds in btrfs_encode_fh() The function btrfs_encode_fh() does not properly account for the three cases it handles. Before writing to the file handle (fh), the function only returns to the user BTRFS_FID_SIZE_NON_CONNECTABLE (5 dwords, 20 bytes) or BTRFS_FID_SIZE_CONNECTABLE (8 dwords, 32 bytes). However, when a parent exists and the root ID of the parent and the inode are different, the function writes BTRFS_FID_SIZE_CONNECTABLE_ROOT (10 dwords, 40 bytes). If *max_len is not large enough, this write goes out of bounds because BTRFS_FID_SIZE_CONNECTABLE_ROOT is greater than BTRFS_FID_SIZE_CONNECTABLE originally returned. This results in an 8-byte out-of-bounds write at fid->parent_root_objectid = parent_root_id. A previous attempt to fix this issue was made but was lost. https://lore.kernel.org/all/4CADAEEC020000780001B32C@vpn.id2.novell.com/ Although this issue does not seem to be easily triggerable, it is a potential memory corruption bug that should be fixed. This patch resolves the issue by ensuring the function returns the appropriate size for all three cases and validates that *max_len is large enough before writing any data.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| Linux | >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 742b44342204e5dfe3926433823623c1a0c581df; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d3a9a8e1275eb9b87f006b5562a287aea3f6885f; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d91f6626133698362bba08fbc04bd72c466806d3; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 0276c8582488022f057b4cec21975a5edf079f47; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 361d67276eb8ec6be8f27f4ad6c6090459438fee; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 43143776b0a7604d873d1a6f3e552a00aa930224; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < dff4f9ff5d7f289e4545cc936362e01ed3252742 | — | cvelist |
| Linux | 2.6.29 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2025-40205. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2025-40205.md Affected: Linux >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 742b44342204e5dfe3926433823623c1a0c581df; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d3a9a8e1275eb9b87f006b5562a287aea3f6885f; >= be6e8dc0ba84029997075a1… Fixed in: Linux 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db, Linux 742b44342204e5dfe3926433823623c1a0c581df, Linux 0276c8582488022f057b4cec21975a5edf079f47, Linux 361d67276eb8ec6be8f27f4ad6c6090459438fee, Linux 43143776b0a7604d873d1a6f3e552a00aa930224 Steps: 1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Other
- https://git.kernel.org/stable/c/60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db
- https://git.kernel.org/stable/c/742b44342204e5dfe3926433823623c1a0c581df
- https://git.kernel.org/stable/c/d3a9a8e1275eb9b87f006b5562a287aea3f6885f
- https://git.kernel.org/stable/c/d91f6626133698362bba08fbc04bd72c466806d3
- https://git.kernel.org/stable/c/0276c8582488022f057b4cec21975a5edf079f47
- https://git.kernel.org/stable/c/361d67276eb8ec6be8f27f4ad6c6090459438fee
- https://git.kernel.org/stable/c/43143776b0a7604d873d1a6f3e552a00aa930224
- https://git.kernel.org/stable/c/dff4f9ff5d7f289e4545cc936362e01ed3252742
FAQ
Is CVE-2025-40205 being exploited?
There is no confirmed exploitation: CVE-2025-40205 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.23% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2025-40205?
High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).
Which versions are affected by CVE-2025-40205?
Linux >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 742b44342204e5dfe3926433823623c1a0c581df; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d3a9a8e1275eb9b87f006b5562a287aea3f6885f; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < d91f6626133698362bba08fbc04bd72c466806d3; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 0276c8582488022f057b4cec21975a5edf079f47; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 361d67276eb8ec6be8f27f4ad6c6090459438fee; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < 43143776b0a7604d873d1a6f3e552a00aa930224; >= be6e8dc0ba84029997075a1ec77b4ddb863cbe15, < dff4f9ff5d7f289e4545cc936362e01ed3252742; Linux 2.6.29.
Is there a fix for CVE-2025-40205?
Yes. Fixed in Linux 60de2f55d2aca53e81b4ef2a67d7cc9e1eb677db, Linux 742b44342204e5dfe3926433823623c1a0c581df, Linux 0276c8582488022f057b4cec21975a5edf079f47, Linux 361d67276eb8ec6be8f27f4ad6c6090459438fee, Linux 43143776b0a7604d873d1a6f3e552a00aa930224. No fix listed yet: follow the vendor advisory.
How do I check if I'm affected by CVE-2025-40205?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.