CVE & CISA-KEV Catalog

CVE-2022-21658

HIGHEPSS 71th pctl
7.3
CVSS v3
NVD

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.

How to fix

Remediation Available
cargoAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
cargo-docAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
clippyAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
rlsAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
rustAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
rust-analysisAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
rust-debugger-commonAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
rust-debuginfoAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
rust-docAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
rust-gdbAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
rust-srcAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
rust-std-staticAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
rustfmtAmazon
Fixed in:0:1.61.0-2.amzn2.0.1
Fixed in:0:1.61.0-2.amzn2.0.1
rustcDebian
Fixed in:1.57.0+dfsg1-1CVE-2022-21658
Fixed in:1.57.0+dfsg1-1CVE-2022-21658
Fixed in:1.57.0+dfsg1-1CVE-2022-21658

TridentStack Control can deploy fixes like this automatically across your Windows, macOS, and Linux fleet. See how it works

Remediation is compiled from vendor and distribution security advisories. Always confirm against the linked source for your exact version and platform.

CVSS v3 Vector

Exploitability

Attack VectorLocal
Attack ComplexityLow
Privileges RequiredLow
User InteractionNone
ScopeChanged

Impact

ConfidentialityNone
IntegrityLow
AvailabilityHigh

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H

Exploit Intelligence

1.38%probability of exploitation in 30 days
71stpercentile

Elevated risk: more likely to be exploited than 71% of all known CVEs.

References

Related Vulnerabilities

Other CWE-363 vulnerabilities, ordered by exploit likelihood. View all

CVESeverityCVSSEPSSExploitedFix
CVE-2025-31133High7.80.8%-Fix
CVE-2025-52565High7.50.6%-Fix
CVE-2025-52881High7.50.6%-Fix
CVE-2024-27102Critical9.90.5%-Fix
CVE-2024-45310Low3.60.3%-Fix
CVE-2025-62596Critical10.00.2%-Fix

Common questions

How do I fix CVE-2022-21658?

Published advisories record a fix for 14 affected products. The "How to fix" section on this page lists the fixed version and source advisory for each one, so apply the entry matching what you actually run.

Is CVE-2022-21658 being actively exploited?

Not that we know of. CVE-2022-21658 is not in the CISA Known Exploited Vulnerabilities catalog. Its EPSS score of 1.4% is the estimated probability that it will be exploited in the next 30 days. That is higher than 71% of all scored CVEs.

How severe is CVE-2022-21658?

CVE-2022-21658 has a CVSS v3 base score of 7.3, rated high. CVSS rates the technical impact if the vulnerability is exploited, not how likely that is, so weigh it alongside the exploit-prediction score when you decide what to patch first.

What does CVE-2022-21658 affect?

Published advisories record a fix for cargo (Amazon), cargo-doc (Amazon), clippy (Amazon), rls (Amazon), and 10 more. Only products with a sourced advisory are listed, so treat this as what we can cite rather than a complete inventory.

Embed a live status badge for CVE-2022-21658
CVE-2022-21658 severity badge

Markdown

[![CVE-2022-21658](https://tridentstack.com/cve/badge/CVE-2022-21658.svg)](https://tridentstack.com/cve/CVE-2022-21658)

HTML

<a href="https://tridentstack.com/cve/CVE-2022-21658"><img src="https://tridentstack.com/cve/badge/CVE-2022-21658.svg" alt="CVE-2022-21658"></a>

Check your Linux endpoints for this class of vulnerability

TridentStack Control continuously scans Linux endpoints for known vulnerabilities and deploys the fixes from the same console. 200 endpoints free forever, no credit card.

Patch your fleet freeStart freeThis CVE lookup is free and always will be.

This product uses NVD data but is not endorsed or certified by the NVD. EPSS scores courtesy of FIRST.org (https://www.first.org/epss). Source: CISA KEV Catalog. Data as of 2026-06-17.