Vulnerability · Published Aug 21, 2024 · Assigned by Linux

CVE-2024-43882exec: Fix ToCToU between perm check and set-uid/gid usage

High 7.8

In plain English

A high-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 15% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.2%top 84.6% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

In the Linux kernel, the following vulnerability has been resolved: exec: Fix ToCToU between perm check and set-uid/gid usage When opening a file for exec via do_filp_open(), permission checking is done against the file's metadata at that moment, and on success, a file pointer is passed back. Much later in the execve() code path, the file metadata (specifically mode, uid, and gid) is used to determine if/how to set the uid and gid. However, those values may have changed since the permissions check, meaning the execution may gain unintended privileges. For example, if a file could change permissions from executable and not set-id: ---------x 1 root root 16048 Aug 7 13:16 target to set-id and non-executable: ---S------ 1 root root 16048 Aug 7 13:16 target it is possible to gain root privileges when execution should have been disallowed. While this race condition is rare in real-world scenarios, it has been observed (and proven exploitable) when package managers are updating the setuid bits of installed programs. Such files start with being world-executable but then are adjusted to be group-exec with a set-uid bit. For example, "chmod o-x,u+s target" makes "target" executable only by uid "root" and gid "cdrom", while also becoming setuid-root: -rwxr-xr-x 1 root cdrom 16048 Aug 7 13:16 target becomes: -rwsr-xr-- 1 root cdrom 16048 Aug 7 13:16 target But racing the chmod means users without group "cdrom" membership can get the permission to execute "target" just before the chmod, and when the chmod finishes, the exec reaches brpm_fill_uid(), and performs the setuid to root, violating the expressed authorization of "only cdrom group members can setuid to root". Re-check that we still have execute permissions in case the metadata has changed. It would be better to keep a copy from the perm-check time, but until we can do that refactoring, the least-bad option is to do a full inode_permission() call (under inode lock). It is understood that this is safe against dead-locks, but hardly optimal.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12linux6.1.106-1DEBIAN-CVE-2024-43882
Debian:13linux6.10.6-1DEBIAN-CVE-2024-43882
Debian:14linux6.10.6-1DEBIAN-CVE-2024-43882
Ubuntu:22.04:LTSlinux5.15.0-125.135UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux6.8.0-49.49UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux6.8.0-49.49USN-7120-1
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-aws5.15.0-1072.78UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-aws6.8.0-1019.21USN-7120-1
Ubuntu:24.04:LTSlinux-aws6.8.0-1019.21UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-aws-6.86.8.0-1019.21~22.04.1USN-7120-2
Ubuntu:22.04:LTSlinux-aws-6.86.8.0-1019.21~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-azure5.15.0-1075.84UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-azure6.8.0-1018.21UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-azure6.8.0-1018.21USN-7120-2
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1018.21~22.04.1USN-7120-2
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1018.21~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-azure-fde5.15.0-1076.85.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-gcp5.15.0-1071.79UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-gcp6.8.0-1018.20UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-gcp6.8.0-1018.20USN-7120-1
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-gcp-6.86.8.0-1018.20~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-gcp-6.86.8.0-1018.20~22.04.1USN-7120-1
Ubuntu:22.04:LTSlinux-gke5.15.0-1069.75UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-gke6.8.0-1014.18UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-gke6.8.0-1014.18USN-7120-1
Ubuntu:22.04:LTSlinux-gkeop5.15.0-1055.62UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-gkeop6.8.0-1002.4UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-hwe-6.86.8.0-49.49~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-hwe-6.86.8.0-49.49~22.04.1USN-7120-1
Ubuntu:22.04:LTSlinux-ibm5.15.0-1065.68UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-ibm6.8.0-1016.16UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-ibm6.8.0-1016.16USN-7120-1
Ubuntu:22.04:LTSlinux-ibm-6.86.8.0-1016.16~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-intel-iotg5.15.0-1067.73UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-kvm5.15.0-1069.74UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-lowlatency5.15.0-125.135UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-49.49.1USN-7120-3
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-49.49.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.86.8.0-49.49.1~22.04.1USN-7120-3
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.86.8.0-49.49.1~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-nvidia5.15.0-1067.68UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1018.20USN-7120-1
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1018.20UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1018.20~22.04.1USN-7120-1
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1018.20~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-nvidia-lowlatency6.8.0-1018.20.1USN-7120-1
Ubuntu:24.04:LTSlinux-nvidia-lowlatency6.8.0-1018.20.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-nvidia-tegra5.15.0-1032.32UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-nvidia-tegra-igx5.15.0-1020.20UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1017.17USN-7120-1
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1017.17UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-oracle5.15.0-1070.76UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-oracle6.8.0-1016.17USN-7120-1
Ubuntu:24.04:LTSlinux-oracle6.8.0-1016.17UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1016.17~22.04.1USN-7120-2
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1016.17~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-raspi5.15.0-1065.68UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-raspi6.8.0-1015.17UBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-raspi6.8.0-1015.17USN-7120-1
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-riscv6.8.0-49.49.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-riscv-6.86.8.0-49.49.1~22.04.1UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2024-43882
Ubuntu:24.04:LTSlinux-xilinx6.8.0-1017.18UBUNTU-CVE-2024-43882
Ubuntu:22.04:LTSlinux-xilinx-zynqmp5.15.0-1038.42UBUNTU-CVE-2024-43882

Affected products (as reported)

VendorProductVersions
Linux Linux 9167b0b9a0ab7907191523f5a0528e3b9c288e21 – before d5c3c7e26275a2d83b894d30f7582a42853a958f9167b0b9a0ab7907191523f5a0528e3b9c288e21 – before 368f6985d46657b8b466a421dddcacd4051f7ada9167b0b9a0ab7907191523f5a0528e3b9c288e21 – before 15469d46ba34559bfe7e3de6659115778c6247599167b0b9a0ab7907191523f5a0528e3b9c288e21 – before 9b424c5d4130d56312e2a3be17efb0928fec4d649167b0b9a0ab7907191523f5a0528e3b9c288e21 – before f6cfc6bcfd5e1cf76115b6450516ea4c99897ae19167b0b9a0ab7907191523f5a0528e3b9c288e21 – before d2a2a4714d80d09b0f8eb6438ab4224690b7121e9167b0b9a0ab7907191523f5a0528e3b9c288e21 – before 90dfbba89ad4f0d9c9744ecbb1adac4aa2ff4f3e9167b0b9a0ab7907191523f5a0528e3b9c288e21 – before f50733b45d865f91db90919f8311e2127ce5a0cb
Linux Linux 2.6.18

Weakness: CWE-367 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

References