Cloudanix VulnDB

CVE-2026-57456

High · 7.8

CVSS

7.8

EPSS

0.1%

Published

Jun 25, 2026

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A malicious Python file can make vulnerable versions of Vim run the attacker's code when a user triggers code completion.

Exploitation
Requires User Interaction
Attacker needs
User Interaction
Complexity
Low
Impact
Remote Code Execution
Component
Application
Class
Command Injection
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

Vim versions prior to 9.2.0699 contain a local code-execution flaw in Python omni-completion. When Python completion is invoked, Vim reconstructs Python function and class definitions from the currently opened buffer and passes the reconstructed source to Python exec(). Docstrings from the buffer are inserted verbatim into triple-quoted strings without escaping. A malicious Python file can therefore include a crafted docstring that terminates the generated string and injects arbitrary Python statements. If a user opens that file and triggers Python omni-completion, the injected Python executes with the privileges of the Vim process.

Why it matters to the business

An attacker can turn a malicious source file into a code-execution trigger for developers, administrators, or automation users who edit Python files with vulnerable Vim versions. Successful exploitation could lead to theft of source code or credentials, tampering with files, installation of persistence, or lateral movement from developer workstations and build systems. The issue is not known to be in CISA KEV, is not currently associated with ransomware use, and has a low EPSS score, but the impact is high where Vim is commonly used to inspect untrusted code, review pull requests, analyze samples, or edit files on privileged systems.

How an attack unfolds

An attacker prepares a Python file containing a specially crafted function or class docstring. The docstring is designed to break out of the triple-quoted literal that Vim creates internally while building omni-completion metadata, then append attacker-controlled Python code. The attacker delivers the file through a repository, patch, archive, email attachment, shared directory, issue reproducer, or any workflow where a user may inspect untrusted Python code. When the victim opens the file in a vulnerable Vim version and triggers Python omni-completion, for example while editing or requesting completions, Vim's completion script reconstructs the buffer content and calls exec() on it. The injected Python runs locally as the victim, enabling actions such as spawning commands, reading files, modifying project contents, writing startup files, or making outbound network connections.

How to fix it

Upgrade Vim to version 9.2.0699 or later. If packaged by an operating-system vendor or distribution, install the vendor-provided update that includes the upstream fix, because the displayed package version may differ from upstream Vim versioning. Where immediate upgrade is not possible, reduce exposure by disabling Python omni-completion for untrusted files, avoiding completion features when viewing untrusted Python code, opening untrusted source in sandboxed or disposable environments, and restricting outbound network access from developer workstations where feasible. Treat files from unknown repositories, issue attachments, and external code samples as potentially active content when opened in editors with language-aware features.

How to confirm the fix worked

Confirm that installed Vim builds report patch level 9.2.0699 or later, or that the distribution package changelog references the fix for unsafe Python omni-completion docstring handling. Run `vim --version` and review package-manager metadata across endpoints and build images. Validate that Python completion scripts are updated, especially `runtime/autoload/python3complete.vim` and any legacy `pythoncomplete.vim` shipped by the package. For exposure testing, verify whether users can trigger Python omni-completion in vulnerable versions while editing Python buffers; do not use live malicious payloads on production systems. Configuration-based mitigations should be validated by confirming that Python omni-completion is disabled or unavailable for untrusted Python buffers.

Typical attack path

  1. Craft a Python source file with a malicious docstring embedded in a function or class definition.
  2. Place the file where a target is likely to open it, such as a source repository, pull request, code sample, support bundle, or shared archive.
  3. Wait for the target to open the file using a vulnerable Vim version prior to 9.2.0699.
  4. Induce or rely on the user triggering Python omni-completion in the buffer.
  5. Exploit Vim's unescaped reconstruction of the docstring so injected Python is executed by exec().
  6. Run payload actions with the user's local permissions, such as command execution, credential access, file modification, or persistence.

How to detect it

Because exploitation occurs locally inside the editor process, detection should focus on endpoint telemetry rather than network-facing indicators. Review EDR, process creation, shell history, auditd, Sysmon, and macOS/Linux command execution logs for unusual child processes spawned by `vim`, `gvim`, `view`, `vi`, or related editor binaries. Pay particular attention to shells, Python interpreters, download utilities, SSH tools, credential-access commands, file modification utilities, and outbound network tools launched shortly after opening Python files from external or newly cloned sources. Review recently opened Python files for suspicious docstrings containing embedded triple quotes followed by executable Python constructs such as imports, os/system calls, subprocess usage, eval/exec, socket use, or file writes. Examine Vim swap files, undo files, shell command history, terminal scrollback, EDR file event logs, and repository working trees for evidence of malicious source files or post-exploitation artifacts. If centralized proxy, DNS, or firewall logs are available, correlate outbound connections from developer or administrator endpoints with suspicious Vim process activity. There are no universal network IOCs for this vulnerability; reliable detection depends on behavioral evidence and any payload-specific artifacts left by the attacker.

  • vim spawning /bin/sh
  • vim spawning /bin/bash
  • vim spawning sh
  • vim spawning bash
  • vim spawning python
  • vim spawning python3
  • vim spawning curl
  • vim spawning wget
  • vim spawning nc
  • vim spawning ncat
  • vim spawning netcat
  • vim spawning ssh
  • gvim spawning /bin/sh
  • gvim spawning /bin/bash
  • gvim spawning python3
  • process.parent.name:vim AND process.name:bash
  • process.parent.name:vim AND process.name:sh
  • process.parent.name:vim AND process.name:python3
  • process.parent.name:vim AND process.name:curl
  • process.parent.name:vim AND process.name:wget
  • process.parent.name:gvim AND process.name:bash
  • process.parent.name:gvim AND process.name:python3
  • """; import os
  • """;import os
  • """; import subprocess
  • """;import subprocess
  • """; exec(
  • """;exec(
  • """; eval(
  • """;eval(
  • """; __import__(
  • """;__import__(
  • """; open(
  • """;open(
  • runtime/autoload/python3complete.vim
  • pythoncomplete.vim

What your security team should do

  • Inventory Vim installations on developer workstations, administrator jump hosts, CI/build images, containers, and servers where users edit files interactively.
  • Prioritize upgrades to Vim 9.2.0699 or later on systems used to inspect untrusted code, handle third-party repositories, or operate with elevated privileges.
  • If upgrades cannot be completed quickly, disable Python omni-completion or require untrusted Python files to be reviewed in isolated sandboxes.
  • Educate developers and responders that editor completion and language-helper features can execute code-like logic when viewing malicious files.
  • Hunt for suspicious child processes or network activity spawned from Vim around the time users opened external Python files.
  • Review recent external code samples, pull requests, archives, and support bundles opened by privileged users if suspicious Vim activity is observed.
  • Monitor vendor advisories and distribution package updates for backported fixes, since package versions may not directly show upstream 9.2.0699.

The record

Vim is an open source, command line text editor. Prior to 9.2.0699, Vim's Python omni-completion (runtime/autoload/python3complete.vim and the legacy pythoncomplete.vim) executes reconstructed function and class definitions from the current buffer with exec() as part of populating the completion dictionary. When reconstructing that source, each scope's docstring is inserted verbatim between triple quotes with no escaping, so a hostile buffer can break out of the triple-quoted literal and execute attacker-controlled Python during omni-completion. This vulnerability is fixed in 9.2.0699.

Affected packages

Ecosystem Package Introduced Fixed

Related vulnerabilities