Severity:

HIGH RISK

(7.1)

Path Traversal in radare2

CVE-2026-6940

Analyzed

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Local Arbitrary File/Directory Deletion

Severity:

HIGH RISK

(7.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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.projects root.

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.projects root.
  • 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 like remove, 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.

Sources

SourceLink
github.comgithub.com/radareorg/radare2/pull/25830
github.comgithub.com/radareorg/radare2/pull/25830/commits
vulncheck.comvulncheck.com/advisories/radare2-project-deletion-path-traversal-directory-deletion

Frequently asked

questions

No, this issue is primarily a local vulnerability. An attacker typically needs local access to a system running radare2, with the ability to influence project paths or project files that radare2 will later delete.

The attacker must be able to create or modify radare2 project configurations or marker files and then cause radare2 to perform a project deletion. In many setups, this can be done by any local user who can run radare2 or interact with scripts or tools that wrap its project management features.

Implement strict path normalization and confinement for all project-related filesystem operations, especially deletion. All resolved paths should be canonicalized and verified to reside under the configured project root, and operations should be denied when a path falls outside that boundary.

Adopt a consistent design pattern where untrusted input is never used directly as a filesystem path for sensitive operations. Use root-anchored path building, canonicalization and prefix checks, least-privilege execution, and automated tests and static analysis rules specifically targeting path traversal and unconstrained deletion or overwrite behaviors.

Find out what's already
exploitable in your codebase.