CVE-2022-21658
A public proof of concept exists; no exploitation attested.
- Published2022-01-20
- WeaknessCWE-363 · CWE-367
Am I affected?
Debian, Ubuntu or Red Hat sometimes backport a fix without changing the upstream version number: such a version reads « to verify », never « 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- 2022-01-2018:15CVE publishedNVD
Observed activity
isMalicious corpus · updated 2026-10-23 21:37 UTCBlock 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| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 34.x | = 34 | no fix published | NVD |
| 35.x | = 35 | no fix published | NVD |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 15.4 | < 15.4 | 15.4 | NVD |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 15.4 | < 15.4 | 15.4 | NVD |
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
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
Siemens SIDIS Prime
SIDIS Prime
SSA-277137: Multiple Vulnerabilities in SIDIS Prime Before V4.0.700
SIDIS Prime
Red Hat Security Advisory: rust-toolset:rhel8 security, bug fix, and enhancement update
Fix
- Vendor fix Siemens ProductCERT SSA-277137 · 1 productUpdate to V4.0.700 or later version
- Vendor fix CISA ICSA-25-100-02 · 1 productUpdate to V4.0.700 or later version
- 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
- 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.
- No fix planned, says the vendor Red Hat Product Security CVE-2022-21658 · 5 productsWill not fix
Advisories and patches
- blog.rust-lang.orgMitigation · Vendor Advisory
- github.comPatch
- github.comPatch
- github.comPatch
- github.comPatch
- github.comMitigation
Detection
read 2026-10-23 19:23 UTC- Nuclei template
- none so far ProjectDiscovery
- Exploit-DB
- no entry Exploit-DB
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?
Is CVE-2022-21658 actively exploited?
What is the CVSS score for CVE-2022-21658?
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
Go further
- Following what attackers exploit right now? The CISA KEV additions of the month, with their patch deadlines.
- Running this software? Vulnerability monitoring alerts you to new vulnerabilities in your products.
Related vulnerabilities
Same product first, then the same vendor advisory and the same publication week.