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
idpor related commands that trigger the PDB parser'sprint_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
idpcommand (or equivalent functionality) in radare2 against the malicious PDB file, which invokesprint_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.

