CVE Database›CVE-2022-21658

CVE-2022-21658

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

Loading…

Severity

Moderate

Red Hat Product Security

5.3

CVSS 3.1

Review impact separately from score.

Published · January 20, 2022

Updated · August 7, 2026

Description

A race condition flaw was found in Rust's std::fs::remove_dir_all function. Rust applications that use this function may be vulnerable to a race condition where an unprivileged attacker can trick the application into deleting files and directories, causing an impact on system data integrity. If the application is privileged, an attacker can possibly delete files they would not usually have access to.

Statement

This flaw has been given a Severity of Moderate because it is not exploitable at will on every Rust program as it requires a specific scenario where a privileged program uses a specific Rust stdlib function, the attacker has some knowledge of the program's file operations, and has the normal limitations and challenges of a Time-of-check to time-of-use (TOCTOU). It must also be carried out by an unprivileged attacker.

CVSS score applicability

The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Mitigation

Mitigation 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.

CVSS / CWE

CVSS 3.1 · 5.3
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N

CWE-367 · Time-of-check Time-of-use (TOCTOU) Race Condition