
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2026-39881 is a command injection vulnerability in Vim's NetBeans interface affecting all versions prior to 9.2.0316. A malicious NetBeans server can execute arbitrary Ex commands when Vim connects to it, via unsanitized strings in the defineAnnoType and specialKeys protocol messages. The vulnerability was disclosed on April 7–8, 2026, and fixed in Vim v9.2.0316. It carries a CVSS v3.1 base score of 7.8 (High) per NVD, though the GitHub Security Advisory rates it as Moderate (5.0) with a more restrictive vector (GitHub Advisory, Red Hat Bugzilla).
The root cause is improper neutralization of special elements in OS commands (CWE-78) and improper control of code generation (CWE-94). Vim's NetBeans interface (src/netbeans.c) passes the typeName, fg, and bg fields from defineAnnoType messages directly into Ex commands via coloncmd() without sanitization, and key tokens from specialKeys messages are passed unsanitized into a map command string. Because Vim interprets | as a command separator in Ex commands, a malicious server can inject arbitrary Ex commands by embedding |cmd| in any of these fields, or use characters like < in specialKeys tokens. The fix introduces an allowlist-based validation function (nb_is_safe_string) that restricts typeName to alphanumeric and underscore characters, and color fields to alphanumeric and # characters, before they are interpolated into commands (GitHub Commit, GitHub Advisory).
A malicious NetBeans server can inject and execute arbitrary Ex commands with the privileges of the user running Vim, potentially enabling arbitrary file reads and writes, or further code execution via Ex commands such as :call system(). The confidentiality, integrity, and availability of the affected system are all at risk, though the GitHub advisory notes confidentiality impact is low and availability impact is none under its scoring. Exploitation is constrained to the local attack vector and requires user interaction, limiting the blast radius compared to remote vulnerabilities (GitHub Advisory, Red Hat Bugzilla).
-nb flag pointing to the attacker's server, e.g., vim -nb:attacker-host:PORT:password targetfile. This requires user interaction and knowledge of the connection password.defineAnnoType message: The server sends a crafted defineAnnoType message with an injected payload in the typeName, fg, or bg field, e.g.: 1:defineAnnoType!1 "MySign guifg=red|call system('malicious_command')|" "tooltip" "glyphFile" 1 2. The | character acts as a command separator, causing Vim to execute the injected Ex command.specialKeys: Send a specialKeys message with a token containing | or < characters to inject into the map command string.:call system() (GitHub Advisory, GitHub Commit).sh, bash, python, curl, wget) as a result of :call system() Ex command execution./tmp by the Vim process; presence of files like Xinject or similar artifacts from injected writefile() calls.-nb flag.E649: Invalid identifier name in defineAnnoType may indicate a blocked injection attempt on patched versions (GitHub Commit).Upgrade Vim to version 9.2.0316 or later, which introduces allowlist-based validation of NetBeans protocol fields before they are interpolated into Ex commands. As a workaround, avoid using Vim's NetBeans interface (-nb flag) entirely, and never connect to untrusted NetBeans servers. Downstream distributions including Ubuntu (USN-8213-1, USN-8246-1), SUSE, Fedora, and Mageia have released updated packages. Organizations should identify systems running Vim versions prior to 9.2.0316 and prioritize patching, especially where the NetBeans interface is in use (GitHub Release, Red Hat Bugzilla).
The vulnerability was credited to GitHub user @Wang1rrr, who reported it to the Vim project. The Vim maintainer Christian Brabandt (chrisbra) published the fix and GitHub Security Advisory promptly on April 7, 2026. Red Hat, SUSE, Ubuntu, Fedora, and Mageia all issued security advisories and updated packages within weeks of disclosure. The vulnerability received moderate coverage from Linux security news outlets and distribution security mailing lists, consistent with its medium severity rating (GitHub Advisory, Red Hat Bugzilla).
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."