CVE-2022-21658
Race condition in std::fs::remove_dir_all in rustlang
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.
Exposure status: unknown. This page does not establish whether an installed system is affected or corrected.
Severity and exploitation evidence
EPSS: 1.456% · score date 2026-11-19. EPSS is an estimated probability over the next 30 days, not proof of exploitation.
CISA KEV: not included in the checked catalog; exploitation may still occur. Last checked: 2026-11-19T17:59:58.648Z. Public exploit availability is not used to set this status.
CVSS 3.1 · 7.3 · published by GitHub_MCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H
Assessment source · checked 2026-11-19T12:56:16.486Z
CVSS 3.1 · 7.3 · published by Ubuntu SecurityCVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:H
Assessment source · checked 2026-11-19T16:51:15.805Z
Verification by field
| Field | Status | Checked at (UTC) | Source |
|---|---|---|---|
| kev | verified | 2026-11-19T17:59:58.648Z | CISA KEV |
| cvss | verified | 2026-11-19T12:56:16.486Z | CVE Program |
| epss | verified | 2026-11-19T18:27:07.265Z | FIRST EPSS |
| patches | verified | 2026-11-19T16:51:15.805Z | Ubuntu Security |
| affected | verified | 2026-11-19T12:56:16.486Z | CVE Program |
| lifecycle | verified | 2026-11-19T12:56:16.486Z | CVE Program |
Affected versions and configuration
rust-lang rust; default status: unknown: < 1.58.1 [affected; scheme: unspecified]
Defaults, conditional configuration, package status and version schemes are retained below. A version range alone is not an exposure verdict.
Ubuntu Security · ubuntu-package · full conditions
[
{
"name": "rustc",
"debian": "https://tracker.debian.org/pkg/rustc",
"source": "https://ubuntu.com/security/cve?package=rustc",
"ubuntu": "https://packages.ubuntu.com/search?suite=all§ion=all&arch=any&searchon=sourcenames&keywords=rustc",
"statuses": [
{
"pocket": "security",
"status": "needed",
"component": null,
"description": "",
"release_codename": "xenial"
},
{
"pocket": "security",
"status": "DNE",
"component": null,
"description": "",
"release_codename": "stonking"
},
{
"pocket": "security",
"status": "not-affected",
"component": null,
"description": "1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~18.04.2",
"release_codename": "bionic"
},
{
"pocket": "security",
"status": "released",
"component": null,
"description": "1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~20.04.2",
"release_codename": "focal"
},
{
"pocket": "security",
"status": "ignored",
"component": null,
"description": "end of life",
"release_codename": "hirsute"
},
{
"pocket": "security",
"status": "ignored",
"component": null,
"description": "end of life",
"release_codename": "impish"
},
{
"pocket": "security",
"status": "released",
"component": null,
"description": "1.58.1",
"release_codename": "upstream"
},
{
"pocket": "security",
"status": "not-affected",
"component": null,
"description": "",
"release_codename": "lunar"
},
{
"pocket": "security",
"status": "not-affected",
"component": null,
"description": "",
"release_codename": "jammy"
},
{
"pocket": "security",
"status": "not-affected",
"component": null,
"description": "",
"release_codename": "kinetic"
},
{
"pocket": "security",
"status": "not-affected",
"component": null,
"description": "",
"release_codename": "mantic"
},
{
"pocket": "security",
"status": "needed",
"component": null,
"description": "",
"release_codename": "trusty"
},
{
"pocket": "security",
"status": "not-affected",
"component": null,
"description": "",
"release_codename": "noble"
},
{
"pocket": "security",
"status": "DNE",
"component": null,
"description": "",
"release_codename": "oracular"
},
{
"pocket": "security",
"status": "DNE",
"component": null,
"description": "",
"release_codename": "plucky"
},
{
"pocket": "security",
"status": "DNE",
"component": null,
"description": "",
"release_codename": "resolute"
},
{
"pocket": "security",
"status": "DNE",
"component": null,
"description": "",
"release_codename": "questing"
}
]
}
]Archived source JSONCVE Program · cve-json · full conditions
{
"affected": [
{
"vendor": "rust-lang",
"product": "rust",
"versions": [
{
"status": "affected",
"version": "< 1.58.1"
}
]
}
],
"additionalContainers": [
{
"title": "CVE Program Container",
"references": [
{
"url": "https://github.com/rust-lang/rust/security/advisories/GHSA-r9cc-f5pr-p3j2",
"tags": [
"x_transferred"
]
},
{
"url": "https://github.com/rust-lang/rust/pull/93110",
"tags": [
"x_transferred"
]
},
{
"url": "https://github.com/rust-lang/rust/pull/93110/commits/32ed6e599bb4722efefd78bbc9cd7ec4613cb946",
"tags": [
"x_transferred"
]
},
{
"url": "https://github.com/rust-lang/rust/pull/93110/commits/406cc071d6cfdfdb678bf3d83d766851de95abaf",
"tags": [
"x_transferred"
]
},
{
"url": "https://github.com/rust-lang/rust/pull/93110/commits/4f0ad1c92ca08da6e8dc17838070975762f59714",
"tags": [
"x_transferred"
]
},
{
"url": "https://blog.rust-lang.org/2022/01/20/cve-2022-21658.html",
"tags": [
"x_transferred"
]
},
{
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BK32QZLHDC2OVLPKTUHNT2G3VHWHD4LX/",
"name": "FEDORA-2022-1bafa3fc91",
"tags": [
"vendor-advisory",
"x_transferred"
]
},
{
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/C63NH72Q7UHJM5V3IVYRI7LVBGGFQMSQ/",
"name": "FEDORA-2022-2c73789458",
"tags": [
"vendor-advisory",
"x_transferred"
]
},
{
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CKGTACKMKAPRDPWPTU26GYWBELIRFF5N/",
"name": "FEDORA-2022-1b76e3a192",
"tags": [
"vendor-advisory",
"x_transferred"
]
},
{
"url": "https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/7JKZDTBMGAWIFJSNWKBMPO5EAKRR4BEW/",
"name": "FEDORA-2022-06569a0a60",
"tags": [
"vendor-advisory",
"x_transferred"
]
},
{
"url": "https://support.apple.com/kb/HT213183",
"tags": [
"x_transferred"
]
},
{
"url": "https://support.apple.com/kb/HT213182",
"tags": [
"x_transferred"
]
},
{
"url": "https://support.apple.com/kb/HT213186",
"tags": [
"x_transferred"
]
},
{
"url": "https://support.apple.com/kb/HT213193",
"tags": [
"x_transferred"
]
},
{
"url": "https://security.gentoo.org/glsa/202210-09",
"name": "GLSA-202210-09",
"tags": [
"vendor-advisory",
"x_transferred"
]
}
],
"providerMetadata": {
"orgId": "af854a3a-2127-422b-91ae-364da2661108",
"shortName": "CVE",
"dateUpdated": "2024-08-03T02:46:39.244Z"
}
},
{
"title": "CISA ADP Vulnrichment",
"metrics": [
{
"other": {
"type": "ssvc",
"content": {
"id": "CVE-2022-21658",
"role": "CISA Coordinator",
"options": [
{
"Exploitation": "poc"
},
{
"Automatable": "no"
},
{
"Technical Impact": "partial"
}
],
"version": "2.0.3",
"timestamp": "2025-04-22T15:52:12.198921Z"
}
}
}
],
"providerMetadata": {
"orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
"shortName": "CISA-ADP",
"dateUpdated": "2025-04-22T18:32:53.619Z"
}
}
]
}Archived source JSONCorrection evidence
Distribution packages and upstream releases are distinct. ESM channels may require the corresponding Ubuntu entitlement. Notes and branch ranges are not installable package versions. OSV fixed boundaries are ecosystem-specific version thresholds, not proof that a package is currently available or installed.
| Evidence type | Distribution / release | Package | Channel | Version or source note | Source |
|---|---|---|---|---|---|
| distribution-package | Ubuntu / focal | rustc | security | 1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~20.04.2 | Official record |
| upstream-release | upstream / upstream | rustc | Not a distribution channel | 1.58.1 | Official record |
Vendor notices and operational guidance
No connected vendor notice is available for this record.
Original sources and dates
- FIRST EPSSConsulted: 2026-11-19T18:27:07.265ZArchived source JSON
Source publication: not supplied
Source modification: not suppliedDocument fingerprint
4d5217b2483c05232e728ff4c4aeff80a4cc51c89af7da0c5fa02c307b37b851 - CVE ProgramConsulted: 2026-11-19T12:56:16.486ZArchived source JSON
Source publication: 2022-01-20T00:00:00.000Z
Source modification: 2025-04-22T18:32:53.619ZDocument fingerprint
c7aab8a0ef93dda22cfbf6c8480a1f8ba512ca3b8376c0895f8984fb03528dc2 - Ubuntu SecurityConsulted: 2026-11-19T16:51:15.805ZArchived source JSON
Source publication: 2022-01-20T11:00:00.000Z
Source modification: 2025-08-26T12:42:13.292ZDocument fingerprint
2604218f1be4c8cb1a980ad023b815eeee102e910ea25aebc1db1250855864f2 - CISA KEVConsulted: 2026-11-19T17:59:58.648ZArchived source JSON
Source publication: not supplied
Source modification: 2026-11-18T19:17:41.0354ZDocument fingerprint
a35fdc67c7d9802988dcfc1d3ff1198da327948d1db122ab7692ac201055ac56
Official status history
- UNKNOWN → PUBLISHED · · evidence