CVE-2026-31705
Received Received - Intake
ksmbd Out-of-Bounds Write in EA Alignment

Publication date: 2026-05-01

Last updated on: 2026-05-06

Assigner: kernel.org

Description
In the Linux kernel, the following vulnerability has been resolved: ksmbd: fix out-of-bounds write in smb2_get_ea() EA alignment smb2_get_ea() applies 4-byte alignment padding via memset() after writing each EA entry. The bounds check on buf_free_len is performed before the value memcpy, but the alignment memset fires unconditionally afterward with no check on remaining space. When the EA value exactly fills the remaining buffer (buf_free_len == 0 after value subtraction), the alignment memset writes 1-3 NUL bytes past the buf_free_len boundary. In compound requests where the response buffer is shared across commands, the first command (e.g., READ) can consume most of the buffer, leaving a tight remainder for the QUERY_INFO EA response. The alignment memset then overwrites past the physical kvmalloc allocation into adjacent kernel heap memory. Add a bounds check before the alignment memset to ensure buf_free_len can accommodate the padding bytes. This is the same bug pattern fixed by commit beef2634f81f ("ksmbd: fix potencial OOB in get_file_all_info() for compound requests") and commit fda9522ed6af ("ksmbd: fix OOB write in QUERY_INFO for compound requests"), both of which added bounds checks before unconditional writes in QUERY_INFO response handlers.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-05-01
Last Modified
2026-05-06
Generated
2026-05-07
AI Q&A
2026-05-01
EPSS Evaluated
2026-05-05
NVD
EUVD
Affected Vendors & Products
Showing 6 associated CPEs
Vendor Product Version / Range
linux linux_kernel From 5.15.145 (inc) to 5.16 (exc)
linux linux_kernel From 6.1.71 (inc) to 6.2 (exc)
linux linux_kernel From 6.7 (inc) to 6.12.84 (exc)
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 6.6 (inc) to 6.6.136 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-787 The product writes data past the end, or before the beginning, of the intended buffer.
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?

This vulnerability exists in the Linux kernel's ksmbd component, specifically in the smb2_get_ea() function. The function applies 4-byte alignment padding using memset() after writing each Extended Attribute (EA) entry. However, while there is a bounds check before copying the EA value, there is no check before the alignment memset is called. This can cause the memset to write 1-3 null bytes beyond the allocated buffer boundary if the EA value exactly fills the remaining buffer.

In compound requests where multiple commands share the response buffer, the first command may consume most of the buffer, leaving very little space for the EA response. The unconditional memset then overwrites adjacent kernel heap memory, leading to an out-of-bounds write.

The fix involves adding a bounds check before the alignment memset to ensure there is enough space for the padding bytes, preventing the out-of-bounds write.


How can this vulnerability impact me? :

This vulnerability can lead to an out-of-bounds write in kernel memory, which may corrupt adjacent kernel heap memory. Such memory corruption can cause system instability, crashes, or potentially allow an attacker to execute arbitrary code with kernel privileges.

Because the vulnerability occurs in the kernel's SMB server component (ksmbd), it could be exploited remotely via crafted SMB requests, increasing the risk of unauthorized access or denial of service.


What immediate steps should I take to mitigate this vulnerability?

The vulnerability has been resolved by adding a bounds check before the alignment memset in the ksmbd smb2_get_ea() function. To mitigate this vulnerability, you should update your Linux kernel to a version that includes this fix.

  • Apply the latest Linux kernel patches that address the ksmbd out-of-bounds write issue.
  • Avoid using vulnerable kernel versions with the affected ksmbd smb2_get_ea() implementation.

Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart