Cloudanix VulnDB

CVE-2026-59856

High · 7.8

CVSS

7.8

EPSS

0.2%

Published

Jul 9, 2026

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A malicious PHP file can trick older versions of Vim into running commands on a developer’s computer when code completion is used.

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

What it actually does

CVE-2026-59856 is a local, user-assisted command injection vulnerability in Vim prior to 9.2.0736. The vulnerable PHP omni-completion logic in runtime/autoload/phpcomplete.vim takes class or trait names from the PHP buffer being edited and inserts them into a Vim search() expression executed through win_execute() without proper escaping. A crafted PHP identifier containing a single quote can break out of the intended search string; because Vim honors the bar character as an Ex command separator, attacker-controlled text can be interpreted as additional Vim Ex commands. By injecting a :! shell escape command, the attacker can execute arbitrary operating-system commands with the privileges of the user running Vim.

Why it matters to the business

An attacker can weaponize a PHP source file so that a developer, administrator, or automation process using a vulnerable Vim version may execute attacker-controlled commands after opening the file and triggering PHP omni-completion. Successful exploitation can lead to workstation compromise, theft of source code or credentials, tampering with development artifacts, installation of malware, or pivoting into build and deployment environments. The issue is not remotely exploitable without user interaction, and EPSS is currently low, but public exploitability is noted and developer workstations are high-value targets because they often hold repository access, signing keys, cloud credentials, and production deployment privileges.

How an attack unfolds

An attacker prepares a malicious PHP file containing a specially crafted class or trait name that includes a single quote to terminate the vulnerable search() string and a bar-delimited Ex command payload. The victim opens the file in Vim versions prior to 9.2.0736 and invokes PHP omni-completion, commonly through insert-mode completion such as Ctrl-X Ctrl-O when editing PHP code. Vim’s PHP completion script parses the buffer, builds a search pattern using the attacker-controlled name without escaping it, and executes it through win_execute(). The malformed name changes the intended Vimscript execution flow so the injected Ex command is processed. If the payload uses :!, Vim launches an operating-system shell command, allowing code execution as the local user. The attacker’s follow-on actions may include downloading a second-stage payload, modifying shell profiles, stealing SSH or Git credentials, or altering source files.

How to fix it

Upgrade Vim to version 9.2.0736 or later wherever Vim is installed, including developer workstations, build images, CI runners, administrative jump hosts, containers, and packaged toolchains. If a vendor distribution backports security fixes, install the vendor-provided patched Vim package and verify that it includes the fix for the PHP omni-completion script. Where immediate upgrade is not possible, reduce exposure by disabling or avoiding PHP omni-completion in Vim, avoiding editing untrusted PHP files with vulnerable Vim versions, disabling modelines and unsafe editor automation where applicable, and using sandboxed or disposable environments for reviewing untrusted code. Security teams should also treat unexpected Vim-spawned shell commands as suspicious and restrict egress or credential access from development workstations where feasible.

How to confirm the fix worked

Confirm installed Vim versions report 9.2.0736 or later using commands such as vim --version or package-manager inventory. For vendor-maintained packages, validate the installed package changelog or security advisory confirms the phpcomplete.vim fix even if the upstream version string differs. Check that runtime/autoload/phpcomplete.vim has been updated from a patched package and is not overridden by an older copy in user runtime paths. To validate exposure reduction, test on a non-production system that invoking PHP omni-completion on a crafted PHP identifier no longer results in execution of unintended Ex commands or shell commands. Inventory systems that process or review PHP code and ensure vulnerable Vim versions are removed from base images, developer endpoint management, and CI/build containers.

