CVE-2026-89637 PUBLISHED

smb: client: fix UAF and buffer leak in cifs_check_trans2() for malformed secondary T2

Assigner: Linux
Reserved: 11.09.2026 Published: 11.09.2026 Updated: 13.09.2026

In the Linux kernel, the following vulnerability has been resolved:

smb: client: fix UAF and buffer leak in cifs_check_trans2() for malformed secondary T2

When a valid primary TRANSACT2 response has been received (mid->resp_buf set, mid->multiRsp true) and a subsequent secondary response causes cifs_check_trans2() to return false -- either because the SMB header is invalid (malformed != 0) or because check2ndT2() rejects the PDU -- handle_mid() overwrites mid->resp_buf with the new buffer (leaking the primary buffer) and, because mid->multiRsp is set, skips the server->smallbuf/bigbuf NULL-out. When the user thread frees mid->resp_buf, server->smallbuf or server->bigbuf is left dangling; the demux thread reuses it for the next packet, resulting in a use-after-free.

Combine both early-exit conditions and, when mid->multiRsp is already set, abort the pending transaction inline: set multiEnd, call dequeue_mid() with malformed=true, and return true so handle_mid() exits without touching mid->resp_buf or the server buffer pointers.

Metrics

CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 9.8

AV:N - cifs_check_trans2() runs in cifs_demultiplex_thread on SMB1 TRANS2 responses received over TCP/445; a malicious or compromised SMB1 server (or MITM on an unsigned session) delivers the crafted primary and malformed secondary PDUs entirely over the network. AC:L - The attacker fully controls both fragments: a valid primary with TotalDataCount greater than DataCount sets mid->multiRsp, then a secondary with WordCount != 10, inconsistent counts, or a malformed SMB header makes cifs_check_trans2() return false. The resulting UAF is deterministic with no race outside the attacker's control. PR:N - The attacker is the remote SMB peer and needs no account or privileges on the victim; cifs_check_trans2() runs in the demux thread on server-supplied frames, and session credentials belong to the client mount, not the attacking server. UI:N - Once an SMB1 CIFS mount exists (fstab, autofs, cifsroot, embedded/industrial NAS; CONFIG_CIFS_ALLOW_INSECURE_LEGACY defaults on), reconnect and ordinary lookup/readdir/getattr plus cifs_qfs_tcon QUERY_FS_INFO issue TRANS2 automatically, so the server can trigger the UAF with no further user action. S:U - The use-after-free corrupts the client kernel's own CIFS receive-buffer mempool (cifs_req_poolp/cifs_sm_req_poolp) within the same host security authority; this is not a VM escape, IOMMU bypass, or sandbox boundary crossing. C:H - handle_mid() overwrites mid->resp_buf without detaching server->bigbuf/smallbuf, so after the user thread frees the buffer the demux thread reuses the dangling mempool object for the next packet; that use-after-free enables heap reuse and arbitrary kernel memory disclosure. I:H - The same dangling server receive buffer is written by cifsd and later freed by the user thread, yielding a kernel heap use-after-free. Attacker-controlled subsequent SMB payloads and heap grooming can turn this into an arbitrary write or control-flow hijack. A:H - Reusing a freed CIFS small/large response buffer can fault on poisoned or unmapped slab objects and oops or panic the demux thread, and a malicious server can retrigger the primary-then-malformed-secondary sequence on every multi-part TRANS2.

Product Status

Vendor Linux
Product Linux
Versions Default: unaffected
  • affected from 316cf94a910f6f93d43cc574359d163ccae098a3 to 9eed72e9534b10a6d9f8f5146feff3db53aebdba (excl.)
  • affected from 316cf94a910f6f93d43cc574359d163ccae098a3 to 5e6533a683f6a851158d9f33fb4ea8f4f25d7f84 (excl.)
  • affected from 316cf94a910f6f93d43cc574359d163ccae098a3 to 730d0bb19507b9e19c2fe5343109ac618e2fbce5 (excl.)
Vendor Linux
Product Linux
Versions Default: affected
  • Version 3.6 is affected
  • unaffected from 0 to 3.6 (excl.)
  • unaffected from 6.18.51 to 6.18.* (incl.)
  • unaffected from 7.2.4 to 7.2.* (incl.)
  • unaffected from 7.3-rc1 to * (incl.)

References