HIGH Introduced in 2.6.24
smb SetUid Bypass
CVE-2026-89638
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
KernelScan AI7.8HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: smb: client: clear setuid/setgid bit on write with cifsacl/modefromsid/posix extensions When a file has the setuid or setgid bit set and is written to, the VFS strips those bits and issues a setattr with ATTR_KILL_SUID/ATTR_KILL_SGID together with an ATTR_MODE carrying the already-cleared mode. Both cifs_setattr_unix() and cifs_setattr_nounix() unconditionally dropped ATTR_MODE in that case: /* skip mode change if it's just for clearing setuid/setgid */ if (attrs->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) attrs->ia_valid &= ~ATTR_MODE; This is fine for the default mount, where the mode is only emulated via the DOS read-only attribute and cannot represent the setuid/setgid bits anyway. However, with the "cifsacl" or "modefromsid" mount options the mode is stored on the server through an ACL (id_mode_to_cifs_acl()), with the SMB3.1.1 POSIX extensions the mode is sent to the server directly, and with the SMB1 Unix extensions (cifs_setattr_unix) the mode is sent via CIFSSMBUnixSetPathInfo(). In all those cases dropping ATTR_MODE means the cleared mode is never pushed to the server, so the setuid/setgid bit survives the write. This is a security issue: on local filesystems the setuid bit is stripped when a file is written, but over these cifs.ko mounts the bit persists on the server, potentially allowing an unexpected privilege escalation on subsequent execution. Fix this in two places: 1. cifs_setattr_nounix(): only take the "skip mode change" shortcut when the mode is emulated via the DOS read-only attribute (i.e. neither cifsacl/modefromsid nor the SMB3.1.1 POSIX extensions are in effect), so that the cleared mode is propagated to the server in the ACL / POSIX cases. 2. cifs_setattr_unix(): this function is only called when Unix extensions are in effect, so the mode is always stored on the server. Remove the shortcut entirely so that the cleared mode is always pushed.
02KernelScan AI Analysis
Risk summary
A local user who can write to a setuid or setgid file on a CIFS mount configured with cifsacl, modefromsid, SMB3.1.1 POSIX extensions, or SMB1 Unix extensions can cause the setuid/setgid bits to persist on the server after the write, contrary to standard behavior. This allows the user to modify a privileged binary and execute it with elevated privileges, resulting in local privilege escalation. Systems without CIFS mounts or using only default mount mode are not affected.
Vulnerability analysis
When a file with the setuid or setgid bit set is written to, the kernel normally strips those privilege-escalation bits and sends the cleared file mode to the filesystem. The CIFS client incorrectly discarded this cleared mode for certain mount configurations, assuming the server would handle it. For default mounts this was harmless, but when using cifsacl, modefromsid, SMB3.1.1 POSIX extensions, or SMB1 Unix extensions, the mode is actually stored on the server — so the cleared mode never reached the server and the dangerous bits persisted after the write. The fix ensures the cleared mode is always propagated to the server in those configurations where modes are truly stored. Any local user with write access to a setuid or setgid file on an affected CIFS mount can trigger this by writing to the file and then executing it, gaining the privileges of the file owner.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 6.18 | 2.6.24 | 6.18.51 | b10015807e4c |
| 7.2 | 2.6.24 | 7.2.4 | 69bfe810ecd1 |
| mainline | 2.6.24 | 7.3-rc1 | b8e5dc4f95e5 |