Skip to content
RCE Write-up Advanced

1-day RCE vulnerability in vim

The tabpanel option lacked the P_MLE flag, so a modeline could inject a %{expr} expression without modelineexpr being enabled. Because autocmd_add() had no check_secure() call, sandboxed code could register an autocommand that ran after the sandbox exited, giving arbitrary OS command execution when a victim opens a crafted file.

github.com

Published on github.com

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

The author, on github.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The tabpanel option was missing the P_MLE flag, and autocmd_add() lacked a check_secure() call, so sandboxed modeline expressions could register an autocommand that executed after the sandbox exited.

Impact

An attacker who can deliver a crafted file achieves arbitrary command execution with the privileges of the user running Vim, requiring only that the victim opens the file.

What the attacker needed

Victim opens a crafted file; Vim > 9.1.1390 and < 9.2.0272; build with +tabpanel (default)

The fix

The issue was fixed in Vim patch v9.2.0272.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Vim lets files carry settings called modelines, and some settings can run small expressions. Normally those expressions run in a restricted 'sandbox' that blocks dangerous actions. Here one setting was not marked as needing an extra opt-in, and a function used inside the sandbox could still register a later action that ran outside the sandbox, so opening a malicious file could run commands on your computer.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.