CVE-2026-34982
Vim vulnerability analysis and mitigation

Overview

CVE-2026-34982 is a modeline sandbox bypass vulnerability in Vim that allows arbitrary OS command execution when a user opens a crafted file. It affects all Vim versions prior to 9.2.0276 and was disclosed on March 31, 2026, with a CVE assigned on April 6, 2026. The vulnerability was reported by researchers "dfwjj x" and "Avishay Matayev" and fixed in commit 75661a6 (patch v9.2.0276). It carries a CVSS v3.1 base score of 8.2 (High) (GitHub Advisory, Openwall OSS-Sec).

Technical details

The root cause is classified as CWE-78 (OS Command Injection) and stems from two related flaws in Vim's modeline sandbox enforcement. First, the complete, guitabtooltip, and printheader options are missing the P_MLE flag in src/optiondefs.h, which means the modeline security check at src/option.c:1565-1571 is bypassed — allowing arbitrary lambda expressions (e.g., F{func} syntax in complete) to be set from a modeline. Second, the mapset() function lacks a check_secure() call, enabling it to be abused from within sandboxed expressions to register arbitrary key mappings that execute OS commands. Exploitation requires only that a victim open a specially crafted file in a vulnerable Vim instance — no special privileges are needed (GitHub Advisory, Vim Commit).

Impact

Successful exploitation allows an attacker to execute arbitrary OS commands with the privileges of the user running Vim, simply by delivering a crafted file. This results in high confidentiality and integrity impact — an attacker could exfiltrate sensitive data, modify files, or establish persistence on the affected system. Availability is not directly impacted by the vulnerability itself, but secondary effects of arbitrary command execution (e.g., file deletion, process termination) are possible (GitHub Advisory, Red Hat CVE).

Exploitation steps

  1. Craft a malicious file: Create a text file containing a Vim modeline that sets one of the vulnerable options. For example, embed a modeline such as vim: set complete=F{->system('malicious_command')} : to abuse the complete option's lambda callback syntax, or use vim: set guitabtooltip=%{%mapset()%}: to abuse mapset() via guitabtooltip.
  2. Deliver the file to the victim: Send the crafted file to the target user via email attachment, shared repository, download link, or any other social engineering vector.
  3. Victim opens the file in Vim: When the victim opens the file using a vulnerable Vim version (< 9.2.0276), Vim processes the embedded modeline.
  4. Sandbox bypass triggers: Because the affected options lack the P_MLE flag, the modeline security check is bypassed. The lambda expression or mapset() call executes within what should be a sandboxed context.
  5. Arbitrary OS command execution: The injected expression (e.g., system('touch_should_not_run')) executes as an OS command with the privileges of the user running Vim, enabling file creation, data exfiltration, reverse shell establishment, or other malicious actions (GitHub Advisory, Vim Commit).

Indicators of compromise

  • File System: Unexpected files created by Vim processes (e.g., files named touch_should_not_run or similar artifacts from test payloads); new scripts or executables in user home or temp directories shortly after opening a file in Vim.
  • Process: Unusual child processes spawned by the Vim process (e.g., sh, bash, curl, wget, python) visible in process trees; system() calls originating from Vim sessions.
  • Logs: Shell history or audit logs showing commands executed under the user's account at the time a Vim session was active; auditd records of execve syscalls with Vim as the parent process.
  • Network: Unexpected outbound network connections from the user's workstation initiated around the time a Vim file was opened, particularly to unknown external IPs (indicative of reverse shell or data exfiltration payloads).

Mitigation and workarounds

Upgrade Vim to version 9.2.0276 or later, which adds the P_MLE flag to the complete, guitabtooltip, and printheader options and adds a check_secure() call to mapset() (Vim Release, Vim Commit). As an interim workaround, disable modeline processing by adding set nomodeline to your Vim configuration (~/.vimrc or /etc/vim/vimrc), which prevents modelines in files from being evaluated entirely. Users should also avoid opening Vim files from untrusted or unknown sources. Downstream distributions including Red Hat, Ubuntu, Amazon Linux, openSUSE, and IBM have released or are releasing updated packages (Red Hat Errata, IBM Advisory).

Community reactions

The vulnerability received coverage from multiple security news outlets including GBHackers, CyberSecurityNews, and The Hacker News (in a weekly recap), reflecting moderate community interest (GBHackers, The Hacker News). The Vim maintainer Christian Brabandt published the fix and coordinated disclosure via the oss-security mailing list and GitHub Security Advisories. Downstream Linux distributions (Red Hat, Ubuntu, Amazon Linux, openSUSE, Mageia, Fedora) responded promptly with updated packages, indicating the security community treated this as a significant but manageable issue.

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