CVE-2026-99526: smb: client: fix use-after-free infoleak via the readdir resume name
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix use-after-free infoleak via the readdir resume name
CIFSFindNext() copies the resume name that cifssaveresumekey() recorded from the last entry of the previous response into its request; psrchinf->presumename points into the response buffer that entry came from, and nothing ever clears it. findcifsentry() records a new name only from a response with a usable last entry, and cifsreaddir() only from an entry it walks to, so a response that carries no entries and leaves lastentry NULL, because CIFSFindFirst() or CIFSFindNext() rejected LastNameOffset, refreshes neither and presumename keeps pointing into the previous response. That buffer has already been released: by CIFSFindNext() before it installs the new response, or by findcifsentry() when it rewinds the search, which does not drop the name either and can then fail in initiatecifssearch() before a new response replaces it. The next CIFSFindNext() then copies up to PATHMAX - 1 bytes of the resume name out of the released buffer into its request and sends them to the server: a use-after-free read that leaks kernel memory to a malicious or compromised server, which can provoke it with a single FindNext response that carries no entries and a LastNameOffset above CIFSMaxBufSize, which is all the existing check rejects.
With KASAN enabled, a server that answers a listing that way gives:
CIFS: VFS: ignoring corrupt resume name ================================================================== BUG: KASAN: slab-use-after-free in CIFSFindNext+0x8ca/0x14c0 Read of size 4080 at addr ffff88807c823f98 by task ls/83
CPU: 0 UID: 0 PID: 83 Comm: ls Tainted: G B 7.3.0-rc4-00457-gf14572c203d5 #69 PREEMPT(lazy) Tainted: [B]=BADPAGE Call Trace: <TASK> kasanreport+0xdf/0x1a0 kasancheckrange+0x10f/0x1e0 asanmemcpy+0x23/0x60 CIFSFindNext+0x8ca/0x14c0 cifsreaddir+0xf51/0x29c0 iteratedir+0x1c0/0x570 x64sysgetdents64+0x133/0x270 dosyscall64+0x109/0x5d0 entrySYSCALL64afterhwframe+0x77/0x7f </TASK>
Allocated by task 83 on cpu 1 at 13.497119s: cifsbufget+0x36/0x90 smbinit+0x4f/0x110 CIFSFindNext+0xf7/0x14c0 cifsreaddir+0xf51/0x29c0
Freed by task 83 on cpu 0 at 13.584018s: cifsbufrelease+0x41/0x80 CIFSFindNext+0xfce/0x14c0 cifsreaddir+0xf51/0x29c0
The buggy address is located 16280 bytes inside of freed 16588-byte region [ffff88807c820000, ffff88807c8240cc) ==================================================================
The same memcpy() first reads past the end of that object while it is still live, a slab-out-of-bounds read that the following patches bound; that is the taint the report above carries.
SMB1 is not negotiated by default; reaching this code requires an explicit vers=1.0 mount.
Clear presumename and resumenamelen whenever a new response is installed and when the rewind path releases the search buffer, so that the name never outlives the buffer it points into, and reset resumekey with them, since it was taken from the same entry and would otherwise be sent with an empty name. A response without a usable last entry then continues the search with an empty resume name rather than a stale one; CIFSFindNext() skips the copy of a zero-length name so that it never runs on the NULL pointer.
The next patch in the series leaves lastentry NULL for a response that carries no entries, and bounds LastNameOffset against the received response rather than against CIFSMaxBufSize. Responses that are given a last entry today then take the path fixed here, so that patch must not be applied without this one.
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.12.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.61 - 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.117-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.117-1Fixed in 7.3.4-1Fixed in 7.3.5-1