/

CVE-2026-51401

Severity:

HIGH RISK

(7.7)

Code Injection (CWE-94) in Vim VMS Filename Fixer Function

CVE-2026-51401

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(7.7)

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 contains a code injection vulnerability in the vms_fixfilename() function in its VMS-specific source code. A local attacker who can provide or influence input processed by this function may be able to execute arbitrary code in the context of the Vim process.

Affected context

The issue occurs in Vim's VMS platform support, specifically in the vms_fixfilename() filename-processing function. It becomes risky when a local user can cause Vim to process attacker-controlled filename data through a code path that reaches this function, and the resulting input is handled as executable content rather than as ordinary data.

Exploit preconditions

  • Attack surface: Local filename-processing functionality in Vim on VMS
  • Required access: Local access sufficient to provide or influence filenames or related input
  • Trigger point: Invocation of vms_fixfilename() during filename handling
  • Why exploitation is possible: Improper handling of attacker-controlled data may allow it to be interpreted as code by the Vim process

Why this happens

The underlying bug is an unsafe separation between data and executable logic in a filename-processing routine. When externally influenced filename content reaches an execution-sensitive operation without adequate neutralization or strict handling, the input may alter program behavior or cause code execution. This behavior maps to CWE-94, Improper Control of Generation of Code, commonly called code injection.

Potential impact

  • A local attacker may execute arbitrary code with Vim's operating privileges.
  • The attacker could modify files accessible to the Vim process.
  • User data, source code, or configuration files may be exposed or altered.
  • The issue could enable persistence or further compromise of the affected system.

General mitigation guidance

Mitigation generally focuses on keeping filename data strictly separate from

executable operations and applying platform-appropriate canonicalization and

validation before processing.

Common defensive patterns include:

  • Treating filenames and related metadata solely as data.
  • Avoiding evaluation, command construction, or dynamic code generation from filenames.
  • Applying allowlist-based validation for syntax that is genuinely required.
  • Using safe APIs that pass arguments as data rather than concatenated commands.
  • Running editor processes with least privilege and limiting access to sensitive files.
  • Reducing trust in local input sources and applying filesystem and process isolation where practical.

How teams detect issues like this

Detection approaches may include:

  • Static analysis for filename values reaching evaluators, command builders, or dynamic execution APIs.
  • Code review checks for string concatenation involving filenames and executable operations.
  • Tests using metacharacters, delimiters, and unusual platform-specific filename forms as inert inputs.
  • Policy enforcement that prohibits dynamic code generation from filesystem-derived data.
  • Runtime monitoring for unexpected child processes, command execution, or file changes initiated by Vim.

Automated code review and security scanning tools can help identify these data-to-code flows.

Sources

SourceLink
gist.github.comgist.github.com/jiejiaodedengdai/ff5d34a523167e09b7d8330cc9f5d4e5#file-vim-os_vms-cves-md
github.comgithub.com/vim/vim
github.comgithub.com/vim/vim/blob/master/src/os_vms.c

Frequently asked

questions

The described issue is local in scope. Exploitation generally requires a

user or process to supply or influence filename data that Vim subsequently

processes on the affected VMS environment.

The attacker needs access to run Vim or otherwise influence input reaching

the vulnerable filename-processing path. The resulting actions are limited

by the privileges of the Vim process.

Keep filename content as data, avoid dynamic evaluation or command

construction, and apply strict validation before any platform-specific

filename transformation.

Use safe argument-passing APIs, review all data-to-code boundaries, test

platform-specific parsing paths with adversarial inputs, and apply least

privilege to editor processes.

Find out what's already
exploitable in your codebase.