Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-31433

CVE-2026-31433: Linux Kernel Buffer Overflow Vulnerability

CVE-2026-31433 is a buffer overflow flaw in Linux kernel ksmbd that occurs during compound requests, allowing potential out-of-bounds writes. This article covers technical details, affected versions, impact, and mitigation.

Published:

CVE-2026-31433 Overview

CVE-2026-31433 is an out-of-bounds write vulnerability in the Linux kernel's ksmbd (SMB3 server) component. The vulnerability exists in the get_file_all_info() function when processing compound SMB requests that combine QUERY_DIRECTORY and QUERY_INFO (FILE_ALL_INFORMATION) commands.

When the first command in a compound request consumes nearly the entire max_trans_size, the get_file_all_info() function blindly calls smbConvertToUTF16() with PATH_MAX, causing an out-of-bounds write beyond the allocated response buffer. This occurs due to a missing validation check for the client-provided OutputBufferLength before copying the filename into the FileName field of the smb2_file_all_info structure.

Critical Impact

Successful exploitation of this vulnerability could lead to memory corruption, kernel crashes, or potential privilege escalation through out-of-bounds write operations in the Linux kernel's SMB3 file server implementation.

Affected Products

  • Linux kernel with ksmbd (SMB3 server) enabled
  • Systems running kernel-based SMB3 file sharing services
  • Linux servers with in-kernel SMB direct support

Discovery Timeline

  • April 22, 2026 - CVE CVE-2026-31433 published to NVD
  • April 23, 2026 - Last updated in NVD database

Technical Details for CVE-2026-31433

Vulnerability Analysis

The root cause of this vulnerability lies in the get_file_all_info() function within the ksmbd module. When handling compound SMB2 requests, the function fails to properly validate the available buffer space before performing string conversion operations.

The vulnerability manifests when a compound request combines a QUERY_DIRECTORY command with a QUERY_INFO request for FILE_ALL_INFORMATION. If the first command in the sequence consumes most of the available max_trans_size buffer, the subsequent get_file_all_info() call does not account for this consumption. The function then proceeds to call smbConvertToUTF16() with PATH_MAX as the length parameter, regardless of the actual remaining buffer space.

This creates a classic out-of-bounds write condition where filename data is written past the allocated response buffer boundaries, potentially corrupting adjacent kernel memory structures. The absence of proper boundary checking before the UTF-16 conversion operation is the fundamental security flaw.

Root Cause

The vulnerability stems from missing input validation in the get_file_all_info() function. Specifically:

  1. The function did not validate the client-provided OutputBufferLength parameter against the actual available buffer space
  2. No calculation was performed to determine the remaining buffer size after processing compound request components
  3. The smbConvertToUTF16() function was called with PATH_MAX without considering actual buffer constraints

The fix involves calculating the actual free buffer size using smb2_calc_max_out_buf_len() and returning -EINVAL if the buffer is insufficient. Additionally, smbConvertToUTF16() was updated to use the actual filename length (clamped by PATH_MAX) to ensure safe copy operations.

Attack Vector

An attacker could exploit this vulnerability by sending specially crafted compound SMB2 requests to a Linux server running the ksmbd service. The attack requires network access to the SMB3 service and involves:

  1. Constructing a compound SMB2 request where the first command (QUERY_DIRECTORY) is designed to consume nearly all of the max_trans_size buffer
  2. Including a second QUERY_INFO request for FILE_ALL_INFORMATION with a filename that, when converted to UTF-16, exceeds the remaining buffer space
  3. Triggering the out-of-bounds write when the server processes the compound request

The vulnerability can be triggered remotely without authentication if the SMB share allows anonymous access, or requires valid credentials if the share is protected.

Detection Methods for CVE-2026-31433

Indicators of Compromise

  • Unexpected kernel crashes or panics related to ksmbd module operations
  • Unusual SMB compound request patterns with abnormally large QUERY_DIRECTORY responses followed by QUERY_INFO requests
  • Memory corruption errors in kernel logs associated with SMB3 file operations
  • System instability when processing SMB file information queries

Detection Strategies

  • Monitor SMB3 traffic for suspicious compound request patterns combining QUERY_DIRECTORY and QUERY_INFO operations
  • Implement kernel log monitoring for ksmbd-related errors, memory faults, or buffer overflow indicators
  • Deploy network intrusion detection rules to identify malformed or unusually structured SMB2 compound requests
  • Enable kernel memory sanitization tools (KASAN) in development environments to detect out-of-bounds access attempts

Monitoring Recommendations

  • Configure audit logging for ksmbd service activity and unusual error conditions
  • Implement rate limiting on SMB compound requests to reduce exploitation window
  • Monitor system memory usage patterns for anomalies during SMB3 file operations
  • Review kernel dmesg output regularly for ksmbd module warnings or errors

How to Mitigate CVE-2026-31433

Immediate Actions Required

  • Update the Linux kernel to a patched version containing the security fix
  • If patching is not immediately possible, consider temporarily disabling ksmbd and using userspace Samba instead
  • Restrict network access to SMB3 services to trusted networks only
  • Implement network segmentation to limit exposure of vulnerable systems

Patch Information

Multiple patches have been released across Linux kernel stable branches to address this vulnerability. The fix implements proper buffer size validation using smb2_calc_max_out_buf_len() and ensures safe copy operations during UTF-16 conversion.

Available kernel patches:

Workarounds

  • Disable the ksmbd kernel module and switch to userspace Samba if in-kernel SMB3 is not strictly required
  • Apply firewall rules to restrict SMB3 (port 445) access to trusted IP addresses only
  • Configure SMB share permissions to require authentication and limit anonymous access
  • Monitor and limit the size of compound SMB requests at the network perimeter
bash
# Disable ksmbd module temporarily
sudo modprobe -r ksmbd

# Blacklist ksmbd to prevent loading on reboot (if not needed)
echo "blacklist ksmbd" | sudo tee /etc/modprobe.d/disable-ksmbd.conf

# Restrict SMB access via firewall (example using iptables)
sudo iptables -A INPUT -p tcp --dport 445 -s 192.168.1.0/24 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 445 -j DROP

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.