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
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Establish authenticated SMB session to ksmbd server
  2. Delivery
    Open concurrent RPC handles on same session
  3. Exploit
    Race ksmbd_session_rpc_open() write under read-only lock
  4. Execution
    Trigger concurrent xa_load() in ksmbd_session_rpc_method() without any lock
  5. Persist
    Dereference freed RPC handle pointer
  6. Impact
    Kernel crash or memory corruption

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2025 - Insecure Design
ASVS 5.0
V15 - Secure Coding and Architecture Concurrency control, locking
MITRE ATT&CK

1 technique across 1 tactic: Privilege Escalation

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

The ksmbd module must be loaded and actively serving SMB sessions (CONFIG_SMB_SERVER=m or =y in the kernel build, and the service must be running). An attacker must hold at least one authenticated SMB session to the ksmbd server, placing them in the PR:L category. The race condition requires concurrent RPC handle open and lookup or removal operations on the same session - limiting exploitation to timing-sensitive multi-threaded or multi-connection scenarios. The high attack complexity (AC:H) reflects this timing constraint. Systems using user-space Samba instead of ksmbd are not affected. Non-default configuration applies: ksmbd is not the default SMB implementation in most mainstream distributions.

Impact

CVSS 3.1 scores this at 4.7 (Medium) with vector AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H, reflecting a local, low-privileged attacker who must win a precise race - high attack complexity (AC:H) correctly captures the timing requirement inherent to race conditions. EPSS of 0.13% (3rd percentile) is consistent with no known public exploit and the narrow exploitability window. The vulnerability is not listed in CISA KEV. The SSVC calculus supports a low-urgency posture: exploitation is not confirmed, automation is difficult due to AC:H, and technical impact is limited to denial of service under the scored metrics. However, the description explicitly mentions use-after-free risk, which in kernel context carries potential for memory disclosure or privilege escalation beyond the A:H scoring - this gap between the CVSS impact score and the actual primitive is worth noting. The CVSS C:N/I:N scoring may understate theoretical risk but is defensible given no demonstrated exploit chain.

Exploit ScenarioDerived

An authenticated SMB user with an established ksmbd session opens multiple concurrent RPC handles while another thread simultaneously closes one, timing the operation to hit the unprotected xa_load() window in ksmbd_session_rpc_method() after the handle entry has been erased from the XArray but before the dereferenced pointer is invalidated - triggering a use-after-free that crashes the kernel or corrupts session state. No public proof-of-concept exists at time of analysis; the race window is narrow and exploitation requires precise timing.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 30, 2026

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.

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.

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

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.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

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

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.

Threat Intelligence Overview

EPSS Score
0.1%
Top 97% exploitable
Prevalence
Medium
ksmbd not default-enabled; used mainly in NAS and embedded Linux
Data Quality
4 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

24
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +24
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Race conditions occur when multiple concurrent requests exploit the brief time gap between checking a condition and acting upon it (TOCTOU - Time of Check, Time of Use).

Affected Products (CPE)NVD

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*

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

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