PT-2022-4311 · Rust+10 · Rust+10
Florian Weimer
+1
·
Published
2022-01-20
·
Updated
2025-03-24
·
CVE-2022-21658
CVSS v2.0
10
High
| Vector | AV:N/AC:L/Au:N/C:C/I:C/A:C |
Name of the Vulnerable Software and Affected Versions
Rust versions 1.0.0 through 1.58.0
Description
The
std::fs::remove dir all standard library function in Rust is vulnerable to a race condition enabling symlink following. This issue allows an attacker to trick a privileged program into deleting files and directories that the attacker could not otherwise access or delete. The vulnerability is particularly dangerous when the affected application runs with elevated privileges, as it could lead to the deletion of important system files.Recommendations
To resolve the issue, update to Rust 1.58.1 as soon as possible, especially if you are developing programs expected to run in privileged contexts, including system daemons and setuid binaries. For build targets that do not have usable APIs to properly mitigate the attack, such as macOS before version 10.10 (Yosemite) and REDOX, consider alternative mitigation strategies, but note that even with a patched toolchain, these targets are still vulnerable. As a temporary workaround, consider avoiding the use of the
std::fs::remove dir all function in privileged contexts until the issue is fully resolved.Exploit
Fix
Race Condition
Time Of Check To Time Of Use
Found an issue in the description? Have something to add? Feel free to write us 👾
Related Identifiers
Affected Products
Alt Linux
Almalinux
Astra Linux
Centos
Debian
Apple Macos
Red Hat
Red Os
Rocky Linux
Rust
Suse