Ex command injection in Vim via Cargo quickfix hooks
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- Code execution
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub. Impact type from CWE-77.
Summary
Vim before v9.2.1201 has an Ex command injection flaw in its Rust cargo quickfix support (CWE-77). The directory name of the nearest Cargo.toml is passed unescaped to the :lchdir command, so a pipe character in a directory name causes the text after it to run as an Ex command. An attacker who supplies a crafted directory tree, such as a cloned repository, can run shell commands as the user when the victim runs :make on a Rust file.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
Description from the GitHub advisory
Ex Command Execution via Cargo Quickfix Hooks in Vim < 9.2.1201 =========================================== Date: 15.10.2026 Severity: Medium CVE: *requested, not yet assigned* CWE: Improper Neutralization of Special Elements used in a Command (CWE-77), Improper Neutralization of Special Elements used in an OS Command (CWE-78) ## Summary The Rust support in `runtime/autoload/cargo/quickfix.vim` changes to the directory of the nearest `Cargo.toml` before running `:make` and restores the previous directory afterwards. The directory names were passed unescaped to the `:lchdir` and `:chdir` Ex commands, so a crafted directory name can inject arbitrary Ex commands, including running shell commands, when the user runs `:make` in a Rust buffer. ## Description When the cargo compiler is active for a Rust buffer, the `QuickFixCmdPre` and `QuickFixCmdPost` autocommands call `cargo#quickfix#CmdPre()` and `cargo#quickfix#CmdPost()`. `CmdPre()` determines the directory of the nearest `Cargo.toml` and changes into it using: execute 'lchdir! ' . l:nearest The directory name is not escaped. Since `:lchdir` treats `|` as a command separator, a directory name such as `x|call system('...')` containing a `Cargo.toml` file causes the text after the `|` to be executed as an Ex command. `CmdPost()` restores the previous directory in the same unescaped way. ## Impact Arbitrary Ex command execution, and therefore arbitrary shell command execution, in the context of the user running Vim, when the user runs `:make` on a Rust file inside a crafted directory tree, e.g. a cloned repository. Exploitation requires: * a system that allows to use "|" in a directory name * a Rust buffer using the cargo compiler, * the victim running `:make` within a crafted directory tree. ## Acknowledgements The Vim project would like to thank github user @Dalvelac for reporting the issue. ## References The issue has been fixed as of Vim patch [v9.2.1201](https://github.com/vim/vim/releases/tag/v9.2.1201). - [Commit](https://github.com/vim/vim/commit/b93c000ddfc27c6a1192bcba77204709536cf094) - [Github Security Advisory](https://github.com/vim/vim/security/advisories/GHSA-4vf6-278g-hq7j)
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | Vim (vim) | < v9.2.1201 | v9.2.1201 | Patch available | GHSA-4vf6-278g-hq7j |
- Vim (vim) Vendor— Affected < v9.2.1201 Fixed in v9.2.1201 Patch available GHSA-4vf6-278g-hq7j
Remediation
Update Vim to v9.2.1201 or later, which fixes the issue.
Written with Claude Haiku 5.5 from the sources below · 2026-11-12
- Fix · GHSA-4vf6-278g-hq7j Vim (vim) Fixed in v9.2.1201 Advisory →
Timeline
- 2026-11-12 Threatist record created from GHSA-4vf6-278g-hq7j
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences