HOMEVULNERABILITIESCVE-2022-21658
MEDIUM

CVE-2022-21658

CWE-363Published: January 20, 2022· Updated: Jun 17, 2026

6.3
CVSS v3.1

Official Description

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.

NVD Source

Technical Analysis

CVE-2022-21658 requires local access, meaning attackers must already have a foothold on the target system.

Exploitation requires low privileges, which limits the exposure to scenarios where an attacker has already gained initial access.

A successful exploit results in full integrity compromise (data manipulation), availability disruption (denial of service), with a CVSS base score of 6.3.

CVSS v3.1 Vector Breakdown

Exploitability
Attack VectorLocal
Attack ComplexityHigh
Privileges Req.Low
User InteractionNone
ScopeUnchanged
Impact
ConfidentialityNone
IntegrityHigh
AvailabilityHigh
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H

Affected Vendors & Products

Apple5 product(s)
ipadosiphone osmacostvoswatchos
Fedora1 product(s)
fedora
rust-lang1 product(s)
rust
Source: NVD CPE · 8 total CPE entries

Exploit & PoC Resources

NO KNOWN EXPLOITNo public exploit confirmed at this time
External links open in a new tab. Always verify in a controlled environment before use.

Official Patches & Advisories

All References (30)

https://blog.rust-lang.org/2022/01/20/cve-2022-21658.htmlExploit · Mitigation · Vendor Advisory

Quick Facts

CVE IDCVE-2022-21658
CVSS Score6.3 / 10
SeverityMEDIUM
WeaknessCWE-363
CISA KEVNo
Affected3 vendor(s)
PublishedJan 20, 2022

Related CVEs (CWE-363)

Recommended Actions

  • Apply vendor patches immediately
  • Monitor CVE-2022-21658 in threat intel feeds
  • Review IDS/IPS signatures for exploitation attempts
Data sourced from NVD (NIST), CISA KEV, and EPSS (FIRST). Analysis generated by CTIWATCH.COM. CVE data is provided under the NVD usage policy.