CVE-2026-47162Vim: Vimscript Code Injection in netrw NetrwBookHistSave() via crafted directory name
Vim is an open source, command line text editor. Prior to version 9.2.0495, a Vimscript code injection vulnerability exists in s:NetrwBookHistSave() in the netrw plugin (runtime/pack/dist/opt/netrw/autoload/netrw.vim) when serializing browsed directory paths to the history file ~/.vim/.netrwhist. A directory name derived from the filesystem is interpolated into a single-quoted Vimscript string literal without escaping embedded single quotes, allowing a crafted directory name to break out of the string context and execute arbitrary Vimscript, including shell commands via system() and :!, the next time the history file is sourced. This issue has been patched in version 9.2.0495.
What to do
Fixed builds are available from AlmaLinux, Debian, Red Hat, Rocky Linux, Ubuntu: see the table below for the fixed version per release.
Debian, Ubuntu have not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.04 | vim | Fixed | 2:9.1.2141-1ubuntu4.5 | UBUNTU-CVE-2026-47162 |
| Ubuntu 25.10 | vim | Fixed | 2:9.1.0967-1ubuntu6.7 | UBUNTU-CVE-2026-47162 |
| Ubuntu 24.04 | vim | Fixed | 2:9.1.0016-1ubuntu7.16 | UBUNTU-CVE-2026-47162 |
| Ubuntu 22.04 | vim | Fixed | 2:8.2.3995-1ubuntu2.32 | UBUNTU-CVE-2026-47162 |
| Ubuntu 20.04 | vim | Fix pending | 2:8.1.2269-1ubuntu5.32+esm8 (Ubuntu Pro) | UBUNTU-CVE-2026-47162 |
| Ubuntu 18.04 | vim | Fix pending | 2:8.0.1453-1ubuntu1.13+esm20 (Ubuntu Pro) | UBUNTU-CVE-2026-47162 |
| Ubuntu 16.04 | vim | Fix pending | 2:7.4.1689-3ubuntu1.5+esm35 (Ubuntu Pro) | UBUNTU-CVE-2026-47162 |
| Ubuntu 14.04 | vim | Fix pending | 2:7.4.052-1ubuntu3.1+esm29 (Ubuntu Pro) | UBUNTU-CVE-2026-47162 |
| Debian 14 | vim | Fixed | 2:9.2.0524-1 | DEBIAN-CVE-2026-47162 |
| Debian 13 | vim | Fixed | 2:9.1.1230-2+deb13u1 | DEBIAN-CVE-2026-47162 |
| Debian 12 | vim | Fix pending | DEBIAN-CVE-2026-47162 | |
| Red Hat Enterprise Linux 10 | vim | Fixed | 2:9.1.083-9.el10_2.7 | RHSA-2026:38509 |
| Red Hat Enterprise Linux 10 | vim-common | Fixed | 2:9.1.083-9.el10_2.7 | RHSA-2026:38509 |
| Red Hat Enterprise Linux 9 | vim | Fixed | 2:8.2.2637-26.el9_8.10 | RHSA-2026:38511 |
| Red Hat Enterprise Linux 9 | vim-common | Fixed | 2:8.2.2637-26.el9_8.10 | RHSA-2026:38511 |
| Red Hat Enterprise Linux 8 | vim | Fixed | 2:8.0.1763-27.el8_10 | RHSA-2026:38510 |
| Red Hat Enterprise Linux 8 | vim-common | Fixed | 2:8.0.1763-27.el8_10 | RHSA-2026:38510 |
| AlmaLinux 10 | vim-data | Fixed | 2:9.1.083-9.el10_2.7 | ALSA-2026:38509 |
| AlmaLinux 10 | vim-filesystem | Fixed | 2:9.1.083-9.el10_2.7 | ALSA-2026:38509 |
| AlmaLinux 9 | vim-X11 | Fixed | 2:8.2.2637-26.el9_8.10 | ALSA-2026:38511 |
| AlmaLinux 9 | vim-common | Fixed | 2:8.2.2637-26.el9_8.10 | ALSA-2026:38511 |
| AlmaLinux 9 | vim-enhanced | Fixed | 2:8.2.2637-26.el9_8.10 | ALSA-2026:38511 |
| AlmaLinux 9 | vim-filesystem | Fixed | 2:8.2.2637-26.el9_8.10 | ALSA-2026:38511 |
| AlmaLinux 9 | vim-minimal | Fixed | 2:8.2.2637-26.el9_8.10 | ALSA-2026:38511 |
| AlmaLinux 8 | vim-X11 | Fixed | 2:8.0.1763-27.el8_10 | ALSA-2026:38510 |
| AlmaLinux 8 | vim-common | Fixed | 2:8.0.1763-27.el8_10 | ALSA-2026:38510 |
| AlmaLinux 8 | vim-enhanced | Fixed | 2:8.0.1763-27.el8_10 | ALSA-2026:38510 |
| AlmaLinux 8 | vim-filesystem | Fixed | 2:8.0.1763-27.el8_10 | ALSA-2026:38510 |
| AlmaLinux 8 | vim-minimal | Fixed | 2:8.0.1763-27.el8_10 | ALSA-2026:38510 |
| Rocky Linux 10 | vim | Fixed | 2:9.1.083-9.el10_2.7 | RLSA-2026:38509 |
| Rocky Linux 9 | vim | Fixed | 2:8.2.2637-26.el9_8.10 | RLSA-2026:38511 |
| Rocky Linux 8 | vim | Fixed | 2:8.0.1763-27.el8_10 | RLSA-2026:38510 |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- vim: affected: < 9.2.0495
References
- https://github.com/vim/vim/security/advisories/GHSA-crm5-rh6j-2c7c
- https://github.com/vim/vim/commit/f08ab2f4d7d2947c8dd6c179ae08ee6146a2694b
- https://github.com/vim/vim/releases/tag/v9.2.0495
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.