Skip to main content
Vulnerability Database/CVE-2026-98245

CVE-2026-98245: Linux Kernel Use-After-Free Vulnerability

CVE-2026-98245 is a use-after-free flaw in the Linux kernel btrfs filesystem that occurs during commit root iteration. This post explains its technical details, affected versions, impact, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-98245 Overview

CVE-2026-98245 is a use-after-free vulnerability in the Linux kernel's Btrfs filesystem. The flaw resides in mark_block_group_to_copy(), which iterates over the commit root with skip_locking=true. A concurrent transaction commit can swap and free the commit root during iteration, leaving stale pointers to extent buffers. Subsequent accesses dereference freed memory, triggering kernel memory corruption. The fix enforces proper synchronization through path->need_commit_sem to protect the commit root search.

Critical Impact

A race between mark_block_group_to_copy() and a concurrent transaction commit can trigger a use-after-free on Btrfs extent buffers, leading to kernel memory corruption or crashes.

Affected Products

  • Linux kernel Btrfs filesystem subsystem
  • Specific affected versions are enumerated in the upstream stable commits referenced below
  • Distributions shipping vulnerable kernel builds prior to backport

Discovery Timeline

  • 2026-10-06 - CVE-2026-98245 published to NVD
  • 2026-10-06 - Last updated in NVD database

Technical Details for CVE-2026-98245

Vulnerability Analysis

The vulnerability is a race condition that produces a use-after-free [CWE-416] in the Btrfs device replace path. mark_block_group_to_copy() walks the extent tree's commit root to enumerate block groups that need copying to the replacement device. Btrfs allows lockless reads of the commit root, so the function sets skip_locking=true on its search path.

This assumption breaks when a transaction commit executes concurrently. During commit, Btrfs swaps the live commit root for a newly committed one and releases the previous commit root along with its extent buffers. Any iterator still holding references to the old extent buffers now points at freed memory. Subsequent reads or writes against those buffers constitute a use-after-free in kernel address space.

The practical impact depends on allocator state at the moment of exploitation. Outcomes range from a kernel oops and denial of service to memory disclosure or, under favorable conditions, controlled corruption of adjacent kernel objects. The device replace workflow is the trigger surface, which requires privileges to invoke Btrfs management ioctls on affected volumes.

Root Cause

The root cause is missing synchronization between commit-root readers and transaction commit. mark_block_group_to_copy() skipped tree locking but did not acquire the commit root semaphore, so a committing transaction could free the extent buffers the function was still iterating.

Attack Vector

The attack vector is local. A caller with privileges sufficient to initiate a Btrfs device replace operation can race the operation against ongoing transaction commits. The vulnerability is described in the upstream Btrfs commit message and resolved in the referenced stable kernel patches (Kernel Git Commit 0594e34, Kernel Git Commit 709f6a5, Kernel Git Commit 8e2007b, Kernel Git Commit c32490c).

No public proof-of-concept exploit is available. The vulnerability is race-dependent and requires a Btrfs filesystem undergoing device replace while transaction commits occur. See the kernel commits above for the authoritative technical description.

Detection Methods for CVE-2026-98245

Indicators of Compromise

  • Kernel oops or panic traces referencing mark_block_group_to_copy, btrfs_search_slot, or extent buffer access functions.
  • KASAN use-after-free reports in Btrfs code paths when running kernels with address sanitizer enabled.
  • Unexpected Btrfs filesystem failures or device replace operations aborting with memory-related errors.

Detection Strategies

  • Compare installed kernel versions against the fixed commits published on git.kernel.org and flag hosts running unpatched Btrfs code.
  • Enable CONFIG_KASAN in test and staging kernels to surface use-after-free conditions during Btrfs device replace testing.
  • Audit invocations of the BTRFS_IOC_DEV_REPLACE ioctl in system logs and correlate with transaction commit activity.

Monitoring Recommendations

  • Forward dmesg and /var/log/kern.log to centralized logging and alert on Btrfs-related oops signatures.
  • Monitor filesystem health metrics on hosts using Btrfs, especially those running device replace operations in production.
  • Track kernel package versions across the fleet and alert when hosts drift from vendor-supplied patched builds.

How to Mitigate CVE-2026-98245

Immediate Actions Required

  • Apply the upstream Btrfs fix or the vendor kernel update that includes the referenced commits as soon as it is available for your distribution.
  • Restrict access to Btrfs management ioctls to trusted administrators only, limiting who can trigger device replace operations.
  • Avoid running btrfs replace start on production volumes until patched kernels are deployed.

Patch Information

The fix adds path->need_commit_sem to the commit root search in mark_block_group_to_copy(), acquiring the commit root semaphore to prevent the commit root from being freed during iteration. The patch is available in the upstream commits 0594e34, 709f6a5, 8e2007b, and c32490c. Consult your distribution's security advisories for backported kernel packages.

Workarounds

  • Defer Btrfs device replace operations until a patched kernel is running on the affected host.
  • Where feasible, migrate workloads off Btrfs volumes that require imminent device replacement until the patch is deployed.
  • Limit user accounts with CAP_SYS_ADMIN on hosts using Btrfs to reduce the attack surface for local triggers.

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.