/

CVE-2026-40517

Severity:

HIGH RISK

(7.8)

Command Injection in radare2 PDB Parser print_gvars()

CVE-2026-40517

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution via Malicious Input File

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

radare2 versions prior to 6.1.4 contain a command injection vulnerability in the PDB parser's print_gvars() function, where symbol names from a PDB file are interpolated directly into internal commands.

By crafting a malicious PDB file with newline characters in symbol names, an attacker can inject arbitrary radare2 commands that are executed when a user runs the idp command, which can be leveraged to execute arbitrary OS commands via radare2's shell operator.

Affected context

This vulnerability affects workflows where radare2 is used to analyze PDB (Program Database) files, particularly in automated or semi-automated reverse engineering pipelines.

The issue exists when radare2:

  • Parses attacker-controlled or untrusted PDB files
  • Uses idp or related commands that trigger the PDB parser's print_gvars() function
  • Interpolates symbol names directly into radare2 command strings without sanitization

Environments that automatically ingest and analyze symbol files from external or unknown sources are at higher risk, especially when radare2 has access to the host shell.

Exploit preconditions

  • Attack surface: PDB file parsing in radare2 (local file input, potentially remote if integrated into services or pipelines).
  • Required access: Ability to supply or influence a PDB file that will be opened by radare2 (e.g., via file upload, shared repository, or malicious artifact).
  • Trigger point: Execution of the idp command (or equivalent functionality) in radare2 against the malicious PDB file, which invokes print_gvars().
  • Why exploitation is possible: Symbol names from the PDB are treated as trusted and directly interpolated into the flag rename command without escaping or validation. Newline characters in symbol names break out of the intended command context, allowing attackers to inject additional radare2 commands, including those that invoke OS shell execution.

Why this happens

The root cause lies in unsafe command construction based on untrusted metadata embedded in PDB files.

The PDB parser's print_gvars() function composes radare2 commands (such as flag rename operations) by directly embedding symbol names into the command string.

Because these symbol names are not sanitized or constrained, they can contain control characters like newlines that terminate the intended command and append attacker-controlled commands.

This aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command, since the attacker-controlled symbol names ultimately feed into radare2 commands that can invoke the underlying OS shell through radare2's shell execution operator.

Potential impact

  • Execution of arbitrary OS commands with the privileges of the user running radare2
  • Compromise of the analyst's workstation or analysis environment
  • Exfiltration or modification of sensitive data accessible to the radare2 process
  • Installation of backdoors or additional malware on the host system
  • Manipulation or sabotage of reverse engineering and analysis workflows, including poisoning of analysis outputs

General mitigation guidance

Effective mitigation focuses on treating symbol metadata as untrusted input and enforcing strict separation between data and command logic.

Pattern-based mitigation strategies include:

  • Sanitize and escape symbol names before embedding them into radare2 commands, removing or encoding control characters (e.g., newlines, semicolons) and any sequences that can change command structure.
  • Use safe command-building APIs that avoid manual string concatenation, enforcing fixed command templates and restricted character sets for interpolated values.
  • Restrict shell execution from within radare2 where possible, minimizing or disabling features that invoke OS commands by default when parsing external artifacts.
  • Apply least privilege to the environment running radare2, ensuring it operates with minimal system permissions and within isolated sandboxes or containers.
  • Reduce trust in external symbol files, treating PDB and similar artifacts as potentially hostile, with explicit policies against analyzing untrusted files on high-value systems.

How teams detect issues like this

Detection typically involves a combination of code-level and behavioral monitoring approaches:

  • Static analysis: Define rules that flag string concatenations used to build commands from PDB symbol data, especially where newline or other control characters are not validated or escaped.
  • Code review: Examine parser code paths for direct interpolation of file-derived strings into radare2 commands or shell execution paths, paying attention to printing or renaming functions that operate on symbol names.
  • Fuzzing and differential testing: Use fuzzed PDB inputs, including symbols with control characters, to observe unexpected command execution or error patterns during parsing.
  • Runtime monitoring: In environments where radare2 is automated, monitor for unusual shell invocations or command patterns triggered around PDB parsing, potentially flagged by host-based intrusion detection or logging systems.
  • Policy enforcement: Integrate automated checks into CI/CD or code review pipelines to prevent introduction of new command-building logic that directly consumes untrusted input.

Sources

SourceLink
blog.calif.ioblog.calif.io/p/mad-bugs-discovering-a-0-day-in-zero
github.comgithub.com/radareorg/radare2/issues/25730
github.comgithub.com/radareorg/radare2/pull/25731
vulncheck.comvulncheck.com/advisories/radare2-command-injection-via-pdb-parser-symbol-names

Frequently asked

questions

It can be, depending on how radare2 is used. If radare2 is integrated into a server-side analysis service, CI pipeline, or automated tooling that accepts PDB files from remote users, a malicious PDB can be used for remote exploitation. In standalone desktop use, it is typically exploited by convincing a user to open a crafted PDB file.

An attacker needs the ability to supply or influence a PDB file that will be processed by radare2, and the radare2 user must execute the idp command (or an equivalent that triggers the vulnerable PDB parsing path). No additional authentication within radare2 is typically required.

The safest pattern is to eliminate direct command construction from untrusted symbol names by enforcing strict validation and escaping rules, and by using safer APIs for building commands. Additionally, limiting or disabling shell execution features when handling external files reduces the impact if parsing logic fails.

Future prevention relies on treating all file-derived metadata as untrusted input, enforcing rigorous input validation, avoiding manual command string concatenation, and incorporating security-focused code review and static analysis for parser components. Running analysis tools under least privilege and within sandboxed environments further mitigates the risk of command injection bugs.

Find out what's already
exploitable in your codebase.