cve/2024/CVE-2024-43882.md

19 lines
2.5 KiB
Markdown
Raw Normal View History

2025-09-29 16:08:36 +00:00
### [CVE-2024-43882](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-43882)
![](https://img.shields.io/static/v1?label=Product&message=Linux&color=blue)
2025-09-29 21:09:30 +02:00
![](https://img.shields.io/static/v1?label=Version&message=&color=brightgreen)
![](https://img.shields.io/static/v1?label=Version&message=1da177e4c3f41524e886b7f1b8a0c1fc7321cac2%20&color=brightgreen)
![](https://img.shields.io/static/v1?label=Vulnerability&message=n%2Fa&color=blue)
2025-09-29 16:08:36 +00:00
### Description
In the Linux kernel, the following vulnerability has been resolved:exec: Fix ToCToU between perm check and set-uid/gid usageWhen opening a file for exec via do_filp_open(), permission checking isdone against the file's metadata at that moment, and on success, a filepointer is passed back. Much later in the execve() code path, the filemetadata (specifically mode, uid, and gid) is used to determine if/howto set the uid and gid. However, those values may have changed since thepermissions check, meaning the execution may gain unintended privileges.For example, if a file could change permissions from executable and notset-id:---------x 1 root root 16048 Aug 7 13:16 targetto set-id and non-executable:---S------ 1 root root 16048 Aug 7 13:16 targetit is possible to gain root privileges when execution should have beendisallowed.While this race condition is rare in real-world scenarios, it has beenobserved (and proven exploitable) when package managers are updatingthe setuid bits of installed programs. Such files start with beingworld-executable but then are adjusted to be group-exec with a set-uidbit. For example, "chmod o-x,u+s target" makes "target" executable onlyby uid "root" and gid "cdrom", while also becoming setuid-root:-rwxr-xr-x 1 root cdrom 16048 Aug 7 13:16 targetbecomes:-rwsr-xr-- 1 root cdrom 16048 Aug 7 13:16 targetBut racing the chmod means users without group "cdrom" membership canget the permission to execute "target" just before the chmod, and whenthe chmod finishes, the exec reaches brpm_fill_uid(), and performs thesetuid to root, violating the expressed authorization of "only cdromgroup members can setuid to root".Re-check that we still have execute permissions in case the metadatahas 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 afull inode_permission() call (under inode lock). It is understood thatthis is safe against dead-locks, but hardly optimal.
### POC
#### Reference
No PoCs from references.
#### Github
- https://github.com/xairy/linux-kernel-exploitation