Skip to main content

Linux Kernel ksmbd CVE-2025-40090

MEDIUM
Uncontrolled Recursion (CWE-674)
2025-10-30 416baaa9-dc9f-4396-8d5f-8c081fb06d67
5.5
CVSS 3.1 · NVD
View

Attack ChainAIDerived

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

  1. Access
    Authenticate to ksmbd SMB server over network
  2. Delivery
    Open named pipe (IPC$ RPC operation)
  3. Exploit
    ksmbd_session_rpc_open acquires sess->rpc_lock write
  4. Execution
    Recursive down_read on same lock in ksmbd_session_rpc_method
  5. Persist
    ksmbd worker thread deadlocks
  6. Impact
    SMB service denied

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Recursion depth limits
Exploitation Conditions

Exploitation requires all of the following: (1) ksmbd is compiled into the kernel (CONFIG_SMB_SERVER=y or =m) AND the ksmbd daemon is running - this is not a default configuration on any major Linux distribution and requires deliberate administrator enablement; (2) the attacker holds valid SMB credentials (username and password) sufficient to authenticate to the ksmbd server; (3) the authenticated session attempts to open a named pipe via IPC$ (any MSRPC operation such as srvinfo, enumdomains, or standard Windows pipe operations). The deadlock triggers deterministically on every named pipe open - there is no timing window or race to win. Limiting factors: ksmbd is niche and non-default; guest or anonymous access may not be sufficient depending on ksmbd share configuration; the impact is scoped to the SMB service and does not propagate to the broader kernel or other services.

Impact

The official CVSS 3.1 vector CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H scores 5.5 (Medium), but the AV:L (local) designation is misleading: as the description demonstrates with a remote rpcclient invocation, the deadlock is triggered by a network SMB client, not local code execution. A more accurate assessment would use AV:N, raising the effective score. EPSS of 0.14% (4th percentile) indicates very low exploitation probability in the wild, consistent with the absence from CISA KEV and no known POC. The real-world risk is bounded by ksmbd's deployment prevalence - it is not a default service on any major Linux distribution and must be explicitly enabled. However, for systems that do run ksmbd (e.g., embedded NAS appliances, hobbyist file servers), exploitation is trivially repeatable by any authenticated SMB user, making patching high priority in that context. The NVD tags include 'Information Disclosure,' which conflicts with the CVSS C:N rating and the description; this tag appears to be a mis-categorization - the actual impact is availability-only (denial of service). No confidentiality or integrity impact is evidenced.

Exploit ScenarioDerived

An attacker with valid SMB credentials connects to a Linux host running ksmbd using any SMB client (e.g., rpcclient, smbclient, or a Windows file explorer session pointing to IPC$) and opens a named pipe - operations such as 'srvinfo', 'enumdomains', or any MSRPC call trigger this path. The ksmbd worker thread processing the SMB2 CREATE request for the named pipe acquires sess->rpc_lock for writing, then re-enters ksmbd_session_rpc_method and blocks attempting the read lock, hanging indefinitely. Repeated invocations exhaust the ksmbd-io workqueue threads, denying SMB service to all clients.

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

Recursive rwsem deadlock in the Linux kernel's ksmbd SMB server subsystem causes ksmbd worker threads to hang indefinitely when any SMB client opens a named pipe, resulting in denial of service for all SMB connections. The flaw was introduced by commit 305853cce3794, which fixed a race condition in RPC handle list access but inadvertently created a deadlock: ksmbd_session_rpc_open acquires sess->rpc_lock as a write lock, then calls ksmbd_rpc_open → ksmbd_session_rpc_method, which attempts to re-acquire the same lock as a read lock - blocking the kernel worker thread indefinitely. No public exploit code exists and EPSS is 0.14% (4th percentile), but the trigger is deterministic and reliable against any ksmbd deployment once valid SMB credentials are obtained. This vulnerability is not in CISA KEV.

RemediationAI

