CVE-2026-57456: Vim Python Omni-Completion Code Execution Vulnerability
Vim's Python omni-completion feature (which auto-suggests function and class names while editing) contains a code execution vulnerability. When you trigger completion on a malicious Python file, Vim reconstructs function and class definitions from the buffer and executes them using Python's exec() function. An attacker can craft a docstring that breaks out of Python's triple-quote syntax and runs arbitrary code. This happens automatically during normal editor usage—no manual code execution is required. The vulnerability affects Vim versions before 9.2.0699.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 7.8 HIGH · CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Weaknesses (CWE)
- CWE-94
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-25 / 2026-06-26
NVD description (verbatim)
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.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability exists in Vim's Python 3 omni-completion module (runtime/autoload/python3complete.vim and legacy pythoncomplete.vim), which uses exec() to evaluate reconstructed Python definitions for completion population. When reconstructing function and class scopes, docstrings are inserted verbatim between triple quotes without any escaping or sanitization. An attacker can inject a docstring containing triple quotes followed by arbitrary Python code to escape the quoted literal and achieve code execution within the Python interpreter context that Vim spawns. The flaw is a classic code injection issue (CWE-94: Improper Control of Generation of Code) where untrusted input from the buffer is reconstructed into executable code without proper escaping.
Business impact
Any user opening a Vim buffer containing a hostile Python file and triggering omni-completion will execute the attacker's code with the privileges of the Vim process. For developers and system administrators who rely on Vim, this creates a supply-chain or file-handling risk: cloning a repository, opening a Python file, and pressing Ctrl+X Ctrl+O (or equivalent completion keystroke) could compromise the user's session. The impact is heightened in shared editing environments or when reviewing untrusted code. Malicious code runs in the user's security context, potentially allowing data theft, credential harvesting, or lateral movement.
Affected systems
Vim versions prior to 9.2.0699 are affected. Any installation with Python 3 omni-completion enabled and the pythoncomplete or python3complete modules active can be exploited. The vulnerability is not specific to a particular operating system; it affects Vim on Linux, macOS, Windows, and other platforms where Vim and Python 3 are available. Users with Vim compiled without Python support are not affected.
Exploitability
Exploitability is straightforward. The attack requires local code execution (AV:L) and user interaction (UI:R)—specifically, the user must open a hostile buffer and trigger omni-completion. No authentication or special privileges are needed before the vulnerable code path is reached. Once triggered, code execution is immediate and reliable. The barrier to exploitation is low: an attacker commits a malicious .py file to a public repository, and any developer who clones it and opens the file in Vim faces risk. Tools that automatically trigger completion (e.g., vim-lsp or similar plugins) could lower the user-interaction requirement further.
Remediation
Update Vim to version 9.2.0699 or later. This release includes fixes to properly escape docstrings during function and class reconstruction, preventing the triple-quote breakout. Users should verify their installed version with :version in Vim and consult the official Vim release notes to confirm the patch is included. For distributions that package Vim, check with your package manager for availability of the patched version. In the interim, disabling Python omni-completion (by not loading python3complete.vim or limiting its scope) reduces risk, though this is a workaround rather than a fix.
Patch guidance
The fix is included in Vim 9.2.0699. Verify your version by running :version inside Vim and checking the included patch number. Most Linux distributions should release updates within days of the Vim upstream release. macOS users can update via Homebrew (brew upgrade vim) or MacPorts. Windows users can download the latest installer from vim.org. After patching, restart Vim and re-test omni-completion to ensure it functions as expected. If you maintain a custom Vim build, apply the patch from the official Vim repository and recompile.
Detection guidance
Monitor for unexpected Python subprocess spawning from Vim, unusual process executions triggered by omni-completion (Ctrl+X Ctrl+O), or signs of code execution during editor sessions. On systems with Python audit logging enabled, look for exec() or eval() calls originating from Vim's Python context with suspicious or obfuscated payloads. Review Vim logs and terminal history for evidence of completion being triggered on untrusted files. Network-based detection is limited since code execution is local; focus on endpoint logs, process execution monitoring (EDR/XDR tools), and file integrity checks for unexpected modifications during or after Vim sessions.
Why prioritize this
This vulnerability scores 7.8 (HIGH) due to the combination of high-impact code execution (C:H, I:H, A:H), low attack complexity, and minimal barriers to exploitation. While the attack requires user interaction, that interaction—opening a file and using a standard editor feature—is routine for developers. The attack surface is broad (any Vim user with Python completion enabled), and the consequences are severe (full code execution). Organizations with developer populations using Vim should treat this as medium-to-high priority for patching, particularly if developers handle untrusted code or work in collaborative environments.
Risk score, explained
The CVSS 3.1 score of 7.8 reflects a HIGH severity rating. Attack Vector is Local (AV:L) because the attacker must deliver a malicious file to the target system; Attack Complexity is Low (AC:L) because exploiting the code path requires no special conditions beyond opening a file and triggering completion. Privileges Required are None (PR:N), and User Interaction is Required (UI:R) because the developer must manually trigger omni-completion. The scope is Unchanged (S:U). The impact across Confidentiality, Integrity, and Availability is High (C:H, I:H, A:H) because code execution grants full control over the Vim process and any child processes, enabling data exfiltration, system compromise, and denial of service.
Frequently asked questions
Does this vulnerability require the attacker to have a Vim account or special access?
No. The attacker only needs to deliver a malicious .py file to the victim's system—typically via a public repository, email attachment, or file sharing. Once the victim opens the file in Vim and triggers Python omni-completion, the payload executes with no further privileges required.
Are users who do not use Python omni-completion at risk?
No. This vulnerability is specific to the Python 3 omni-completion feature. Users who disable pythoncomplete.vim, do not load Python modules, or do not trigger completion on untrusted code are not exposed.
Can Vim distributions or packages without Python support be affected?
No. Vim must be compiled with Python 3 support, and the python3complete module must be loaded for this vulnerability to be exploitable. Vim installations without Python support are unaffected.
Should I avoid opening Python files in Vim until I patch?
The safest approach is to update to 9.2.0699 immediately. If patching is delayed, avoid triggering omni-completion on Python files from untrusted sources, and consider disabling the python3complete.vim module as a temporary workaround. However, this is not a sustainable solution—patching is the proper fix.
This analysis is based on publicly available information regarding CVE-2026-57456 as of June 26, 2026. The CVSS score (7.8 HIGH) and affected version (prior to 9.2.0699) are provided by official sources. This vulnerability is not yet listed on CISA's Known Exploited Vulnerabilities (KEV) catalog. Organizations should verify patch availability and compatibility with their Vim deployments before applying updates. This explanation is for informational purposes and does not constitute professional security advice; consult your organization's security team or the Vim project for official guidance. Source: NVD (public-domain), retrieved 2026-08-03. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-47162HIGHVim netrw Code Injection Vulnerability – Arbitrary Code Execution
- CVE-2026-52858HIGHVim Python Omni-Completion Code Execution Vulnerability
- CVE-2026-52860HIGHVim Python Omni-Completion Arbitrary Code Execution
- CVE-2026-55895HIGHVim Netrw Code Injection Vulnerability (CVSS 7.8)
- CVE-2026-47167MEDIUMVim Cucumber Plugin Code Injection via Unsafe Ruby Eval
- CVE-2026-10904HIGHChrome V8 Sandbox Escape Remote Code Execution
- CVE-2026-10928HIGHScript Injection in Google Chrome Headless – CVSS 8.8 High Severity
- CVE-2026-11231HIGHChrome Safe Browsing Code Execution on macOS – Patch Now