Summary
radare2 versions prior to 6.1.4 contain a path traversal vulnerability in the project deletion logic that allows local attackers to recursively delete arbitrary directories on the filesystem.
By supplying absolute paths that escape the configured dir.projects root directory, an attacker can point project markers at directories outside the intended storage boundary and trigger recursive deletion with the privileges of the radare2 process.
Affected context
This vulnerability arises in radare2's project management feature, specifically during project deletion operations.
It affects environments where:
- Users can create or manipulate radare2 project files, and
- The project deletion mechanism accepts or resolves absolute paths without enforcing confinement to the configured
dir.projectsroot.
The risk is most pronounced on multi-user systems or shared development environments where radare2 runs with higher filesystem privileges than untrusted local users.
Exploit preconditions
- Attack surface: Local system; accessible through radare2's project-handling functionality or any wrapper tooling that triggers project deletion.
- Required access: Ability for a local user to create or modify project definitions or project marker paths that radare2 will later attempt to delete.
- Trigger point: Invoking project deletion (e.g., via radare2 CLI or integrated tooling) on a project whose stored path points outside the
dir.projectsroot. - Why exploitation is possible: The deletion routine trusts project paths, does not normalize and re-validate them against the configured project root, and allows absolute paths to escape the intended directory boundary, resulting in recursive deletion of attacker-chosen directories.
Why this happens
The core issue is insufficient path validation and confinement when deleting project data.
Instead of strictly resolving, normalizing, and verifying that project paths remain within the configured dir.projects directory, the deletion logic accepts absolute paths that can reference arbitrary locations on the filesystem.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where user-controllable input is used to construct filesystem paths without proper canonicalization and boundary checks before performing sensitive operations such as recursive deletion.
Potential impact
- Deletion of arbitrary directories writable or accessible by the radare2 process.
- Loss of source code, configuration files, or build artifacts located in targeted directories.
- Disruption of development or analysis environments due to removal of toolchains, project directories, or temporary workspaces.
- Potential denial of service for applications or users relying on deleted files or directories.
- Facilitation of broader sabotage on shared machines by selectively deleting other users' data where permissions allow.
General mitigation guidance
Effective mitigation focuses on enforcing strict path confinement and defensive handling of filesystem operations:
- Treat all project paths as untrusted input, even when originating from local files, and require normalization (e.g., resolving
.., symlinks where feasible, and absolute paths) before use. - Enforce that all project-related deletions are confined to a single, configured project root (
dir.projects), rejecting or safely ignoring operations that resolve outside this directory. - Use canonical path comparison (e.g., after realpath resolution) to ensure that computed paths are descendants of the allowed root directory before deleting.
- Prefer ID-based or metadata-based project references over raw filesystem paths where possible, so deletion logic maps IDs to validated internal paths rather than directly trusting user-supplied paths.
- Apply least-privilege principles when running radare2: run under user accounts with minimal filesystem permissions to limit the blast radius of any unintended deletions.
How teams detect issues like this
Detection can combine code-centric review with runtime monitoring:
- Static analysis and code review:
- Search for recursive deletion routines (e.g., wrappers around
rm -rf, directory walkers, or APIs likeremove,unlink,rmdir) that operate on paths derived from configuration or user-controllable project metadata. - Verify that all file and directory operations involving project paths perform canonicalization and validate that targets are under the intended root directory.
- Flag uses of absolute paths originating from project files, environment variables, or CLI arguments that reach deletion logic without boundary checks.
- Policy enforcement and testing:
- Add unit and integration tests that attempt to create projects with paths containing
..segments or absolute paths targeting outside directories, asserting that deletion is rejected or constrained. - Use security-focused linters or SAST tools configured to detect path traversal patterns and unsafe directory deletion patterns in filesystem-related code.
- Monitor critical directories for unexpected bulk deletions or anomalous activity when running radare2 in shared environments, potentially via file integrity monitoring solutions.

