/

CVE-2026-40527

Severity:

HIGH RISK

(7.8)

Command Injection in radare2 DWARF Parameter Name Handling

CVE-2026-40527

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution on Analyst Host

Severity:

HIGH RISK

(7.8)

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

A command injection flaw in radare2's afsv/afsvj command path allows crafted ELF binaries to embed malicious r2 command sequences in DWARF DW_TAG_formal_parameter names.

When such a binary is analyzed (e.g., via aaa) and afsvj is run, these parameter names are interpolated into a pfq command string without sanitization, which can lead to arbitrary shell command execution on the analyst's system.

Affected context

This vulnerability appears when radare2 is used to analyze untrusted or attacker-crafted ELF binaries that contain DWARF debugging information.

The issue is specifically tied to the workflow where:

  • The binary is loaded and analyzed (commonly using aaa or similar analysis commands), and
  • The afsv or afsvj commands are invoked, causing radare2 to process DWARF DW_TAG_formal_parameter names.

In affected builds prior to the fixing commit, these parameter names can be treated as part of a command template, creating an opportunity for command injection on the system running radare2.

Exploit preconditions

  • Attack surface: Local tooling on the analyst's or developer's machine running radare2.
  • Required access: Ability for an attacker to deliver a malicious ELF binary with crafted DWARF parameter names (e.g., through malware samples, shared binaries, build artifacts, or repository uploads).
  • Trigger point:
  • The malicious ELF is opened in radare2 and analyzed (e.g., with aaa), and
  • The user runs afsv or afsvj, which in turn builds a pfq command string using DWARF parameter names.
  • Why exploitation is possible: DWARF DW_TAG_formal_parameter names are interpolated directly into a pfq command string without proper escaping or validation, allowing embedded radare2 or shell metacharacters to alter the intended command and execute arbitrary shell commands.

Why this happens

The core issue is unsafe command construction from untrusted data, aligning with CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Radare2 takes parameter names extracted from DWARF debug information—data fully under an attacker's control in a crafted ELF—and injects them into a pfq command template as if they were benign strings.

Because this interpolation occurs without escaping shell or command metacharacters, the resulting command can be syntactically transformed by the attacker-controlled content, causing command injection when executed by the underlying shell or command interpreter.

Potential impact

  • Execution of arbitrary shell commands with the privileges of the user running radare2
  • Local compromise of the analyst's workstation or CI environment where radare2 is integrated
  • Exfiltration or modification of local files accessible to the radare2 user
  • Use of the radare2 session as a foothold for further lateral movement in the analyst's environment
  • Tampering with analysis results or manipulating subsequent tooling in an analysis pipeline

General mitigation guidance

Effective mitigation focuses on treating all debug metadata as untrusted input and preventing it from influencing command construction:

  • Avoid interpolating DWARF or other symbol names directly into command strings that are executed by a shell or interpreter.
  • Apply strict escaping/quoting of any user-controlled or file-derived data that must be used in command construction.
  • Prefer APIs that do not invoke a shell (e.g., use argument vector–style invocation rather than shell command strings) when executing external commands.
  • Introduce validation layers that constrain acceptable parameter names to a safe character set and length before they are used in formatting.
  • Run analysis tools with least-privilege accounts and, where possible, in isolated sandboxes or containers to limit the blast radius if a similar issue occurs.

How teams detect issues like this

Detection typically combines code-level inspection and behavioral monitoring:

  • Static analysis & code review:
  • Search for string formatting or concatenation where DWARF names, symbol names, or other debug metadata are used to build commands (e.g., pfq or similar formatted command strings).
  • Flag uses of shell-executing APIs (system calls, popen variants, ! prefixes, or r2 command wrappers) where arguments are derived directly from file metadata.
  • Review places where radare2 commands can be dynamically assembled from analysis results or debug info.
  • Policy and tooling:
  • Enforce internal secure coding guidelines that prohibit unescaped use of external data in shell commands.
  • Integrate linters or SAST tools configured to look for command injection patterns, including dynamic command construction inside analysis or debugging features.
  • Runtime observation (optional):
  • Use sandboxing or monitoring on systems that run radare2 on untrusted binaries to detect anomalous outbound commands or filesystem operations initiated during analysis.

Sources

SourceLink
github.comgithub.com/radareorg/radare2/commit/bc5a89033db3ecb5b1f7bf681fc6ba4dcfc14683
github.comgithub.com/radareorg/radare2/pull/25821
vulncheck.comvulncheck.com/advisories/radare2-command-injection-via-dwarf-parameter-names

Frequently asked

questions

Not in the classic network-service sense. The issue is triggered locally when a user or automated system analyzes a malicious ELF binary with radare2 and runs afsv/afsvj, but the attacker can be remote if they can deliver such a binary to the analyst or pipeline.

They mainly need a path to supply a crafted ELF with malicious DWARF parameter names—such as submitting samples, contributing binaries to a repository, or influencing build artifacts that are later inspected with radare2. No direct shell access is required on the victim machine.

Eliminate direct interpolation of untrusted metadata into command strings. Where metadata must be used, rigorously escape or validate it and prefer mechanisms that do not invoke a shell at all when executing commands.

Treat all file-derived metadata—including debug information—as untrusted input, enforce strict input validation and encoding when building commands, use safer execution APIs, and add automated checks in code review and CI to flag dynamic command construction from external data.

Find out what's already
exploitable in your codebase.