CVE-2024-43882
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
21/08/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
exec: Fix ToCToU between perm check and set-uid/gid usage<br />
<br />
When opening a file for exec via do_filp_open(), permission checking is<br />
done against the file&#39;s metadata at that moment, and on success, a file<br />
pointer is passed back. Much later in the execve() code path, the file<br />
metadata (specifically mode, uid, and gid) is used to determine if/how<br />
to set the uid and gid. However, those values may have changed since the<br />
permissions check, meaning the execution may gain unintended privileges.<br />
<br />
For example, if a file could change permissions from executable and not<br />
set-id:<br />
<br />
---------x 1 root root 16048 Aug 7 13:16 target<br />
<br />
to set-id and non-executable:<br />
<br />
---S------ 1 root root 16048 Aug 7 13:16 target<br />
<br />
it is possible to gain root privileges when execution should have been<br />
disallowed.<br />
<br />
While this race condition is rare in real-world scenarios, it has been<br />
observed (and proven exploitable) when package managers are updating<br />
the setuid bits of installed programs. Such files start with being<br />
world-executable but then are adjusted to be group-exec with a set-uid<br />
bit. For example, "chmod o-x,u+s target" makes "target" executable only<br />
by uid "root" and gid "cdrom", while also becoming setuid-root:<br />
<br />
-rwxr-xr-x 1 root cdrom 16048 Aug 7 13:16 target<br />
<br />
becomes:<br />
<br />
-rwsr-xr-- 1 root cdrom 16048 Aug 7 13:16 target<br />
<br />
But racing the chmod means users without group "cdrom" membership can<br />
get the permission to execute "target" just before the chmod, and when<br />
the chmod finishes, the exec reaches brpm_fill_uid(), and performs the<br />
setuid to root, violating the expressed authorization of "only cdrom<br />
group members can setuid to root".<br />
<br />
Re-check that we still have execute permissions in case the metadata<br />
has changed. It would be better to keep a copy from the perm-check time,<br />
but until we can do that refactoring, the least-bad option is to do a<br />
full inode_permission() call (under inode lock). It is understood that<br />
this is safe against dead-locks, but hardly optimal.
Impact
Base Score 3.x
7.00
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.19.320 (excluding) | |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.282 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.224 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.165 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.106 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.47 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.10.6 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.11:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.11:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.11:rc3:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/15469d46ba34559bfe7e3de6659115778c624759
- https://git.kernel.org/stable/c/368f6985d46657b8b466a421dddcacd4051f7ada
- https://git.kernel.org/stable/c/90dfbba89ad4f0d9c9744ecbb1adac4aa2ff4f3e
- https://git.kernel.org/stable/c/9b424c5d4130d56312e2a3be17efb0928fec4d64
- https://git.kernel.org/stable/c/d2a2a4714d80d09b0f8eb6438ab4224690b7121e
- https://git.kernel.org/stable/c/d5c3c7e26275a2d83b894d30f7582a42853a958f
- https://git.kernel.org/stable/c/f50733b45d865f91db90919f8311e2127ce5a0cb
- https://git.kernel.org/stable/c/f6cfc6bcfd5e1cf76115b6450516ea4c99897ae1
- https://lists.debian.org/debian-lts-announce/2024/10/msg00003.html
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html



