Skip to content

Vim tabpanel modeline escape affects Vim > 9.1.1390 && Vim < 9.2.0272

High
chrisbra published GHSA-2gmj-rpqf-pxvh Mar 30, 2026

Package

Vim

Affected versions

> v9.1.1390 && < v9.2.0172

Patched versions

v9.2.0172

Description

Vim tabpanel modeline escape affects Vim > 9.1.1390 && Vim < 9.2.0272

Date: 30.03.2026
Severity: High
CVE: CVE-2026-34714
CWE: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (CWE-78)

Summary

A bug chain in Vim allows arbitrary OS command execution when a user opens
a crafted file. The tabpanel option is missing the P_MLE flag, allowing a
modeline to inject a %{expr} expression string without requiring
modelineexpr to be enabled. Although Vim correctly evaluates the expression
inside the sandbox, autocmd_add() lacks a check_secure() call, allowing
sandboxed code to register an autocommand that fires after the sandbox exits.

This vulnerability has been introduced with Vim v9.1.1391. Earlier versions are not affected.

Description

The tabpanel option (src/optiondefs.h:2581) accepts %{expr} format
strings identically to statusline and tabline, both of which carry the
P_MLE flag to require modelineexpr for modeline use. tabpanel is missing
this flag, so the modeline security check at src/option.c:1572-1576 is never
reached and arbitrary expression strings are accepted from modelines.

Vim correctly detects that the option was set insecurely and evaluates the
expression inside the sandbox (src/eval.c:747-758). However,
autocmd_add() (src/autocmd.c:3316) contains no check_secure() call.
While the :autocmd ex command is properly blocked in the sandbox (no EX_SBOXOK),
but the function interface bypasses this restriction.

Impact

An attacker who can deliver a crafted file to a victim achieves arbitrary
command execution with the privileges of the user running Vim. The attack
requires only that the victim opens the file; no further interaction is needed.
modeline is enabled by default and modelineexpr does not need to be
enabled. Vim builds with +tabpanel (FEAT_HUGE, the default) are affected.

Acknowledgements

The Vim project would like to thank Hung Nguyen for identifying the vulnerability
chain, providing a detailed root cause analysis, reproduction steps, and
suggested fixes.

References

The issue has been fixed as of Vim patch v9.2.0272

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N

CVE ID

CVE-2026-34714

Weaknesses

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. Learn more on MITRE.