Remove dir all: Race Condition Enabling Link Following and Time-of-check Time-of-use (TOCTOU)
Affects remove_dir_allSource GCVE Database
Rated High by Threat Radar's AI analysis
- Patch
- Available – fixed in 0.8.0
Data as of 9 Nov 2026, 11:33 UTC
What to do
Upgrade remove_dir_all to 0.8.0.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
crates.ioremove_dir_allpkg:cargo/remove_dir_allOther threats | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
Upgrade to remove_dir_all version 0.8.0 or later, which includes a fix using file-handle relative operations to prevent directory hierarchy manipulation during deletion. Until then, privileged processes should securely obtain directory handles to avoid race conditions at the entry path. Unprivileged processes using path-based entry points face no additional risk beyond existing conditions. The crate plans to deprecate path-based entry points once safer helper functions are available.
Description
The remove_dir_all Rust crate had a race condition vulnerability allowing an attacker to trick a privileged process into deleting unintended privileged files via symlink manipulation during recursive directory deletion. This Time-of-check Time-of-use (TOCTOU) flaw could cause deletion outside the intended directory tree. The issue is mitigated in version 0.8.0 by using file-handle relative operations to prevent directory hierarchy manipulation during deletion. However, the initial entry path remains a challenge and requires careful handling by calling code to avoid race conditions. Unprivileged processes are not affected beyond existing risks.