Code Injection in Vim - CVE-2026-47162

 

Code Injection in Vim - CVE-2026-47162

Published: May 18, 2026


Vulnerability identifier: #VU131625
CSH Severity: Medium
CVSS v4: 7.5 [CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N]
CVE-ID: CVE-2026-47162
CWE-ID: CWE-94
Exploitation vector: Remote access
Exploit availability: No public exploit available

Vulnerability details

The vulnerability allows a remote attacker to execute arbitrary code.

The vulnerability exists due to improper control of code generation in s:NetrwBookHistSave() in the netrw plugin when serializing browsed directory paths to the history file. A remote attacker can create a specially crafted directory name to execute arbitrary code.

User interaction is required to browse the crafted directory with netrw and later open any directory so the history file is sourced. The injected content persists in the history file until the entry is rotated out.


Affected software

Vim
Ubuntu
openEuler
vim (Ubuntu package)
vim-filesystem
vim
vim-X11
vim-common
vim-debuginfo
vim-debugsource
vim-enhanced
vim-minimal

How to mitigate CVE-2026-47162

Install security update from vendor's website.

Vim - update to 9.2.0495
vim (Ubuntu package) - addressed in versions 2:7.4.052-1ubuntu3.1+esm29, 2:7.4.1689-3ubuntu1.5+esm35, 2:8.0.1453-1ubuntu1.13+esm20, 2:8.1.2269-1ubuntu5.32+esm8, 2:8.2.3995-1ubuntu2.32, 2:9.1.0016-1ubuntu7.16, 2:9.1.0967-1ubuntu6.7, 2:9.1.2141-1ubuntu4.5
vim-filesystem - addressed in versions 9.0-50, 9.0.2092-36
vim - addressed in versions 9.0-50, 9.0.2092-36
vim-X11 - addressed in versions 9.0-50, 9.0.2092-36
vim-common - addressed in versions 9.0-50, 9.0.2092-36
vim-debuginfo - addressed in versions 9.0-50, 9.0.2092-36
vim-debugsource - addressed in versions 9.0-50, 9.0.2092-36
vim-enhanced - addressed in versions 9.0-50, 9.0.2092-36
vim-minimal - addressed in versions 9.0-50, 9.0.2092-36

External References

Related Security Bulletins