Skip to main content
Public proof of conceptFix available

CVE-2022-21658

A public proof of concept exists; no exploitation attested.

  • Published2022-01-20
  • WeaknessCWE-363 · CWE-367

Am I affected?

With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.

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.

Timeline

dates in UTC
  1. 2022-01-2018:15CVE publishedNVD

Observed activity

isMalicious corpus · updated 2026-10-23 21:37 UTC
Indicators tagged with this CVE, per day0 indicators over 7 days
Block these indicators
  • Firewall list (EDL, text): https://api.ismalicious.com/edl/cve/CVE-2022-21658?format=txt
  • CSV export: https://api.ismalicious.com/edl/cve/CVE-2022-21658?format=csv
  • TAXII collection of exploited CVEs
  • The EDL and CSV take an API key on the Pro plan.

Versions per branch

NVD
Fedoraproject fedora
BranchAffectedFixed in
34.x= 34no fix published
35.x= 35no fix published
Apple ipados
BranchAffectedFixed in
15.4< 15.415.4
Apple iphone os
BranchAffectedFixed in
15.4< 15.415.4

4 more products in the sources.

as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.

Distribution builds and vendor advisories

Packages from OSV.dev and products from the vendors' CSAF advisories.

version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.

Packages

  • rustAlmaLinux:8all versions · fixed in 1.58.1-1.module_el8.6.0+2748+176088b3and 15 other packages

Vendor advisories

  • CVE-2022-21658 Red Hat Product Security73 products fixed · 5 known affected

    rust: Race condition in remove_dir_all leading to removal of files outside of the directory being removed

    stratisd-dracut as a component of Red Hat Enterprise Linux 8 · stratisd.src as a component of Red Hat Enterprise Linux 8 · stratisd-dracut as a component of Red Hat Enterprise Linux 9 · +2 more

  • ICSA-25-100-02 CISA1 known affected

    Siemens SIDIS Prime

    SIDIS Prime

  • SSA-277137 Siemens ProductCERT1 known affected

    SSA-277137: Multiple Vulnerabilities in SIDIS Prime Before V4.0.700

    SIDIS Prime

  • RHSA-2022:1894 Red Hat Product Security73 products fixed

    Red Hat Security Advisory: rust-toolset:rhel8 security, bug fix, and enhancement update

Full record on NVD

Fix

  1. Vendor fix Siemens ProductCERT SSA-277137 · 1 productUpdate to V4.0.700 or later version
  2. Vendor fix CISA ICSA-25-100-02 · 1 productUpdate to V4.0.700 or later version
  3. Vendor fix Red Hat Product Security RHSA-2022:1894 · 73 productsFor details on how to apply this update, which includes the changes described in this advisory, refer to: https://access.redhat.com/articles/11258
  4. Workaround from the vendor Red Hat Product Security RHSA-2022:1894 · 73 productsMitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.
  5. No fix planned, says the vendor Red Hat Product Security CVE-2022-21658 · 5 productsWill not fix

Advisories and patches

Detection

read 2026-10-23 19:23 UTC
Nuclei template
none so far
ProjectDiscovery
Exploit-DB
no entry
Exploit-DB
Proof-of-concept repositories
1 repository, unverifiedsagittarius-a/cve-2022-21658
PoC-in-GitHub

Sources

  • CISA-ADPSSVC decisionpoc2025-04-22
  • OpenCVESSVC decisionpoc—
  • CNACVSS 3.17.3read 2026-10-23
  • NVDCVSS 3.16.3read 2026-10-23
  • NVDCVSS 2.03.3read 2026-10-23
  • CNAweakness (CWE)CWE-363, CWE-367read 2026-10-23
  • NVDweakness (CWE)CWE-367read 2026-10-23
  • FIRST EPSSEPSS score1.4 %2026-10-23
  • PoC-in-GitHubproof of concept1read 2026-10-23
  • OSVaffected packages—

Technical details

CVSS v3 Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H
Published
2022-01-20
Last Modified
2026-06-17
NVD status
Modified

Frequently asked questions

What is CVE-2022-21658?

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.

Is CVE-2022-21658 actively exploited?

A proof-of-concept exploit exists for CVE-2022-21658, but active exploitation has not been confirmed at this time.

What is the CVSS score for CVE-2022-21658?

CVE-2022-21658 has a CVSS v3 base score of 6.3 (MEDIUM severity), with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:H.

Running rust? Hear about its next vulnerability

Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».

No credit card required · No monthly cap on website lookups · 250 API requests/month