CVE-2026-57456
Vim vulnerability analysis and mitigation

Overview

CVE-2026-57456 is an arbitrary code execution vulnerability in Vim's Python omni-completion feature, classified as "Arbitrary Code Execution via Python Omni-Completion Docstrings." It affects all Vim versions prior to 9.2.0699 that are built with +python3 or +python support. The vulnerability was reported by researcher "morningbread" (Chenyuan Mi), disclosed via GitHub Security Advisory on June 21, 2026, and published to NVD on June 25, 2026. It carries a CVSS v3.1 base score of 7.8 (High) and a CVSS v4.0 base score of 8.4 (High) (GitHub Advisory, Feedly).

Technical details

The root cause is improper control of code generation (CWE-94) in runtime/autoload/python3complete.vim and the legacy pythoncomplete.vim. These scripts reconstruct function and class definitions from the current buffer and pass them to Python's exec() to populate the completion dictionary. Docstrings are inserted verbatim between triple quotes (""") with no escaping — the doc() helper only strips leading/trailing quote and whitespace characters, so an embedded """ sequence within a docstring survives and breaks out of the generated triple-quoted literal. An attacker crafts a hostile Python buffer containing a specially formed docstring (e.g., 'x""" + malicious expression + """y') that, when the completion code is reconstructed and exec()'d, causes the injected Python expression to be evaluated at class-definition time. This is a follow-on to a prior incomplete fix (GHSA-65p9-mwwx-7468, patch 9.2.0597) that sanitized parameter defaults and class base lists but left the docstring path unaddressed (GitHub Advisory, Vim Commit).

Impact

Successful exploitation allows an attacker to execute arbitrary Python code within the victim's Vim process, running with the full privileges of the user who opened the file. This results in high confidentiality, integrity, and availability impact on the local system — an attacker could read sensitive files, modify data, install malware, or establish persistence. Vim instances built without +python3 and +python support are not affected; exploitation also requires the user to actively trigger omni-completion (e.g., via CTRL-X CTRL-O) in the hostile buffer, so merely opening the file is insufficient (GitHub Advisory, Feedly).

Exploitation steps

  1. Craft a malicious Python file: Create a Python source file containing a class or function with a specially crafted docstring that embeds a """ sequence to break out of the triple-quoted literal, followed by an attacker-controlled Python expression. For example:
class Foo:
    'x"""' + open("/tmp/pwned", "w").close() + '"""y'
    pass
Foo.
  1. Deliver the file to the victim: Distribute the malicious .py file via a code repository, email attachment, shared project, or any other means that causes the target to open it in Vim.
  2. Wait for omni-completion trigger: The exploit activates only when the user triggers Python omni-completion in the buffer — either manually via CTRL-X CTRL-O, or automatically via a Vim plugin that invokes the completion function on Python buffers.
  3. Code execution: When omni-completion fires, python3complete.vim (or pythoncomplete.vim) reconstructs the buffer's class/function definitions and passes the result to exec(). The embedded """ breaks out of the triple-quoted docstring literal, and the attacker's Python expression is evaluated with the privileges of the Vim process (GitHub Advisory, Vim Commit).

Indicators of compromise

  • File System: Unexpected files created or modified in user-writable directories (e.g., /tmp/, ~/.config/, home directory) shortly after a Vim session involving Python file editing; new scripts or cron entries added under the user's account.
  • Process: Unusual child processes spawned by the Vim process (e.g., python3, bash, sh, curl, wget) during or immediately after an editing session on a Python file.
  • Logs: Shell history or audit logs showing Vim invocations on unfamiliar .py files followed by unexpected network connections or file creation events.
  • Network: Outbound connections from the user's workstation to unknown external hosts originating from a process tree rooted in Vim, particularly after editing Python files from untrusted sources.

Mitigation and workarounds

The fix is available in Vim 9.2.0699, released June 21, 2026. The patch replaces verbatim docstring insertion with Python's repr() function, ensuring docstrings are properly escaped before being passed to exec() (Vim Commit, Vim Release). Ubuntu has issued security notice USN-8500-1 for this vulnerability. Until patching is possible, users should avoid opening untrusted Python files in Vim, disable Python omni-completion (e.g., by removing or not loading python3complete.vim/pythoncomplete.vim), or use a Vim build compiled without +python3/+python support. Upgrading to Vim 9.2.0699 or later is the recommended remediation (GitHub Advisory, Ubuntu Advisory).

Community reactions

The vulnerability was acknowledged and fixed by Vim maintainer Christian Brabandt (chrisbra), who credited researcher Chenyuan Mi ("morningbread") for reporting, analyzing, and suggesting the fix (GitHub Advisory). The Yocto Project security mailing list flagged the issue for embedded Linux distributions. Tenable published Nessus detection plugins (IDs 323747 and 324991) and a container security plugin (443965) for the vulnerability. The issue received coverage in the Hawk-Eye weekly threat landscape digest for Week 27 of 2026, noting it as part of the broader trend of editor-based code injection vulnerabilities.

Additional resources


SourceThis report was generated using AI

Related Vim vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-59858HIGH8.4
  • Vim logoVim
  • vim-enhanced
NoYesJul 09, 2026
CVE-2026-59856HIGH8.4
  • Vim logoVim
  • vim
NoYesJul 09, 2026
CVE-2026-57456HIGH8.4
  • Vim logoVim
  • vim-common
NoYesJun 25, 2026
CVE-2026-59857MEDIUM5.6
  • Vim logoVim
  • xxd
NoYesJul 09, 2026
CVE-2026-57455MEDIUM4
  • Vim logoVim
  • vim-filesystem
NoYesJun 25, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management