LiveActive security incident?Get immediate response
CVE Record

CVE-2025-40205: btrfs: avoid potential out-of-bounds in btrfs_encode_fh()

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.

HighCVSS 7.8Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

A Linux Btrfs file-handle operation can write eight bytes beyond an allocated buffer under a specific parent/root relationship. This may corrupt kernel memory, potentially affecting confidentiality, integrity, or availability. The source says triggering appears difficult, but the kernel-level impact warrants timely remediation on exposed Btrfs systems.

Executive priority

Treat as a high-priority kernel maintenance issue, especially on multi-user or shared systems using Btrfs. It is not supported as an emergency internet-wide threat because exploitation requires local access, the trigger appears difficult, and no active exploitation evidence is supplied. Remediate through scheduled accelerated patching rather than deferral.

Technical view

btrfs_encode_fh() can report an eight-dword buffer requirement while later writing the ten-dword connectable-root format. When a parent exists and its root ID differs from the inode root ID, writing parent_root_objectid causes an eight-byte out-of-bounds write. The fix returns the correct size and validates max_len before writing.

Likely exposure

Exposure requires an affected Linux kernel and use of the relevant Btrfs file-handle encoding path. The supplied affected-version data includes several kernel versions through 6.18, but does not clearly express complete version ranges. Confirm applicability through the distribution or kernel vendor rather than relying solely on those flattened entries.

Exploitation context

CVSS 3.1 rates this 7.8 with local access and low privileges required, without user interaction. The source describes potential kernel memory corruption but says the issue does not appear easily triggerable. It is not listed as KEV, and the supplied sources provide no evidence of active exploitation or a public exploit.

Researcher notes

The vulnerable condition involves a parent whose root object ID differs from the inode root ID. The function can understate required storage by two dwords before an eight-byte write. No CWE is supplied. The record establishes memory-corruption potential, but does not establish reliable privilege escalation, exploitability, observed attacks, or complete affected-version boundaries.

Mitigation direction

  • Update to a vendor-supported kernel containing the referenced Btrfs stable fix.
  • Check distribution advisories for the exact fixed package and affected release mapping.
  • Prioritize systems using Btrfs and allowing access by untrusted local users.
  • Apply normal kernel-update reboot requirements so the corrected kernel is running.

Validation and detection

  • Inventory running kernel versions and identify systems with active Btrfs filesystems.
  • Compare each kernel package against its distribution advisory and fixed build.
  • Confirm the running kernel incorporates the applicable referenced stable commit or vendor backport.
  • Regression-test legitimate Btrfs file-handle and export workflows after updating.
Prepared
Confidence
medium
Sources
10

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-40205 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
High
CVSS
7.8 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

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
9Source 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.

ScoreVersionSeverityVectorExploitImpactSource
7.8CVSS 3.1HighCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H1.85.9Linux

Vulnerability scoring details

Base CVSS 3.1 score

7.8High
CVSS 3.1 vector shape for CVE-2025-40205Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone

Vulnerability timeline

Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.

  1. CVE reservedCVE Program

    The CVE ID was reserved by the assigning CNA.

  2. CVE publishedCVE Program

    The CVE record was published.

  3. CVE updatedCVE Program

    The CVE record metadata indicates this as the latest update time.

Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
LinuxLinuxbe6e8dc0ba84029997075a1ec77b4ddb863cbe15, be6e8dc0ba84029997075a1ec77b4ddb863cbe15, be6e8dc0ba84029997075a1ec77b4ddb863cbe15, be6e8dc0ba84029997075a1ec77b4ddb863cbe15, be6e8dc0ba84029997075a1ec77b4ddb863cbe15, be6e8dc0ba84029997075a1ec77b4ddb863cbe15, be6e8dc0ba84029997075a1ec77b4ddb863cbe15, be6e8dc0ba84029997075a1ec77b4ddb863cbe15unaffected
LinuxLinux2.6.29, 0, 5.4.301, 5.10.246, 5.15.195, 6.1.157, 6.6.113, 6.12.54, 6.17.4, 6.18affected
Weakness

CWE details

No CWE listed

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.