Skip to main content

Linux Kernel ksmbd CVE-2025-40039

MEDIUM
Race Condition (CWE-362)
2025-10-28 416baaa9-dc9f-4396-8d5f-8c081fb06d67
4.7
CVSS 3.1 · NVD
Share

Severity by source

NVD PRIMARY
4.7 MEDIUM
AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
vuln.today AI
4.7 MEDIUM

Race condition requires local SMB session authentication (PR:L), precise timing (AC:H), and yields kernel crash (A:H) with no confirmed confidentiality or integrity impact.

3.1 AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
4.0 AV:L/AC:H/AT:P/PR:L/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
SUSE
5.3 MEDIUM
AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:H

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Local
Attack Complexity
High
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Lifecycle Timeline

1
Analysis Generated
Jul 30, 2026 - 08:43 vuln.today

DescriptionNVD

In the Linux kernel, the following vulnerability has been resolved:

ksmbd: Fix race condition in RPC handle list access

The 'sess->rpc_handle_list' XArray manages RPC handles within a ksmbd session. Access to this list is intended to be protected by 'sess->rpc_lock' (an rw_semaphore). However, the locking implementation was flawed, leading to potential race conditions.

In ksmbd_session_rpc_open(), the code incorrectly acquired only a read lock before calling xa_store() and xa_erase(). Since these operations modify the XArray structure, a write lock is required to ensure exclusive access and prevent data corruption from concurrent modifications.

Furthermore, ksmbd_session_rpc_method() accessed the list using xa_load() without holding any lock at all. This could lead to reading inconsistent data or a potential use-after-free if an entry is concurrently removed and the pointer is dereferenced.

Fix these issues by:

  1. Using down_write() and up_write() in ksmbd_session_rpc_open()

to ensure exclusive access during XArray modification, and ensuring the lock is correctly released on error paths.

  1. Adding down_read() and up_read() in ksmbd_session_rpc_method()

to safely protect the lookup.

AnalysisAI

Race conditions in the ksmbd in-kernel SMB server's RPC handle list (sess->rpc_handle_list XArray) expose systems to use-after-free and kernel availability loss. ksmbd_session_rpc_open() incorrectly acquired only a read lock before performing mutating XArray operations, and ksmbd_session_rpc_method() performed xa_load() with no lock at all - creating a window where concurrent session operations can corrupt or dereference freed memory. No public exploit exists and EPSS is 0.13% (3rd percentile), placing real-world exploitation risk very low, though the use-after-free primitive carries latent potential beyond the scored availability impact.

Technical ContextAI

ksmbd is the Linux kernel's built-in SMB3 server, added in kernel 5.15, distinct from user-space Samba. Session state is tracked in per-session XArray structures (an extensible array optimized for RCU-friendly concurrent reads). CWE-362 (Concurrent Execution Using Shared Resource with Improper Synchronization) identifies the root cause: the rw_semaphore sess->rpc_lock was misapplied - xa_store() and xa_erase() are XArray write operations requiring exclusive (down_write) locking, but the code incorrectly used a read lock (down_read). xa_load() in ksmbd_session_rpc_method() was called entirely unprotected, violating the XArray locking contract and enabling concurrent removal to produce a dangling pointer dereference. The fix backports across multiple stable kernel branches, as evidenced by five separate patch commits targeting different stable series.

RemediationAI

Apply the upstream stable kernel patches, which are available across multiple stable branches at git.kernel.org/stable/c/305853cce379407090a73b38c5de5ba748893aee, git.kernel.org/stable/c/5cc679ba0f4505936124cd4179ba66bb0a4bd9f3, git.kernel.org/stable/c/69674b029002b1d90b655f014bdf64f404efa54d, git.kernel.org/stable/c/6b615a8fb3af0baf8126cde3d4fee97d57222ffc, and git.kernel.org/stable/c/6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1. Exact patched release versions are not independently confirmed from the provided data - track your distribution's kernel security advisories. As a compensating control, systems that do not require in-kernel SMB serving should unload or disable the ksmbd module (modprobe -r ksmbd or blacklist via /etc/modprobe.d/), which eliminates the attack surface entirely with no material side effect for systems already using user-space Samba. If ksmbd is required, restricting SMB access to trusted network segments via firewall rules (block TCP 445 from untrusted sources) limits the pool of potential concurrent session attackers.

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
openSUSE Tumbleweed Fixed
SUSE Linux Enterprise Desktop 15 SP7 Not-Affected
SUSE Linux Enterprise Desktop 15 SP7 Not-Affected
SUSE Linux Enterprise High Availability Extension 15 SP7 Not-Affected
SUSE Linux Enterprise High Availability Extension 15 SP7 Not-Affected

Share

CVE-2025-40039 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy