CVE-2026-142790: smb: client: fix OOB read in the SMB_FIND_FILE_UNIX name scan
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix OOB read in the SMBFINDFILEUNIX name scan
cifsfilldirentunix() finds the length of an SMBFINDFILEUNIX entry name by scanning for its terminating NUL, over up to PATHMAX + 1 UTF-16 units in cifsunicodebytelen() or PATHMAX bytes in strnlen(). Neither scan knows where the response ends. cifsfilldirent() only requires the fixed part of the entry to fit, so the name can start exactly at the end of the received data, and a name that holds no terminator is then scanned for 8194 bytes, or 4096 bytes without unicode, past the end of the received data. SendReceive() copies at most 16468 bytes into the 16588-byte cifsrequest allocation, so for a response of that length up to 8074 of the bytes scanned lie past the end of the allocation. Before the preceding patches bounded where the entry starts, the entry itself could start up to 820 bytes past the end of the allocation at the default CIFSMaxBufSize, and its name 928 bytes past it, so all 8194 scanned bytes would lie outside. cifsfilldirent() rejects the name afterwards because it extends past the end of the response, so nothing of what was read is used, but the out-of-bounds read itself remains.
SMBFINDFILEUNIX is only used with SMB1 servers that offer the Unix extensions; SMB1 is not negotiated by default and requires an explicit vers=1.0 mount.
Before the preceding patches, an entry placed past the buffer left the scan out of bounds from its first read. They bound where the entry starts, but nothing bounds the scan, so a name that holds no terminator still runs off the end of the allocation. Reproduced on the unpatched tree with KASAN enabled, for an entry that starts inside the response, which is the case the preceding patches leave open:
================================================================== BUG: KASAN: slab-out-of-bounds in cifssaveresumekey.isra.0+0x75c/0x7f0 Read of size 2 at addr ffff88807ee640cc by task ls/84
CPU: 0 UID: 0 PID: 84 Comm: ls Not tainted 7.3.0-rc4-00457-gf14572c203d5 #69 PREEMPT(lazy) Call Trace: <TASK> kasanreport+0xdf/0x1a0 cifssaveresumekey.isra.0+0x75c/0x7f0 cifsreaddir+0x1ed6/0x29c0 iteratedir+0x1c0/0x570 x64sysgetdents64+0x133/0x270 dosyscall64+0x109/0x5d0 entrySYSCALL64afterhwframe+0x77/0x7f </TASK>
Allocated by task 84 on cpu 1 at 15.751078s: cifsbufget+0x36/0x90 smbinit+0x4f/0x110 CIFSFindNext+0xf7/0x14c0 cifsreaddir+0xf51/0x29c0
The buggy address belongs to the object at ffff88807ee60000 which belongs to the cache cifsrequest of size 16588 The buggy address is located 0 bytes to the right of allocated 16588-byte region [ffff88807ee60000, ffff88807ee640cc) ==================================================================
The two bytes read there are one UTF-16 unit of the scan, at the first byte past the end of the object. The scan carries on from there, reported again 2, 4 and 6 bytes to the right.
Pass the number of bytes that follow the fixed part of the entry to cifsfilldirentunix() and stop both scans there. A scan that reaches the end of the response without finding a terminator now fails: it returns a name that ends exactly at the end of the response and would otherwise pass the bound, so cifsfilldirent() requires the position of the terminator of an SMBFINDFILEUNIX name to lie inside the response as well. Accepting such a name truncated at the end of the response would turn a malformed entry into a directory entry, or a resume name, that no server sent. A name longer than the PATHMAX cap of the scans is still truncated there, as before, when the response extends past the cap. The message cifsunicodebytelen() logs when it finds no terminator now covers both limits.
This patch depends on "smb: client: fix OOB read of the resume name sent in TRANS2FINDNEXT2", which adds the end argument of cifsfilldirent() and the length it deri ---truncated---
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.118 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.64 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.2 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.118-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.3-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.118-1Fixed in 7.3.3-1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch smb: client: fix OOB read in the SMB_FIND_FILE_UNIX name scan
Event History
Frequently Asked Questions
What kind of SMB response is needed to trigger the out-of-bounds read?
The client must process an SMB_FIND_FILE_UNIX directory entry whose name begins at or near the end of the received response and has no terminating NUL within that response. The name-length scan can then continue beyond the response buffer before the entry is rejected.
Is Unicode required for the issue to occur?
No. Unicode name handling can scan up to PATH_MAX + 1 UTF-16 units (8194 bytes), while non-Unicode handling can scan up to PATH_MAX bytes (4096 bytes), without either scan being bounded by the response end.
Does subsequent entry validation prevent the out-of-bounds read?
No. The client rejects the name after determining that it extends beyond the response, but the unbounded scan has already occurred.