CVE-2026-99562 in Linux
Summary
by MITRE • 11/19/2026
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: reject FSCTL_SET_ZERO_DATA on a directory handle
An authenticated client with a writable tree connection can open a directory with FILE_WRITE_DATA and send FSCTL_SET_ZERO_DATA on that handle. The handler only checks fp->daccess & FILE_WRITE_DATA_LE, but on a directory FILE_WRITE_DATA is the legitimate add-file right, so the check passes. ksmbd_vfs_zero_data() then calls kernel_write() on the directory file, which has no FMODE_WRITE, and __kernel_write_iter() hits WARN_ON_ONCE(!(file->f_mode & FMODE_WRITE)), panicking a panic_on_warn kernel.
Before commit 25e414db7033 ("ksmbd: report holes in allocated range queries") the dense-file path used vfs_fallocate(), which rejects directories with -EISDIR. The kernel_write() loop that replaced it has no such check. Reject a directory handle in ksmbd_vfs_zero_data() before writing, as ksmbd_vfs_write() already does for SMB2_WRITE.
WARNING: fs/read_write.c:608 at __kernel_write_iter+0x74b/0x8c0 Workqueue: ksmbd-io handle_ksmbd_work Call Trace: kernel_write+0x1ef/0x4d0 ksmbd_vfs_zero_data+0x413/0x590 smb2_ioctl+0x21fa/0x66a0 handle_ksmbd_work+0x61b/0x1ff0
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 11/20/2026
The vulnerability identified in the Linux kernel's ksmbd module represents a critical logic error that allows an authenticated attacker to trigger a local denial of service through improper access control validation. The core issue stems from how the server handles file system control codes, specifically FSCTL_SET_ZERO_DATA, when directed at directory objects rather than regular files. In standard SMB protocol operations, certain controls are intended for data manipulation within files, but the implementation in ksmbd failed to distinguish between a handle opened on a regular file and one opened on a directory structure. This oversight creates a pathway for an attacker with write permissions on a tree connection to exploit the server's internal handling mechanisms.
The technical flaw lies in the insufficient validation of access rights within the handler function responsible for processing FSCTL_SET_ZERO_DATA requests. The code checks if the file pointer has FILE_WRITE_DATA access, which is technically correct for regular files where this flag indicates permission to write data content. However, when a client opens a directory with FILE_WRITE_DATA, it is typically exercising the right to create new entries or modify metadata within that directory, not to treat the directory itself as a writable stream of bytes. By relying solely on this access bit without verifying the file type, the kernel allows the operation to proceed against a directory handle. This misinterpretation leads directly to the invocation of ksmbd_vfs_zero_data(), which attempts to perform write operations on an object that does not support them in that manner.
The operational impact is severe, resulting in a kernel panic under specific configuration settings. When ksmbd_vfs_zero_data() executes, it calls kernel_write() on the directory file structure. Since directories do not have the FMODE_WRITE flag set in their file mode, the internal function __kernel_write_iter detects this mismatch and triggers a WARN_ON_ONCE macro. If the system is configured with panic_on_warn enabled, which is common in many production environments to ensure that warnings are treated as critical errors for debugging purposes, this warning escalates into an immediate kernel panic. This effectively crashes the host machine or virtual instance running the ksmbd service, leading to a complete denial of service for all users relying on that SMB server.
This regression was introduced by commit 25e414db7033, which changed the dense-file path from using vfs_fallocate() to a kernel_write() loop. The previous implementation using vfs_fallocate() inherently rejected directory handles with an -EISDIR error code, providing implicit protection against this class of attack. The replacement logic removed that safeguard without adding explicit checks for file type or appropriate access modes for directories. This highlights the importance of maintaining defensive programming practices when refactoring kernel-level I/O paths to ensure that legacy protections are not inadvertently discarded during optimization efforts.
From a classification perspective, this vulnerability aligns with CWE-20 Improper Input Validation and CWE-862 Missing Authorization. The attacker is authenticated but lacks the specific authorization required to perform write operations on directory inodes as if they were regular files. In terms of MITRE ATT&CK techniques, this maps to T1499 Endpoint Denial of Service, specifically through resource exhaustion or system crash via exploitation of a software flaw. It also touches upon T1068 Exploitation for Privilege Escalation in the broader context if such crashes could be leveraged further, though primarily it serves as a denial-of-service vector.
Mitigation strategies should focus on immediate patching and defensive coding practices within kernel development. The primary fix involves modifying ksmbd_vfs_zero_data() to explicitly reject directory handles before attempting any write operations, mirroring the logic already present in ksmbd_vfs_write(). Developers must ensure that all file system control codes validate not just access rights but also the nature of the target object. For administrators unable to patch immediately, restricting SMB share permissions and monitoring for unusual FSCTL_SET_ZERO_DATA requests can provide limited protection. Long-term resilience requires rigorous testing of edge cases in kernel I/O paths, particularly when replacing legacy functions with newer implementations that may lack built-in safeguards present in their predecessors.