CVE-2026-31706
Heap-based Buffer Overflow in ksmbd Linux Kernel
Publication date: 2026-05-01
Last updated on: 2026-05-06
Assigner: kernel.org
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| linux | linux_kernel | From 6.13 (inc) to 6.18.25 (exc) |
| linux | linux_kernel | From 6.19 (inc) to 7.0.2 (exc) |
| linux | linux_kernel | From 5.15 (inc) to 6.12.84 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-UNKNOWN |
Attack-Flow Graph
AI Powered Q&A
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability involves the ksmbd component of the Linux kernel handling SMB ACLs, specifically related to the num_aces value in the security.NTACL extended attribute of directories. Detection involves identifying tampered or corrupted NTACL xattrs where num_aces is set to an abnormally high value (e.g., 65535) inconsistent with the actual ACL data size.
One way to detect this on your system is to inspect the security.NTACL extended attributes on SMB-shared directories for suspicious num_aces values or inconsistencies.
Since the vulnerability manifests as large kmalloc allocations and kernel warnings during SMB2 CREATE operations, monitoring kernel logs for warnings related to __alloc_frozen_pages_noprof or kmalloc failures in smb_inherit_dacl() can also help detect exploitation attempts.
There are no specific commands provided in the context, but general approaches include:
- Use getfattr or similar tools to read the security.NTACL xattr on directories shared via SMB to check for abnormal num_aces values.
- Monitor kernel logs (e.g., via dmesg or journalctl) for warnings or errors related to ksmbd, smb_inherit_dacl, or large memory allocations failing.
- Audit SMB2 CREATE operations on the server to detect failures or anomalies that may indicate attempts to trigger this vulnerability.
Can you explain this vulnerability to me?
This vulnerability exists in the Linux kernel's ksmbd component, specifically in the smb_inherit_dacl() function. The function trusts the num_aces value from a parent directory's DACL extended attribute without properly validating it against the actual size of the DACL data. An attacker who is authenticated and can tamper with the parent directory's security.NTACL attribute can set num_aces to a very large value (65535), causing the kernel to allocate a large amount of memory (~8 MB) without initialization and potentially leading to memory corruption or overflow on 32-bit systems.
The vulnerability arises because the code uses num_aces to size a heap allocation and then partially populates it, which can cause out-of-bounds memory access. Additionally, the code uses a weak size check for each ACE entry, allowing under-sized ACEs to be processed.
The fix involves validating num_aces against the actual DACL size, using safer memory allocation functions to prevent overflow, and tightening the checks on each ACE entry to reject invalid sizes.
How can this vulnerability impact me? :
This vulnerability can impact you by allowing an authenticated attacker to cause a denial of service (DoS) through excessive memory allocation and potential memory corruption in the Linux kernel's ksmbd service. This can lead to system instability or crashes.
On 32-bit systems, the vulnerability may also cause integer overflow during memory allocation size calculations, potentially leading to security issues such as buffer overflows.
Because the vulnerability involves tampering with security attributes and memory handling in the kernel, it could also be leveraged as part of a more complex attack chain, although the primary impact described is resource exhaustion and instability.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, apply the patch that validates the num_aces value against the pdacl_size to prevent large, unsafe heap allocations.
The patch includes replacing the raw kmalloc call with kmalloc_array for overflow-safe allocation and tightening the ACE walk loop to reject under-sized ACEs.
With the patch applied, tampered num_aces values are rejected early with an error, preventing large memory allocations and potential crashes.