6.3
CVSSv3

CVE-2022-21658

Published: 20/01/2022 Updated: 07/11/2023
CVSS v2 Base Score: 3.3 | Impact Score: 4.9 | Exploitability Score: 3.4
CVSS v3 Base Score: 6.3 | Impact Score: 5.2 | Exploitability Score: 1
VMScore: 295
Vector: AV:L/AC:M/Au:N/C:N/I:P/A:P

Vulnerability Summary

Rust is a multi-paradigm, general-purpose programming language designed for performance and safety, especially safe concurrency. The Rust Security Response WG was notified that the `std::fs::remove_dir_all` standard library function is vulnerable a race condition enabling symlink following (CWE-363). An attacker could use this security issue to trick a privileged program into deleting files and directories the attacker couldn't otherwise access or delete. Rust 1.0.0 through Rust 1.58.0 is affected by this vulnerability with 1.58.1 containing a patch. Note that the following build targets don't have usable APIs to properly mitigate the attack, and are thus still vulnerable even with a patched toolchain: macOS before version 10.10 (Yosemite) and REDOX. We recommend everyone to update to Rust 1.58.1 as soon as possible, especially people developing programs expected to run in privileged contexts (including system daemons and setuid binaries), as those have the highest risk of being affected by this. Note that adding checks in your codebase before calling remove_dir_all will not mitigate the vulnerability, as they would also be vulnerable to race conditions like remove_dir_all itself. The existing mitigation is working as intended outside of race conditions.

Vulnerability Trend

Vulnerable Product Search on Vulmon Subscribe to Product

rust-lang rust

fedoraproject fedora 34

fedoraproject fedora 35

apple macos

apple tvos

apple iphone os

apple ipados

apple watchos

Vendor Advisories

Synopsis Moderate: rust-toolset:rhel8 security, bug fix, and enhancement update Type/Severity Security Advisory: Moderate Red Hat Insights patch analysis Identify and remediate systems affected by this advisory View affected systems Topic An update for the rust-toolset:rhel8 module is now available for Red Hat Enterprise Linux 8Re ...
A race condition flaw was found in Rust's std::fs::remove_dir_all function Rust applications that use this function may be vulnerable to a race condition where an unprivileged attacker can trick the application into deleting files and directories, causing an impact on system data integrity If the application is privileged, an attacker can possibl ...

Mailing Lists

<!--X-Body-Begin--> <!--X-User-Header--> oss-sec mailing list archives <!--X-User-Header-End--> <!--X-TopPNI--> By Date By Thread </form> <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> Race condition in the Rust standard library (CVE-2022-21658) <!--X-Subject-Header-End--> <!--X-Head-of-Message--> From: Piet ...

Github Repositories

POC for cve-2022-21658

CVE-2022-21658 poc Make sure the use the Rust 1580 version First run: while :; do mkdir /tmp/legit; rm -r /tmp/legit; ln -s /tmp/sensitive /tmp/legit; done Then: cargo run

Customizable subcommands to build your Wasm projects using xtask.

xtask-wasm This crate aims to provide an easy and customizable way to help you build Wasm projects by extending them with custom subcommands, based on the xtask concept, instead of using external tooling like wasm-pack Minimum Supported Rust Version This crate requires Rust 1581 at a minimum because there is a security issue on a function we use from std in previous ve

A simple programm, inteneded to replace "rm" and "rmdir" by combining their features in single executable.

rmall version 102 A simple programm, inteneded to replace "rm" and "rmdir" by combining their features in single executable Installing Windows You can install programm by cloning repo to your local machine, and then add directory, which contains executable, directly to PATH variable Linux To install Linux version, follow the same steps, but then move