Typical attack path

  1. Attacker crafts a PHP source file with a malicious class or trait name designed to break out of Vim’s PHP omni-completion search expression.
  2. Attacker delivers the file through a repository pull request, code sample, archive, ticket attachment, chat message, or other developer-facing channel.
  3. Victim opens the crafted PHP file using a vulnerable Vim version prior to 9.2.0736.
  4. Victim invokes PHP omni-completion while editing the file.
  5. Vim’s vulnerable phpcomplete.vim script interpolates the malicious name into a win_execute() search() call without escaping.
  6. Injected bar-separated Ex commands are executed by Vim.
  7. A :! payload runs arbitrary operating-system commands with the victim user’s privileges.
  8. Attacker uses the resulting execution to establish persistence, steal credentials, modify code, or pivot to connected development and build systems.

How to detect it

Investigate endpoint and EDR telemetry for instances where vim, gvim, vim.basic, vim.tiny, view, nvim only if it bundles or uses the vulnerable Vim runtime, or related editor processes spawn shell or command execution children such as sh, bash, zsh, dash, fish, cmd, powershell, curl, wget, python, perl, ruby, nc, or openssl. Review shell history, process creation logs, auditd, Sysmon, macOS EndpointSecurity, Linux journald, and EDR command-line telemetry for unexpected commands whose parent process is Vim. Examine recently opened PHP files from repositories, downloads, attachments, and temporary directories for class or trait declarations containing embedded single quotes, vertical bars, Vim Ex command fragments, or shell escape syntax. Look for post-exploitation artifacts such as new files in temporary directories, modified shell startup files, new SSH authorized_keys entries, unexpected credential access, Git credential helper reads, or outbound connections initiated by commands spawned from Vim. Correlate suspicious activity with developer actions around PHP omni-completion usage and with file access to untrusted PHP source files. There are no globally unique network IOCs for this vulnerability because the payload is attacker-controlled, so detection should focus on vulnerable editor behavior and child-process execution patterns.

  • runtime/autoload/phpcomplete.vim
  • autoload/phpcomplete.vim
  • vim -> sh
  • vim -> bash
  • vim -> zsh
  • vim -> dash
  • vim -> fish
  • gvim -> sh
  • gvim -> bash
  • vim.basic -> sh
  • vim.basic -> bash
  • vim.tiny -> sh
  • vim.tiny -> bash
  • :!curl
  • :!wget
  • :!bash
  • :!sh
  • |!curl
  • |!wget
  • |!bash
  • |!sh
  • class .*'.*|
  • trait .*'.*|
  • /bin/sh -c
  • /bin/bash -c
  • ~/.ssh/authorized_keys
  • ~/.bashrc
  • ~/.zshrc
  • ~/.profile
  • /tmp/
  • /var/tmp/

What your security team should do

  • Prioritize patching Vim to 9.2.0736 or a vendor-backported fixed package on developer workstations, build systems, CI runners, and administrative hosts that may open PHP files.
  • Search endpoint telemetry for Vim or gVim launching shells or command interpreters, especially shortly after opening or editing PHP files.
  • Review recent pull requests, code review attachments, downloaded PHP samples, and issue tracker uploads for suspicious class or trait names containing single quotes, bar command separators, or shell-like payloads.
  • Temporarily advise developers not to invoke PHP omni-completion on untrusted PHP files until Vim is patched.
  • Harden development endpoints by limiting outbound network access, protecting SSH/Git/cloud credentials, and monitoring unexpected child processes from editor applications.
  • Refresh golden images, containers, and developer bootstrap scripts so vulnerable Vim builds are not reintroduced.
  • Because public exploit code is available despite low EPSS and no KEV listing, handle suspicious editor-spawned shell activity as potentially malicious rather than benign developer behavior.

The record

Vim is an open source, command line text editor. Prior to 9.2.0736, the PHP omni-completion script in runtime/autoload/phpcomplete.vim interpolates a class or trait name, taken from the contents of the edited buffer, into a search() pattern that is run via win_execute() without escaping. A name containing a single quote can terminate the search() string argument early, and because the bar is honored as an Ex command separator, the remainder of the name is run as Ex commands; via the :! command this allows arbitrary operating-system command execution when a victim opens a crafted PHP file and invokes omni-completion. This issue is fixed in version 9.2.0736.

Affected packages

Ecosystem Package Introduced Fixed

Related vulnerabilities