CVE-2026-99385 in Linux
Summary
by MITRE • 11/19/2026
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix buffer overflow in SMB2_tcon()
In SMB2_tcon(), unc_path is allocated with a fixed buffer size of MAX_SHARENAME_LENGTH * 2 bytes (672 bytes). However, the user-controlled UNC path (tree) length is passed to cifs_strtoUTF16(), which assumes the destination buffer is large enough and writes strlen(tree) + 1 UTF-16 code units.
Commit 62a1a439e0fd ("cifs: clean up handling of unc= option") removed the length check on UNC mount options, allowing mount paths to exceed MAX_SHARENAME_LENGTH while retaining the fixed-size buffer allocation in SMB2_tcon(). Consequently, an oversized UNC string causes cifs_strtoUTF16() to write past the end of the heap object, resulting in a slab-out-of-bounds write. Furthermore, if a tree exceeds MAX_TREE_SIZE characters, strscpy() truncates it in cifs_tcon::tree_name, causing subsequent reconnects or failovers to fail.
Fix this by first verifying that the length of tree does not exceed MAX_TREE_SIZE, returning -EINVAL if it does. Then, dynamically allocate unc_path based on the length of tree so that it safely accommodates all UTF-16 code units for paths within MAX_TREE_SIZE.
[pc: remove unused MAX_SHARENAME_LENGTH]
Be aware that VulDB is the high quality source for vulnerability data.
Analysis
by VulDB Data Team • 11/20/2026
The Linux kernel's Common Internet File System (CIFS) client implementation contains a critical buffer overflow vulnerability in the SMB2 tree connection function, specifically within the smb2_tcon routine. This flaw stems from an inconsistency between how UNC path lengths are validated during mount option processing and how memory is allocated for internal string operations. Historically, strict length checks ensured that user-supplied paths did not exceed predefined limits before being processed. However, a prior cleanup commit removed these validation checks on the unc= mount options to improve flexibility in handling various path formats. This change inadvertently allowed UNC paths exceeding the MAX_SHARENAME_LENGTH limit to proceed into subsequent processing stages without corresponding adjustments to memory allocation strategies.
The technical core of the vulnerability lies in the interaction between cifs_strtoUTF16 and a fixed-size heap buffer. The smb2_tcon function allocates unc_path with a static size calculated as MAX_SHARENAME_LENGTH multiplied by two, totaling 672 bytes. This allocation assumes that any incoming UNC path will fit within this boundary when converted to UTF-16 encoding. However, because the length validation was removed earlier in the pipeline, cifs_strtoUTF16 receives user-controlled input whose actual length may significantly exceed the allocated buffer size. The function proceeds to write strlen(tree) plus one for the null terminator as UTF-16 code units directly into this undersized heap object. This results in a slab-out-of-bounds write, where data is written past the end of the allocated memory region.
This out-of-bounds write poses severe security risks consistent with CWE-787: Out-of-Bounds Write. By overwriting adjacent heap metadata or other kernel structures, an attacker can potentially corrupt memory integrity, leading to arbitrary code execution if specific heap layouts are exploited. The vulnerability is particularly dangerous because it occurs during the establishment of a network connection, meaning remote attackers who control the server-side path configuration or can influence mount parameters could trigger this condition. Additionally, there is a secondary functional impact related to tree name handling. If a provided tree string exceeds MAX_TREE_SIZE characters, strscpy truncates the value in cifs_tcon::tree_name. This truncation causes subsequent reconnects and failover operations to fail because the truncated path no longer matches the expected server-side share identifier, leading to service disruption for legitimate users relying on high availability features.
The remediation strategy addresses both the memory safety issue and the logical consistency of path handling. The fix introduces a rigorous length verification step that checks whether the tree string exceeds MAX_TREE_SIZE before any allocation or conversion occurs. If the limit is exceeded, the function returns an invalid argument error (-EINVAL), effectively preventing the overflow from occurring at all. Furthermore, instead of relying on fixed-size buffers, the solution implements dynamic memory allocation for unc_path based on the actual length of the input tree string. This ensures that sufficient space is always reserved to accommodate the full UTF-16 encoded path plus null terminator, provided it remains within the MAX_TREE_SIZE boundary. The unused constant MAX_SHARENAME_LENGTH was also removed from the codebase as part of this cleanup to reduce confusion and technical debt.
From a threat intelligence perspective, this vulnerability aligns with ATT&CK technique T1059: Command and Scripting Interpreter if exploited for initial access or lateral movement via compromised SMB shares, although its primary classification remains under exploitation of memory corruption vulnerabilities. Security practitioners should ensure that kernel updates incorporating the fix commit 62a1a439e0fd are applied promptly to systems running vulnerable versions of the Linux kernel. Organizations utilizing CIFS mounts must also audit their mount configurations to ensure they adhere to MAX_TREE_SIZE limits, thereby preventing operational failures even after patching. Regular vulnerability scanning and configuration management practices should be employed to detect any lingering instances where oversized UNC paths might have been configured in legacy scripts or automated deployment tools.