Skip to main content
Vulnerability Database/CVE-2024-26958

CVE-2024-26958: Linux Kernel Use-After-Free Vulnerability

CVE-2024-26958 is a use-after-free vulnerability in Linux Kernel NFS direct writes that causes refcount underflow and system warnings. This article covers the technical details, affected versions, and mitigation.

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-2024-26958 Overview

CVE-2024-26958 is a use-after-free (UAF) vulnerability [CWE-416] in the Linux kernel's Network File System (NFS) client. The flaw resides in the direct write commit path, where the nfs_direct_request structure can be completed twice due to a race between asynchronous commit submissions and completions. When the first commit finishes before subsequent commits are submitted, the refcount underflows and triggers a use-after-free condition. Linux maintainers resolved the issue by wrapping commit processing in a nfs_commit_begin()/nfs_commit_end() pair, matching the pattern already used in __nfs_commit_inode.

Critical Impact

A local attacker with the ability to perform NFS direct I/O can trigger kernel memory corruption, enabling denial of service or potential privilege escalation.

Affected Products

  • Linux Kernel (multiple stable branches prior to the fix commits)
  • Debian Linux 10.0 (addressed via Debian LTS)
  • Siemens industrial products shipping affected kernels (see Siemens SSA-265688)

Discovery Timeline

  • 2024-05-01 - CVE-2024-26958 published to the National Vulnerability Database (NVD)
  • 2024-06 - Debian LTS announcement published addressing the issue
  • 2026-10-15 - Last updated in NVD database

Technical Details for CVE-2024-26958

Vulnerability Analysis

The vulnerability occurs in nfs_direct_write_schedule_work, invoked from the nfsiod workqueue when NFS direct writes complete. The kernel log captures the condition as refcount_t: underflow; use-after-free originating in refcount_warn_saturate+0x9c/0xe0. The reproduction scenario in production involved a 200-node RocksDB stress test that reliably triggered the warning roughly every ten minutes.

After the patch, the same workload ran for several hours without reproducing the fault. Because the UAF corrupts kernel reference-counted objects, exploitation primitives extend beyond a crash: an attacker who can race commit submissions may reclaim the freed object with controlled data, enabling the loss of confidentiality, integrity, and availability indicated by the vulnerability's local attack metrics.

Root Cause

The root cause is unbalanced completion handling for asynchronous NFS commit requests. The direct write code calls nfs_commit_end(cinfo.mds) inside the completion path and invokes nfs_direct_write_complete(dreq) when the counter reaches zero. However, nfs_generic_commit_list() submits commits asynchronously, so an early completion can drive the counter to zero before all commits are queued. A subsequent submission then issues a second completion against the same nfs_direct_request, decrementing its refcount below zero.

Attack Vector

Exploitation requires local access and the ability to perform direct I/O against an NFS mount. The attacker schedules concurrent direct writes that produce many commit operations, maximizing the race window between nfs_generic_commit_list() submissions and completion callbacks fired from nfsiod workers. Successful races trigger the double completion and the corresponding refcount underflow on the shared nfs_direct_request object. No network-based preconditions, user interaction, or elevated privileges beyond standard filesystem access are required.

No verified public exploit code is available. Refer to the upstream fix in commit 6cd3f13a for the authoritative implementation of the nfs_commit_begin()/nfs_commit_end() wrapping that eliminates the race.

Detection Methods for CVE-2024-26958

Indicators of Compromise

  • Kernel log entries containing refcount_t: underflow; use-after-free with stack traces including nfs_direct_write_schedule_work and refcount_warn_saturate.
  • WARNING messages at lib/refcount.c:28 originating from the nfsiod workqueue.
  • Unexpected process crashes or kernel oopses on hosts performing NFS direct I/O under concurrent write load.

Detection Strategies

  • Monitor dmesg and /var/log/kern.log for refcount saturation warnings tied to NFS workqueues.
  • Correlate kernel panics on NFS clients with workloads known to issue direct writes, such as database stress tests or RocksDB-style compaction jobs.
  • Inventory running kernel versions against the fixed commits listed in the kernel.org advisories to identify unpatched hosts.

Monitoring Recommendations

  • Forward kernel ring buffer events to a centralized log platform and alert on refcount_warn_saturate and use-after-free keywords.
  • Track NFS client version and mount options across the fleet; flag hosts using O_DIRECT against NFS without the fix applied.
  • Enable kernel audit rules for module loads and workqueue anomalies on systems exposing NFS to multi-tenant workloads.

How to Mitigate CVE-2024-26958

Immediate Actions Required

Patch Information

The fix wraps commit list processing with nfs_commit_begin() and nfs_commit_end(), mirroring the pattern used in __nfs_commit_inode. This guarantees that nfs_direct_write_complete(dreq) is called only once per nfs_direct_request. Backports are available across multiple stable branches, as enumerated in the vendor advisory URLs. Confirm the running kernel version with uname -r after patching and reboot to activate the corrected code path.

Workarounds

  • Avoid NFS mounts with O_DIRECT write workloads on unpatched kernels until the update is deployed.
  • Restrict local shell access on NFS clients to trusted users to reduce the pool of accounts capable of triggering the race.
  • Where feasible, substitute buffered I/O or alternative transports for high-concurrency write workloads pending patch deployment.
bash
# Verify kernel version after patching
uname -r

# On Debian, apply the LTS fix
sudo apt update && sudo apt install --only-upgrade linux-image-$(uname -r | sed 's/.*-//')

# Reboot to load the patched kernel
sudo reboot

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.