ADVISORIES

Vulnerability

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.

24 advisories report this vulnerability, across 11 ecosystems.

Advisories

  • ALAS2-2022-1817

    Amazon Linux 2 2017.12 - ALAS2-2022-1817: medium priority package update for rust

    Medium CVE-2022-21658 Amazon Linux Updated 14 July 2022
  • ALSA-2022:1894

    Moderate: rust-toolset:rhel8 security, bug fix, and enhancement update

    CVE-2022-21658 AlmaLinux Updated 29 October 2026
  • AZL-8337

    CVE-2022-21658 affecting package rust for versions less than 1.59.0-1

    CVE-2022-21658 Azure Linux Updated 21 April 2026
  • CNA-CVE-2022-21658

    Race condition in std::fs::remove_dir_all in rustlang

    CVE-2022-21658 Rust Updated 22 April 2025
  • DEBIAN-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…

    CVE-2022-21658 Debian Updated 20 November 2026
  • ELSA-2022-1894

    ELSA-2022-1894: rust-toolset:ol8 security, bug fix, and enhancement update (MODERATE)

    Moderate CVE-2022-21658 Oracle Linux Updated 17 May 2022
  • RHSA-2022:1894

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

    CVE-2022-21658 Red Hat Updated 23 November 2026
  • RHVEX-CVE-2022-21658

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

    Moderate CVE-2022-21658 Red Hat Updated 23 November 2026
  • RLSA-2022:1894

    Moderate: rust-toolset:rhel8 security, bug fix, and enhancement update

    CVE-2022-21658 Rocky Linux Updated 5 February 2026
  • SUSE-SU-2022:0149-1

    Security update for rust1.56

    CVE-2022-21658 SUSE Updated 4 February 2026
  • SUSE-SU-2022:0171-1

    Security update for rust1.55

    CVE-2022-21658 SUSE Updated 2 May 2025
  • SUSE-SU-2022:0175-1

    Security update for rust1.57

    CVE-2022-21658 SUSE Updated 4 February 2026
  • SUSE-SU-2022:0200-1

    Security update for rust

    CVE-2022-21658 SUSE Updated 4 February 2026
  • SUSE-SU-2022:0491-1

    Security update for rust

    CVE-2022-21658 SUSE Updated 4 February 2026
  • SUSE-SU-2022:0843-1

    Security update for rust, rust1.58, rust1.59

    CVE-2022-21658 SUSE Updated 4 February 2026
  • UBUNTU-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…

    CVE-2022-21658 Ubuntu Updated 22 April 2026
  • openSUSE-SU-2022:0149-1

    Security update for rust1.56

    CVE-2022-21658 SUSEopenSUSE Updated 4 February 2026
  • openSUSE-SU-2022:0171-1

    Security update for rust1.55

    CVE-2022-21658 openSUSE Updated 4 February 2026
  • openSUSE-SU-2022:0175-1

    Security update for rust1.57

    CVE-2022-21658 openSUSE Updated 4 February 2026
  • openSUSE-SU-2022:0491-1

    Security update for rust

    CVE-2022-21658 openSUSE Updated 4 February 2026
  • openSUSE-SU-2022:0843-1

    Security update for rust, rust1.58, rust1.59

    CVE-2022-21658 openSUSE Updated 4 February 2026
  • openSUSE-SU-2024:11767-1

    cargo1.56-1.56.1-4.1 on GA media

    CVE-2022-21658 openSUSE Updated 4 February 2026
  • openSUSE-SU-2024:11768-1

    cargo1.57-1.57.0-3.1 on GA media

    CVE-2022-21658 openSUSE Updated 4 February 2026
  • openSUSE-SU-2024:11769-1

    cargo1.58-1.58.0-2.1 on GA media

    CVE-2022-21658 openSUSE Updated 4 February 2026

References