In the Linux kernel, the following vulnerability has been resolved: btrfs: avoid potential out-of-bounds in btrfs_encode_fh() The function… (CVE-2025-40205)
A vulnerability in the Linux kernel's btrfs filesystem code was identified in the function btrfs_encode_fh(). The function improperly handles three cases for file handle sizes, leading to a potential out-of-bounds write of 8 bytes when the parent exists and root IDs differ. This memory corruption issue was resolved by correcting the size returned and validating buffer length before writing. The vulnerability is rated high severity due to its potential impact on confidentiality, integrity, and availability.
AI Analysis
Technical Summary
The Linux kernel's btrfs_encode_fh() function did not correctly account for all cases of file handle sizes it manages. Specifically, when a parent exists and the root ID of the parent and inode differ, the function writes a larger file handle size (40 bytes) than it originally reports (32 bytes). If the provided buffer length (*max_len) is insufficient, this leads to an 8-byte out-of-bounds write at fid->parent_root_objectid, causing potential memory corruption. A prior fix attempt was lost, but this issue has now been resolved by ensuring the function returns the correct size for all cases and validates buffer length before writing.
Potential Impact
This vulnerability can cause memory corruption due to an out-of-bounds write in the kernel's btrfs filesystem code. The CVSS 3.1 vector rates it as high severity with local attack vector, low complexity, low privileges required, no user interaction, and high impact on confidentiality, integrity, and availability. Although exploitation is not considered easily triggerable, successful exploitation could compromise system stability and security.
Mitigation Recommendations
A patch resolving this issue is available and should be applied to affected Linux kernel versions. The fix ensures correct file handle size reporting and validates buffer length before writing, preventing out-of-bounds writes. Since this is a kernel vulnerability, updating the kernel to a patched version is the recommended remediation. Patch status is not explicitly confirmed in the provided data; therefore, check the official Linux kernel advisories or vendor updates for the current remediation guidance.
In the Linux kernel, the following vulnerability has been resolved: btrfs: avoid potential out-of-bounds in btrfs_encode_fh() The function… (CVE-2025-40205)
Description
A vulnerability in the Linux kernel's btrfs filesystem code was identified in the function btrfs_encode_fh(). The function improperly handles three cases for file handle sizes, leading to a potential out-of-bounds write of 8 bytes when the parent exists and root IDs differ. This memory corruption issue was resolved by correcting the size returned and validating buffer length before writing. The vulnerability is rated high severity due to its potential impact on confidentiality, integrity, and availability.
CVSS v3.1
Score 7.8high
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The Linux kernel's btrfs_encode_fh() function did not correctly account for all cases of file handle sizes it manages. Specifically, when a parent exists and the root ID of the parent and inode differ, the function writes a larger file handle size (40 bytes) than it originally reports (32 bytes). If the provided buffer length (*max_len) is insufficient, this leads to an 8-byte out-of-bounds write at fid->parent_root_objectid, causing potential memory corruption. A prior fix attempt was lost, but this issue has now been resolved by ensuring the function returns the correct size for all cases and validates buffer length before writing.
Potential Impact
This vulnerability can cause memory corruption due to an out-of-bounds write in the kernel's btrfs filesystem code. The CVSS 3.1 vector rates it as high severity with local attack vector, low complexity, low privileges required, no user interaction, and high impact on confidentiality, integrity, and availability. Although exploitation is not considered easily triggerable, successful exploitation could compromise system stability and security.
Mitigation Recommendations
A patch resolving this issue is available and should be applied to affected Linux kernel versions. The fix ensures correct file handle size reporting and validates buffer length before writing, preventing out-of-bounds writes. Since this is a kernel vulnerability, updating the kernel to a patched version is the recommended remediation. Patch status is not explicitly confirmed in the provided data; therefore, check the official Linux kernel advisories or vendor updates for the current remediation guidance.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-7v4m-qg52-mxg3
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2025-40205"]
- Database Specific Severity
- HIGH
- Cvss Version
- 3.1
Threat ID: 6a6b72d69c2644c7f847a563
Added to database: 07/30/2026, 15:50:46 UTC
Last enriched: 07/30/2026, 16:54:48 UTC
Last updated: 09/10/2026, 19:38:44 UTC
Views: 9
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.