/

CVE-2026-40499

Severity:

HIGH RISK

(7.8)

Command Injection in radare2 PDB Parser print_gvars()

CVE-2026-40499

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution in Analysis Environment

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 attacker-controlled section header names can be interpreted as r2 commands.

By embedding a newline byte in the PE section header name field of a malicious PDB file, an attacker can inject arbitrary radare2 commands that execute when the idp command processes the file, potentially leading to arbitrary command execution in the analysis environment.

Affected context

This vulnerability affects radare2 environments that analyze PDB/PE artifacts using the idp command or other workflows that invoke the PDB parser's print_gvars() functionality.

It manifests when radare2 parses PDB data whose section header name fields are treated as command strings, and newline characters within those fields are not sanitized before being passed to the radare2 command interpreter.

The risk is most relevant for workflows that ingest untrusted or third-party binaries and associated debug symbols (PDB files), such as malware analysis, reverse engineering of unknown software, or automated triage pipelines.

Exploit preconditions

  • Attack surface: Local radare2 instance parsing PDB files (reverse engineering or analysis workflows).
  • Required access: Ability to supply or influence the PDB file being analyzed (e.g., opening an attacker-provided binary with associated PDB, or importing PDB directly).
  • Trigger point: Running idp (or any feature that triggers print_gvars()) on a specially crafted PDB file that contains a section header name with embedded newline and injected r2 commands.
  • Why exploitation is possible: The PDB parser treats section header names as trusted text and passes them to the radare2 command execution context without adequate sanitization or escaping. The presence of a newline byte allows the attacker-controlled string to break the intended command structure and inject additional radare2 commands, which are then executed.

Why this happens

The underlying issue is a command injection flaw where user-controlled data is concatenated into or interpreted as executable commands by the radare2 engine.

In print_gvars(), section header names from the PDB (which originate from the analyzed file and must be considered untrusted) are used in contexts where they influence the command line that radare2 will interpret.

Because newline bytes are not filtered or escaped, an attacker can terminate the expected command and append new commands that radare2 then executes.

This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), generalized here as improper neutralization of command delimiters in a command interpreter, where data and code share the same channel without robust separation.

Potential impact

  • Execution of arbitrary radare2 commands within the user's analysis session.
  • Modification of analysis state, including symbol tables, comments, scripts, or project metadata.
  • Arbitrary file reads or writes through radare2 scripting capabilities, depending on installed plugins and configuration.
  • Use of radare2 as a pivot to trigger external tools or scripts, potentially leading to OS-level command execution under the analyst's user privileges.
  • Corruption or poisoning of automated analysis pipelines that process large volumes of untrusted artifacts.

General mitigation guidance

Effective mitigation focuses on treating all values originating from parsed binaries and symbol files as untrusted and ensuring strict separation between data and commands:

  • Neutralize or escape control characters such as newline, carriage return, semicolon, and other command delimiters before incorporating any parsed field into command strings.
  • Avoid directly concatenating user-controlled text into command expressions; instead, pass data as parameters through structured APIs that do not re-interpret them as commands.
  • Constrain the command execution surface exposed to parsers so that parsing routines do not invoke general-purpose command interpreters with attacker-controlled input.
  • Apply a least-privilege model to analysis sessions, running radare2 with minimal file system and process capabilities to limit the impact if injection occurs.
  • Consider safe-by-default parser design, where display or logging of untrusted names is handled by formatting routines that do not interact with the command execution engine.

How teams detect issues like this

Detection strategies can be both code-centric and workflow-centric:

  • Static analysis: Search for locations where parser code (e.g., PDB/PE readers) feeds unvalidated strings into functions that interpret or execute commands. Flag usage patterns where newline or other control characters from parsed data can influence command boundaries.
  • Code review: During manual review, scrutinize any integration between binary parsing routines and the radare2 command interpreter. Pay attention to string formatting (e.g., snprintf, string concatenation) that builds command lines from parsed fields such as section names, symbol names, or paths.
  • Security testing: Use fuzzing and crafted PDB/PE samples to verify how the parser behaves when section names or other fields contain newlines, semicolons, or command-like payloads. Monitor for unexpected command execution or state changes in radare2.
  • Policy enforcement: Integrate automated checks in CI that detect introduction of new parser-to-command-interpreter coupling, or enforce coding standards requiring sanitization of all external data before it can influence command execution.

Sources

SourceLink
github.comgithub.com/radareorg/radare2/commit/5590c87deeb7eb2a106fd7aab9ca88bfeebb7397
github.comgithub.com/radareorg/radare2/issues/25752
github.comgithub.com/radareorg/radare2/releases/tag/6.1.4
vulncheck.comvulncheck.com/advisories/radare2-command-injection-via-pdb-parser-print-gvars

Frequently asked

questions

Not in the traditional network sense. Exploitation typically occurs when a user or automated system opens a malicious PDB/PE artifact with radare2. The attacker's vector is providing the crafted file; the actual execution happens locally in the analysis environment.

An attacker needs the ability to get a malicious PDB (or PE with associated PDB) processed by radare2. This can happen through sharing of binaries, submission to analysis services, or any workflow that imports untrusted debug symbols without prior validation.

The most robust pattern is to sanitize and escape all untrusted fields before they interact with the command interpreter, removing or encoding newline and other control characters, and ideally restructuring the code so that parsers never directly compose command strings from parsed data.

Establish a clear boundary between parsing and command execution layers, enforce secure coding guidelines that forbid direct use of untrusted data in command strings, and use static analysis plus targeted security reviews to examine all places where binary metadata flows into interpreters or scripting engines.

Find out what's already
exploitable in your codebase.