Apply the upstream stable-tree patches available at https://git.kernel.org/stable/c/1891abe832cbf5a11039e088766131d0f1642d02, https://git.kernel.org/stable/c/3412fbd81b46b9cfae013817b61d4bbd27e09e36, https://git.kernel.org/stable/c/4602b8cee1481dbb896182e5cb1e8cf12910e9e7, https://git.kernel.org/stable/c/5493571f4351f74e11db9943e98a07c56467cf7e, and https://git.kernel.org/stable/c/88f170814fea74911ceab798a43cbd7c5599bed4; update to a kernel release incorporating these commits once available from your distribution. As an immediate compensating control, disable ksmbd by stopping the service and unloading the ksmbd kernel module ('rmmod ksmbd') if SMB server functionality is not required - this eliminates the attack surface entirely with no side effects for non-SMB workloads. If ksmbd must remain active, restrict TCP 445 access via firewall rules to only trusted host ranges to prevent unauthenticated network actors from establishing sessions, reducing exposure to already-authorized internal users only. Note that firewall restriction does not prevent exploitation by any user already authorized to access the SMB share.

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 (CONFIG_SMB_SERVER) is the Linux kernel's native SMB server, introduced in kernel 5.15 as an alternative to userspace Samba. The affected component is the RPC handle list, which tracks named pipe sessions per ksmbd_session struct. The sess->rpc_lock field is a Linux rwsem (read-write semaphore), which does not support recursive acquisition - attempting a down_read() while the same thread holds down_write() on the same semaphore causes the thread to block on rwsem_down_read_slowpath indefinitely. CWE-674 (Uncontrolled Recursion/Improper Control Flow Management) captures this root cause: the lock acquisition hierarchy was broken when the race-condition fix in commit 305853cce3794 added a lock call inside ksmbd_session_rpc_method() without accounting for callers that already held the lock. The CPE data (cpe:2.3:o:linux:linux_kernel:*) covers all kernel versions through 6.18-rc1 that include ksmbd. The call chain - smb2_open → create_smb2_pipe → ksmbd_session_rpc_open (down_write) → ksmbd_rpc_open → ksmbd_session_rpc_method (down_read) - is triggered by any SMB2 named pipe open operation against IPC$.

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 5.5 MEDIUM
AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
vuln.today AI 6.5 MEDIUM

Attack originates from a network SMB client per the description, making AV:N accurate; PR:L reflects required SMB credentials; impact is availability-only with no confidentiality or integrity effect.

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

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Local
Attack Complexity
Low
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 recursive locking in RPC handle list access

Since commit 305853cce3794 ("ksmbd: Fix race condition in RPC handle list access"), ksmbd_session_rpc_method() attempts to lock sess->rpc_lock.

This causes hung connections / tasks when a client attempts to open a named pipe. Using Samba's rpcclient tool:

$ rpcclient //192.168.1.254 -U user%password $ rpcclient $> srvinfo <connection hung here>

Kernel side: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:kworker/0:0 state:D stack:0 pid:5021 tgid:5021 ppid:2 flags:0x00200000 Workqueue: ksmbd-io handle_ksmbd_work Call trace: __schedule from schedule+0x3c/0x58 schedule from schedule_preempt_disabled+0xc/0x10 schedule_preempt_disabled from rwsem_down_read_slowpath+0x1b0/0x1d8 rwsem_down_read_slowpath from down_read+0x28/0x30 down_read from ksmbd_session_rpc_method+0x18/0x3c ksmbd_session_rpc_method from ksmbd_rpc_open+0x34/0x68 ksmbd_rpc_open from ksmbd_session_rpc_open+0x194/0x228 ksmbd_session_rpc_open from create_smb2_pipe+0x8c/0x2c8 create_smb2_pipe from smb2_open+0x10c/0x27ac smb2_open from handle_ksmbd_work+0x238/0x3dc handle_ksmbd_work from process_scheduled_works+0x160/0x25c process_scheduled_works from worker_thread+0x16c/0x1e8 worker_thread from kthread+0xa8/0xb8 kthread from ret_from_fork+0x14/0x38 Exception stack(0x8529ffb0 to 0x8529fff8)

The task deadlocks because the lock is already held: ksmbd_session_rpc_open down_write(&sess->rpc_lock) ksmbd_rpc_open ksmbd_session_rpc_method down_read(&sess->rpc_lock) <-- deadlock

Adjust ksmbd_session_rpc_method() callers to take the lock when necessary.

Threat Intelligence Overview

EPSS Score
0.1%
Top 96% exploitable
Prevalence
Low
optional non-default kernel SMB server, rarely deployed in production
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

28
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +28
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.

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:6.18:rc1:*:*:*:*:*:*

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