Cloudanix VulnDB

CVE-2026-59858

High · 7.8

CVSS

7.8

EPSS

0.1%

Published

Jul 9, 2026

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A malicious code project can make an unpatched Vim editor run commands on a user's computer when they use C 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

This is a local, user-assisted command injection flaw in Vim's C omni-completion logic before version 9.2.0735. The vulnerable script, runtime/autoload/ccomplete.vim, reads fields from a project tags file and interpolates typeref: or typename: values into a :vimgrep pattern executed through :execute without sufficient escaping. Because Vim's :vimgrep command treats the pipe/bar character as an Ex command separator, a malicious tags entry can break out of the intended search pattern and append arbitrary Vim Ex commands. Successful exploitation executes attacker-controlled commands with the privileges of the user running Vim.

Why it matters to the business

If developers or operators open source files from an untrusted repository and invoke C omni-completion, an attacker can run commands as that user, potentially leading to source-code theft, credential exposure, malware installation, or tampering with local development environments. The issue is not known to be in CISA KEV, is not reported as used in ransomware, and has a low EPSS score, so broad automated exploitation is not currently indicated; however, the impact is high for organizations that routinely inspect third-party C/C++ code, accept external contributions, or use Vim in build and development workflows.

How an attack unfolds

An attacker prepares a hostile source tree containing a C file and an associated tags file. The tags file includes a crafted typeref: or typename: extension field containing a Vim pattern terminator and a bar character followed by an arbitrary Ex command. The attacker then persuades a victim to open the project in a vulnerable Vim version and trigger C omni-completion, such as by editing a C file and requesting symbol completion. When the vulnerable ccomplete.vim script processes the malicious tag metadata, it constructs and executes a :vimgrep command from unsanitized input. Vim interprets the injected bar as a separator and runs the appended Ex command as the editing user. Depending on the payload, this can write files, modify the editor session, invoke shell commands, exfiltrate local data, or establish persistence through user-level configuration files.

How to fix it

Upgrade Vim to version 9.2.0735 or later, where the vulnerable C omni-completion handling is fixed. If packaged by an operating system or distribution, install the vendor-provided patched Vim package rather than relying only on the upstream version number. As interim mitigations, avoid opening untrusted source trees in vulnerable Vim versions, do not use C omni-completion on untrusted projects, remove or ignore untrusted tags files, and run code review of untrusted repositories in an isolated container or disposable virtual machine. Security-conscious environments should also restrict automatic trust in repository-supplied editor metadata and avoid executing Vim with elevated privileges.

How to confirm the fix worked

Confirm that all Vim installations report version 9.2.0735 or later, or that the operating-system package changelog contains the backported fix for this issue. Run `vim --version` and check package inventory from endpoint management tools. On systems that retain Vim runtime files, verify that runtime/autoload/ccomplete.vim is from the patched package. To assess exposure, search source workspaces for repository-supplied tags files containing typeref: or typename: fields with suspicious command separators, especially pipe/bar characters. Validate mitigations by opening untrusted test projects only in a sandbox and confirming vulnerable omni-completion behavior is no longer reproducible after patching.

Typical attack path

  1. Attacker creates or modifies a C/C++ project containing a malicious tags file.
  2. The malicious tags entry includes a crafted typeref: or typename: field with an injected Vim command separator and Ex command.
  3. Victim opens a hostile .c file or project in Vim before version 9.2.0735.
  4. Victim invokes C omni-completion while editing the file.
  5. Vim's C completion script builds a :vimgrep command using the unescaped tag field.
  6. The injected Ex command executes under the victim user's privileges.
  7. Attacker's payload performs local actions such as writing files, launching shell commands, stealing credentials, or modifying user configuration.

How to detect it

Investigate whether users opened untrusted C/C++ projects in vulnerable Vim versions and then triggered C omni-completion. Useful log sources include endpoint detection telemetry, shell history, process creation logs, file integrity monitoring, auditd logs on Linux, Sysmon or EDR process events on Windows, and repository/workspace file scans. Look for vim, gvim, vi, or view spawning shells or utilities that are unusual for normal editing, such as sh, bash, zsh, cmd.exe, powershell.exe, curl, wget, python, perl, nc, or chmod. Examine recently opened source trees for tags files containing typeref: or typename: fields with pipe/bar characters, embedded Ex commands, shell escapes, file writes, or references to user startup files. Also review modifications to user-level Vim configuration and shell startup files shortly after Vim activity. Because exploitation requires user interaction and may leave no network indicator by itself, detection should focus on malicious tags content, editor child processes, unexpected file writes, and suspicious changes to user configuration.

  • runtime/autoload/ccomplete.vim
  • typeref:
  • typename:
  • tags
  • |!
  • | !
  • |call
  • | call
  • |execute
  • | execute
  • |source
  • | source
  • |write
  • | write
  • |read !
  • | read !
  • |silent !
  • | silent !
  • vim spawning sh
  • vim spawning bash
  • vim spawning zsh
  • vim spawning cmd.exe
  • vim spawning powershell.exe
  • gvim spawning sh
  • gvim spawning bash
  • gvim spawning cmd.exe
  • gvim spawning powershell.exe
  • vi spawning sh
  • vi spawning bash
  • vi spawning cmd.exe
  • vi spawning powershell.exe
  • .vimrc
  • .gvimrc
  • /etc/vim/vimrc
  • ~/.vim/after/plugin/

What your security team should do

  • Inventory Vim installations across developer workstations, build hosts, jump boxes, and administrative systems.
  • Prioritize upgrades to Vim 9.2.0735 or vendor-patched packages on systems used to inspect third-party or externally submitted C/C++ code.
  • Warn developers not to invoke C omni-completion in untrusted repositories until their editor is patched.
  • Search repositories and developer workspaces for suspicious tags files containing typeref: or typename: fields with Vim command separators.
  • Review endpoint telemetry for unusual child processes spawned from vim, gvim, vi, or view around the time users opened unfamiliar source repositories.
  • Encourage use of isolated containers or disposable virtual machines for reviewing untrusted code archives.
  • Do not run Vim as root or with elevated privileges when opening project files from untrusted sources.

The record

Vim is an open source, command line text editor. Prior to 9.2.0735, the C omni-completion script in runtime/autoload/ccomplete.vim interpolates the typeref: or typename: extension field of a tags entry, without escaping, into a :vimgrep pattern that is run through :execute. Because :vimgrep honors the bar as a command separator, a crafted tag field can close the search pattern and append an arbitrary Ex command; opening a hostile .c file whose project tags file contains such an entry and invoking C omni-completion runs that command as the editing user. This issue is fixed in version 9.2.0735.

Affected packages

Ecosystem Package Introduced Fixed

Related vulnerabilities