{"id":"CVE-2026-99385","state":"PUBLISHED","title":"smb: client: fix buffer overflow in SMB2_tcon()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nsmb: client: fix buffer overflow in SMB2_tcon()\n\nIn SMB2_tcon(), unc_path is allocated with a fixed buffer size of\nMAX_SHARENAME_LENGTH * 2 bytes (672 bytes). However, the user-controlled\nUNC path (tree) length is passed to cifs_strtoUTF16(), which assumes the\ndestination buffer is large enough and writes strlen(tree) + 1 UTF-16 code\nunits.\n\nCommit 62a1a439e0fd (\"cifs: clean up handling of unc= option\") removed the\nlength check on UNC mount options, allowing mount paths to exceed\nMAX_SHARENAME_LENGTH while retaining the fixed-size buffer allocation in\nSMB2_tcon(). Consequently, an oversized UNC string causes cifs_strtoUTF16()\nto write past the end of the heap object, resulting in a slab-out-of-bounds\nwrite. Furthermore, if a tree exceeds MAX_TREE_SIZE characters, strscpy()\ntruncates it in cifs_tcon::tree_name, causing subsequent reconnects or\nfailovers to fail.\n\nFix this by first verifying that the length of tree does not exceed\nMAX_TREE_SIZE, returning -EINVAL if it does. Then, dynamically allocate\nunc_path based on the length of tree so that it safely accommodates all\nUTF-16 code units for paths within MAX_TREE_SIZE.\n\n[pc: remove unused MAX_SHARENAME_LENGTH]","publishedAt":"2026-11-19T14:23:25.254Z","updatedAt":"2026-11-22T11:07:59.150Z","severity":{"score":9.8,"label":"Critical","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1","status":"affected","lessThan":"75fd4c72aa3dcfabb318144636f416be6796d423","versionType":"git"},{"version":"62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1","status":"affected","lessThan":"acf25a7be39dccdbf60fdf3d437dd7832fa4b6d3","versionType":"git"},{"version":"62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1","status":"affected","lessThan":"d26f7fbca42532c6c79efdceb4bd5198e1849314","versionType":"git"},{"version":"62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1","status":"affected","lessThan":"73cc469b0ff7551f8537ea919709973e6dc4f514","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/client/smb2pdu.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.8","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.61","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.2","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/client/smb2pdu.c"]}],"references":["https://git.kernel.org/stable/c/75fd4c72aa3dcfabb318144636f416be6796d423","https://git.kernel.org/stable/c/acf25a7be39dccdbf60fdf3d437dd7832fa4b6d3","https://git.kernel.org/stable/c/d26f7fbca42532c6c79efdceb4bd5198e1849314","https://git.kernel.org/stable/c/73cc469b0ff7551f8537ea919709973e6dc4f514"],"weaknesses":[],"ingestedAt":"2026-11-22T11:18:06.032Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/99xxx/CVE-2026-99385.json","commit":"247cc9beefd85903834df0592e88a44f4d599223","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-99385","state":"PUBLISHED","datePublished":"2026-11-19T14:23:25.254Z","dateUpdated":"2026-11-22T11:07:59.150Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-25T10:25:14.411Z"},"containers":{"cna":{"title":"smb: client: fix buffer overflow in SMB2_tcon()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nsmb: client: fix buffer overflow in SMB2_tcon()\n\nIn SMB2_tcon(), unc_path is allocated with a fixed buffer size of\nMAX_SHARENAME_LENGTH * 2 bytes (672 bytes). However, the user-controlled\nUNC path (tree) length is passed to cifs_strtoUTF16(), which assumes the\ndestination buffer is large enough and writes strlen(tree) + 1 UTF-16 code\nunits.\n\nCommit 62a1a439e0fd (\"cifs: clean up handling of unc= option\") removed the\nlength check on UNC mount options, allowing mount paths to exceed\nMAX_SHARENAME_LENGTH while retaining the fixed-size buffer allocation in\nSMB2_tcon(). Consequently, an oversized UNC string causes cifs_strtoUTF16()\nto write past the end of the heap object, resulting in a slab-out-of-bounds\nwrite. Furthermore, if a tree exceeds MAX_TREE_SIZE characters, strscpy()\ntruncates it in cifs_tcon::tree_name, causing subsequent reconnects or\nfailovers to fail.\n\nFix this by first verifying that the length of tree does not exceed\nMAX_TREE_SIZE, returning -EINVAL if it does. Then, dynamically allocate\nunc_path based on the length of tree so that it safely accommodates all\nUTF-16 code units for paths within MAX_TREE_SIZE.\n\n[pc: remove unused MAX_SHARENAME_LENGTH]"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1","status":"affected","lessThan":"75fd4c72aa3dcfabb318144636f416be6796d423","versionType":"git"},{"version":"62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1","status":"affected","lessThan":"acf25a7be39dccdbf60fdf3d437dd7832fa4b6d3","versionType":"git"},{"version":"62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1","status":"affected","lessThan":"d26f7fbca42532c6c79efdceb4bd5198e1849314","versionType":"git"},{"version":"62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1","status":"affected","lessThan":"73cc469b0ff7551f8537ea919709973e6dc4f514","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/client/smb2pdu.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.8","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.61","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.2","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/smb/client/smb2pdu.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/75fd4c72aa3dcfabb318144636f416be6796d423"},{"url":"https://git.kernel.org/stable/c/acf25a7be39dccdbf60fdf3d437dd7832fa4b6d3"},{"url":"https://git.kernel.org/stable/c/d26f7fbca42532c6c79efdceb4bd5198e1849314"},{"url":"https://git.kernel.org/stable/c/73cc469b0ff7551f8537ea919709973e6dc4f514"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","baseScore":9.8,"baseSeverity":"CRITICAL"},"scenarios":[{"lang":"en","value":"AV:N - The oversized tree string is the NetworkAddress of an SMB2 FSCTL_DFS_GET_REFERRALS reply. parse_dfs_referrals() copies it with cifs_strndup_from_utf16(), dfs_parse_target_referral() stores it via smb3_parse_devname() as ctx->UNC, and cifs_get_tcon() or tree_connect_dfs_target() passes it to SMB2_tcon(). SMB2/3 over TCP/445 is routable.\nAC:L - The server sets the FSCTL_DFS_GET_REFERRALS NetworkAddress and can reset TCP. Signing stays off unless ctx->sign or CIFSSEC_MUST_SIGN is set, so cifs_enable_signing() leaves the session unsigned. SMB2_tcon() then always passes strlen(tree) to cifs_strtoUTF16() on a 672-byte allocation.\nPR:N - The attacker is the SMB server. With signing off, session setup completes on STATUS_SUCCESS without the server knowing the client's password, and the client then issues FSCTL_DFS_GET_REFERRALS on the IPC tcon. No client capability is checked on that receive path.\nUI:N - On an existing DFS mount, dfs_cache_refresh() replaces the cached target when the TTL expires. The server then resets TCP; smb2_reconnect_server() calls smb2_reconnect(), which calls cifs_tree_connect() and tree_connect_dfs_target() into SMB2_tcon() with no user action.\nS:U - The write lands in the host kernel heap inside SMB2_tcon(). That is the same security authority as the cifs client; it does not cross a guest-to-host or IOMMU boundary.\nC:H - A share longer than 511 characters makes cifs_strtoUTF16() spill past the kmalloc-1k object that holds the 672-byte unc_path buffer. Corrupting an adjacent allocation's pointer or length yields an out-of-bounds read.\nI:H - cifs_strtoUTF16() writes the server-chosen tree as UTF-16 past the 672-byte unc_path object into neighboring kmalloc-1k slots. That out-of-bounds write can corrupt heap metadata and hijack control flow.\nA:H - The slab out-of-bounds write in SMB2_tcon() oopses the kernel when it hits an unmapped or poisoned object, and the server can force it again on every reconnect."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-22T11:07:59.150Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.8","versionEndExcluding":"6.12.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.8","versionEndExcluding":"6.18.61"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.8","versionEndExcluding":"7.3.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.8","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}