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.

