/

CVE-2026-73078

Severity:

HIGH RISK

(8.8)

Command Injection (CWE-77) in Vim netrw Plugin Menus

CVE-2026-73078

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-77, CWE-184

Impact:

Arbitrary command execution

Severity:

HIGH RISK

(8.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

Vim's netrw plugin can construct executable menu commands from attacker-controlled directory paths without consistently neutralizing command separators or quotes. When a crafted path is browsed or bookmarked in GUI Vim, this may allow arbitrary Ex commands and operating-system commands to run with the user's privileges.

Vim's netrw plugin can construct executable menu commands from attacker-controlled directory paths without consistently neutralizing command separators or quotes. When a crafted path is browsed or bookmarked in GUI Vim, this may allow arbitrary Ex commands and operating-system commands to run with the user's privileges.

Affected context

The issue occurs in GUI Vim environments where the netrw plugin creates Bookmarks, History, or Targets menu entries from directory paths. Risk is present when an attacker can influence a path that is subsequently browsed or bookmarked and the resulting value is interpolated into a :menu command without complete escaping.

The issue occurs in GUI Vim environments where the netrw plugin creates Bookmarks, History, or Targets menu entries from directory paths. Risk is present when an attacker can influence a path that is subsequently browsed or bookmarked and the resulting value is interpolated into a :menu command without complete escaping.

Exploit preconditions

  • Attack surface: GUI Vim's netrw menu-generation functionality
  • Required access: Ability to cause or place a crafted directory path where it can be browsed or bookmarked
  • Trigger point: Construction and execution of netrw Bookmark, History, or Target menu commands
  • Why exploitation is possible: Attacker-controlled path data reaches Ex command construction without reliably neutralizing the | command separator and single-quote characters
  • Attack surface: GUI Vim's netrw menu-generation functionality
  • Required access: Ability to cause or place a crafted directory path where it can be browsed or bookmarked
  • Trigger point: Construction and execution of netrw Bookmark, History, or Target menu commands
  • Why exploitation is possible: Attacker-controlled path data reaches Ex command construction without reliably neutralizing the | command separator and single-quote characters

Why this happens

The vulnerability results from treating filesystem path data as safe command text when dynamically constructing Vim :menu commands. Escaping and filtering logic does not consistently remove or encode command-control characters at several construction sites, allowing path content to alter the intended command stream. This maps primarily to CWE-77: Improper Neutralization of Special Elements used in a Command, with CWE-184: Incomplete List of Disallowed Inputs reflecting gaps in the filtering and neutralization logic.

The vulnerability results from treating filesystem path data as safe command text when dynamically constructing Vim :menu commands. Escaping and filtering logic does not consistently remove or encode command-control characters at several construction sites, allowing path content to alter the intended command stream. This maps primarily to CWE-77: Improper Neutralization of Special Elements used in a Command, with CWE-184: Incomplete List of Disallowed Inputs reflecting gaps in the filtering and neutralization logic.

Potential impact

  • An attacker may execute arbitrary Ex commands in the affected Vim process.
  • The process may execute operating-system commands with the user's privileges.
  • User files, editor settings, or project data could be modified or disclosed.
  • The affected workstation may be used as a foothold for further compromise.
  • An attacker may execute arbitrary Ex commands in the affected Vim process.
  • The process may execute operating-system commands with the user's privileges.
  • User files, editor settings, or project data could be modified or disclosed.
  • The affected workstation may be used as a foothold for further compromise.

General mitigation guidance

Mitigation focuses on preventing untrusted path data from becoming executable command syntax.

Common defensive patterns include:

  • Passing path values through APIs that preserve data as arguments rather than concatenating command strings.
  • Applying context-aware escaping for every command-construction site, including menu labels and actions.
  • Using strict allowlists for expected path characters where product behavior permits.
  • Avoiding dynamic menu generation from untrusted values or isolating such values from executable menu commands.
  • Running GUI editor workflows with least privilege and limiting access to sensitive files and operating-system capabilities.
  • Applying security-focused regression tests for command separators, quoting characters, and nested path representations.

Mitigation focuses on preventing untrusted path data from becoming executable command syntax.

Common defensive patterns include:

  • Passing path values through APIs that preserve data as arguments rather than concatenating command strings.
  • Applying context-aware escaping for every command-construction site, including menu labels and actions.
  • Using strict allowlists for expected path characters where product behavior permits.
  • Avoiding dynamic menu generation from untrusted values or isolating such values from executable menu commands.
  • Running GUI editor workflows with least privilege and limiting access to sensitive files and operating-system capabilities.
  • Applying security-focused regression tests for command separators, quoting characters, and nested path representations.

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying string concatenation or interpolation into Vim Ex commands, especially :menu commands.
  • Code review checks for path, filename, or bookmark values flowing into command execution without context-specific escaping.
  • Tests that exercise command separators, quote characters, whitespace, and other metacharacters in directory names.
  • Policy enforcement that flags dynamic command construction from filesystem or user-controlled input.
  • Runtime monitoring for unexpected child processes or unusual Ex command activity from GUI editor sessions.
  • Neutral automated code-review or security-scanning tools that recognize command-injection data flows.

Organizations can look for this class of issue through:

  • Static analysis rules identifying string concatenation or interpolation into Vim Ex commands, especially :menu commands.
  • Code review checks for path, filename, or bookmark values flowing into command execution without context-specific escaping.
  • Tests that exercise command separators, quote characters, whitespace, and other metacharacters in directory names.
  • Policy enforcement that flags dynamic command construction from filesystem or user-controlled input.
  • Runtime monitoring for unexpected child processes or unusual Ex command activity from GUI editor sessions.
  • Neutral automated code-review or security-scanning tools that recognize command-injection data flows.

Sources

SourceLink
github.comgithub.com/vim/vim/commit/29c6fd090d4520592f8be7d9ec81190edf25ef69
github.comgithub.com/vim/vim/security/advisories/GHSA-rcr7-f3wr-22r2

Frequently asked

questions

It is not inherently a network-facing vulnerability. Exploitation generally requires a crafted path to reach a GUI Vim netrw workflow, such as through a browsed or bookmarked directory.

The attacker must be able to influence a directory path that the victim's GUI Vim session browses or bookmarks. The resulting menu action must then be created and invoked.

Do not concatenate untrusted paths into executable Ex commands. Use data-preserving APIs where possible and apply complete, context-aware escaping at every command-construction boundary.

Treat paths and filenames as untrusted input, enforce command-construction policies, review all dynamic menu and Ex command generation, and test metacharacter handling in automated security checks.

It is not inherently a network-facing vulnerability. Exploitation generally requires a crafted path to reach a GUI Vim netrw workflow, such as through a browsed or bookmarked directory.

The attacker must be able to influence a directory path that the victim's GUI Vim session browses or bookmarks. The resulting menu action must then be created and invoked.

Do not concatenate untrusted paths into executable Ex commands. Use data-preserving APIs where possible and apply complete, context-aware escaping at every command-construction boundary.

Treat paths and filenames as untrusted input, enforce command-construction policies, review all dynamic menu and Ex command generation, and test metacharacter handling in automated security checks.

Find out what's already
exploitable in your codebase.