CVE-2022-21658
published high CVSS 3.1 · 7.3Race condition in std::fs::remove_dir_all in rustlang
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| rust-lang | — | rust< 1.58.1 | Affected | Not stated | GitHub_M |
| Amazon Linux | AL2 | Release evaluationALAS2-2022-1817 | Fixed | Not stated | Amazon Linux assessment |
| AlmaLinux | 8 | rust | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| Oracle Linux | 8 | rustaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Red Hat Enterprise Linux | RHEL-8 | rustaarch64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| SUSE / openSUSE | SLE-15 | rustaarch64 | Advisory build | 1.53.0-3.40.1 | SUSE-SU-2022:0200-1 |
| Oracle Linux | 8 | rustx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Red Hat Enterprise Linux | RHEL-8 | rustppc64le | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
Show 94 more entries
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Red Hat Enterprise Linux | RHEL-8 | rusts390x | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rustsrc | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rustx86_64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| SUSE / openSUSE | SLE-15 | rustppc64le | Advisory build | 1.53.0-3.40.1 | SUSE-SU-2022:0200-1 |
| SUSE / openSUSE | SLE-15 | rusts390x | Advisory build | 1.53.0-3.40.1 | SUSE-SU-2022:0200-1 |
| SUSE / openSUSE | SLE-15 | rustx86_64 | Advisory build | 1.53.0-3.40.1 | SUSE-SU-2022:0200-1 |
| SUSE / openSUSE | SLE-15-SP1 | rustaarch64 | Advisory build | 1.53.0-22.1 | SUSE-SU-2022:0491-1 |
| SUSE / openSUSE | SLE-15-SP1 | rustppc64le | Advisory build | 1.53.0-22.1 | SUSE-SU-2022:0491-1 |
| SUSE / openSUSE | SLE-15-SP1 | rusts390x | Advisory build | 1.53.0-22.1 | SUSE-SU-2022:0491-1 |
| SUSE / openSUSE | SLE-15-SP1 | rustx86_64 | Advisory build | 1.53.0-22.1 | SUSE-SU-2022:0491-1 |
| SUSE / openSUSE | SLE-15-SP2 | rustaarch64 | Advisory build | 1.53.0-22.1 | SUSE-SU-2022:0491-1 |
| SUSE / openSUSE | SLE-15-SP2 | rustppc64le | Advisory build | 1.53.0-22.1 | SUSE-SU-2022:0491-1 |
| SUSE / openSUSE | SLE-15-SP2 | rusts390x | Advisory build | 1.53.0-22.1 | SUSE-SU-2022:0491-1 |
| SUSE / openSUSE | SLE-15-SP2 | rustx86_64 | Advisory build | 1.53.0-22.1 | SUSE-SU-2022:0491-1 |
| SUSE / openSUSE | SLE-15-SP3 | rustaarch64 | Advisory build | 1.59.0-150300.21.20.1 | SUSE-SU-2022:0843-1 |
| SUSE / openSUSE | SLE-15-SP3 | rustppc64le | Advisory build | 1.59.0-150300.21.20.1 | SUSE-SU-2022:0843-1 |
| SUSE / openSUSE | SLE-15-SP3 | rusts390x | Advisory build | 1.59.0-150300.21.20.1 | SUSE-SU-2022:0843-1 |
| SUSE / openSUSE | SLE-15-SP3 | rustx86_64 | Advisory build | 1.59.0-150300.21.20.1 | SUSE-SU-2022:0843-1 |
| SUSE / openSUSE | openSUSE-Leap-15.3 | rustaarch64 | Advisory build | 1.59.0-150300.21.20.1 | OPENSUSE-SU-2022:0843-1 |
| SUSE / openSUSE | openSUSE-Leap-15.3 | rustppc64le | Advisory build | 1.59.0-150300.21.20.1 | OPENSUSE-SU-2022:0843-1 |
| SUSE / openSUSE | openSUSE-Leap-15.3 | rusts390x | Advisory build | 1.59.0-150300.21.20.1 | OPENSUSE-SU-2022:0843-1 |
| SUSE / openSUSE | openSUSE-Leap-15.3 | rustx86_64 | Advisory build | 1.59.0-150300.21.20.1 | OPENSUSE-SU-2022:0843-1 |
| AlmaLinux | 8 | cargo | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | cargo-doc | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | clippy | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rls | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-analysis | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-debugger-common | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-doc | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-gdb | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-lldb | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-src | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-std-static | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-std-static-wasm32-unknown-unknown | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-std-static-wasm32-wasi | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rust-toolset | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| AlmaLinux | 8 | rustfmt | Advisory build | 1.58.1-1.module_el8.6.0+2748+176088b3 | ALSA-2022:1894 |
| Oracle Linux | 8 | cargoaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | cargox86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | cargo-docaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | cargo-docx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | clippyaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | clippyx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rlsaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rlsx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-analysisaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-analysisx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-debugger-commonaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-debugger-commonx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-docaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-docx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-gdbaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-gdbx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-lldbaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-lldbx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-srcaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-srcx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-std-staticaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-std-staticx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-std-static-wasm32-unknown-unknownaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-std-static-wasm32-unknown-unknownx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-std-static-wasm32-wasiaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-std-static-wasm32-wasix86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-toolsetaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rust-toolsetx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rustfmtaarch64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Oracle Linux | 8 | rustfmtx86_64 · rust-toolset · ol8 is enabled | Advisory build | 0:1.58.1-1.module+el8.6.0+20563+1eb4e043 | ELSA-2022-1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargoaarch64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargoppc64le | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargos390x | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargox86_64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargo-debuginfoaarch64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargo-debuginfoppc64le | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargo-debuginfos390x | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargo-debuginfox86_64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | cargo-docnoarch | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | clippyaarch64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | clippyppc64le | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | clippys390x | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | clippyx86_64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | clippy-debuginfoaarch64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | clippy-debuginfoppc64le | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | clippy-debuginfos390x | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | clippy-debuginfox86_64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rlsaarch64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rlsppc64le | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rlss390x | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rlsx86_64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rls-debuginfoaarch64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rls-debuginfoppc64le | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rls-debuginfos390x | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rls-debuginfox86_64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rust-analysisaarch64 | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
| Red Hat Enterprise Linux | RHEL-8 | rust-analysisppc64le | Advisory build | 1.58.1-1.module+el8.6.0+14021+586eff1a | RHSA-2022:1894 |
Package entries are limited to the first 100 builds and 100 linked advisories.
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.3 / 10
- Severity
- high
- Provider
- GitHub_M · cna
- Vector string
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| rust-lang | rust | < 1.58.1 (affected) | GitHub_M · cna |
Weaknesses
2- CWE-363 CWE-363: Race Condition Enabling Link Following
- CWE-367 CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition
References
15- https://blog.rust-lang.org/2022/01/20/cve-2022-21658.html
- https://github.com/rust-lang/rust/pull/93110
- https://github.com/rust-lang/rust/pull/93110/commits/32ed6e599bb4722efefd78bbc9cd7ec4613cb946
- https://github.com/rust-lang/rust/pull/93110/commits/406cc071d6cfdfdb678bf3d83d766851de95abaf
- https://github.com/rust-lang/rust/pull/93110/commits/4f0ad1c92ca08da6e8dc17838070975762f59714
- https://github.com/rust-lang/rust/security/advisories/GHSA-r9cc-f5pr-p3j2
- FEDORA-2022-06569a0a60 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7JKZDTBMGAWIFJSNWKBMPO5EAKRR4BEW/
- FEDORA-2022-1bafa3fc91 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BK32QZLHDC2OVLPKTUHNT2G3VHWHD4LX/
- FEDORA-2022-2c73789458 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/C63NH72Q7UHJM5V3IVYRI7LVBGGFQMSQ/
- FEDORA-2022-1b76e3a192 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CKGTACKMKAPRDPWPTU26GYWBELIRFF5N/
- GLSA-202210-09 https://security.gentoo.org/glsa/202210-09
- https://support.apple.com/kb/HT213182
- https://support.apple.com/kb/HT213183
- https://support.apple.com/kb/HT213186
- https://support.apple.com/kb/HT213193
Provider assertions
3GitHub_M · cna
Race condition in std::fs::remove_dir_all in rustlang
CISA-ADP · adp
CISA ADP Vulnrichment
CVE · adp
CVE Program Container
Provenance
- Schema
- 5.1
- Searchable
- yes
- Content hash
- c7aab8a0ef93dda22cfbf6c8480a1f8ba512ca3b8376c0895f8984fb03528dc2
- Ingested
- 23 Sep 2026, 07:58:18 UTC
- Source record
- Official CVE record