CVEMETERBack to radar
OFFICIAL RECORD · Rust

CVE-2022-21658

PUBLISHEDOfficial status check: verifiedCVSS 3.1: 7.3 · high

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_M
CVSS: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 Security
CVSS: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

FieldStatusChecked at (UTC)Source
kevverified2026-11-19T17:59:58.648ZCISA KEV
cvssverified2026-11-19T12:56:16.486ZCVE Program
epssverified2026-11-19T18:27:07.265ZFIRST EPSS
patchesverified2026-11-19T16:51:15.805ZUbuntu Security
affectedverified2026-11-19T12:56:16.486ZCVE Program
lifecycleverified2026-11-19T12:56:16.486ZCVE 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&section=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 JSON
CVE 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 JSON

Correction 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 typeDistribution / releasePackageChannelVersion or source noteSource
distribution-packageUbuntu / focalrustcsecurity1.59.0+dfsg1~ubuntu1~llvm-1~ubuntu1~20.04.2Official record
upstream-releaseupstream / upstreamrustcNot a distribution channel1.58.1Official record

Vendor notices and operational guidance

No connected vendor notice is available for this record.

Original sources and dates

Official status history