/

CVE-2026-43961

Severity:

HIGH RISK

(7.8)

Code Injection (CWE-94) in Vim netrw File Name Plugin

CVE-2026-43961

Awaiting Analysis

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Vimscript and Shell Command Execution

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 flaw in Vim's netrw plugin allows specially crafted filenames to escape the quoted context used during mark and unmark operations. If such a filename is processed by netrw, an attacker may execute arbitrary Vimscript and run shell commands with the privileges of the user running Vim.

Affected context

The vulnerability occurs in Vim's netrw plugin when it processes filenames during mark or unmark operations. Risk depends on a crafted filename reaching the affected code path and being opened or handled by a user through a Vim session. The resulting commands inherit the permissions of the Vim process.

Exploit preconditions

  • Attack surface: Vim's netrw filename-processing and mark/unmark functionality
  • Required access: Ability to introduce or control a filename that Vim will process
  • Trigger point: Affected netrw mark or unmark operation
  • Why exploitation is possible: Quote handling permits expression fragments in a filename to escape the intended quoted context and be evaluated as Vimscript

Why this happens

The underlying bug is improper neutralization of user-controlled filename data before it is embedded in an expression evaluated by Vimscript.

When quote characters and expression fragments are not escaped or isolated correctly, data is interpreted as executable script rather than treated solely as a filename. This maps to CWE-94: Improper Control of Generation of Code, because attacker-influenced input becomes part of executable code.

Potential impact

  • Arbitrary Vimscript execution
  • Execution of shell commands with the user's privileges
  • Modification or deletion of files accessible to the Vim process
  • Exposure or alteration of user data
  • Further compromise of development or workstation environments

General mitigation guidance

Mitigation generally focuses on preventing filenames and other external data from entering executable expression contexts.

Common defensive patterns include:

  • Treating filenames as data and avoiding dynamic expression construction
  • Applying context-aware escaping before inserting values into Vimscript expressions
  • Using structured APIs that pass arguments separately from executable code
  • Restricting shell-command capabilities for editor processes where practical
  • Running Vim with least-privilege accounts and limiting access to sensitive files
  • Applying security review requirements to plugins that evaluate dynamic expressions

These controls reduce exposure even when untrusted filenames are present.

How teams detect issues like this

Organizations can detect related risks through:

  • Static analysis for dynamic expression evaluation involving filenames or other external input
  • Code review checks for string concatenation inside Vimscript execution paths
  • Searches for shell-command invocation using values derived from filesystem metadata
  • Tests using filenames containing quotes, delimiters, and expression-like characters
  • Policy enforcement requiring context-aware escaping and structured argument handling

Automated code review and security scanning tools may help identify unsafe data-to-code flows.

Sources

SourceLink
access.redhat.comaccess.redhat.com/errata/RHSA-2026:57614
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-43961
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2460434
github.comgithub.com/vim/vim/security/advisories/GHSA-66hr-7p6x-x5j3
openwall.comopenwall.com/lists/oss-security/2026/05/14/7

Frequently asked

questions

Exploitation is generally dependent on a crafted filename reaching the affected netrw operation. The filename could originate from a local filesystem, shared directory, archive, or another workflow that exposes attacker-controlled files.

The attacker typically needs a way to place or influence a filename that the victim's Vim and netrw plugin will process. Direct control of the session is not necessarily required.

The safest pattern is to ensure filenames remain data throughout processing, use context-aware escaping, and avoid constructing executable Vimscript from untrusted values.

Review editor plugins for data-to-code flows, test handling of metacharacters and quote characters, restrict shell execution privileges, and apply static analysis or policy checks to dynamic expression and command construction.

Find out what's already
exploitable in your codebase.