exec: Fix ToCToU between perm check and set-uid/gid usage
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 9167b0b9a0ab7907191523f5a0528e3b9c288e21 · < d2a2a4714d80d09b0f8eb6438ab4224690b7121e| No fix yet |
| Linux Linux |
|
|
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.
From the CVE record · Linux
A race in the Linux kernel’s exec path can allow file permissions to change between the execute-permission check and set-uid/gid processing. A local user can exploit this during a permission change, such as a package manager updating a program’s setuid bit, to gain unintended privileges without further user interaction.
Administrators running the Linux kernel should check their systems; affected versions are not specified in the input.