Vim v9.2.0357 之前标签文件名中反引号扩展导致的命令注入漏洞
好的,我现在需要帮用户总结一篇文章的内容,控制在100字以内。首先,我得仔细阅读用户提供的文章内容。 这篇文章是关于Vim的一个安全漏洞的。漏洞类型是命令注入,影响版本是Vim低于v9.2.0357。主要问题是在处理标签文件中的文件名时,Vim会解析反引号中的命令,并在shell中执行,导致任意命令执行。 接下来,我需要提取关键信息:漏洞名称、影响范围、触发条件、攻击方式以及修复情况。用户要求直接写描述,不需要特定开头。 然后,我要把这些信息浓缩到100字以内。确保涵盖漏洞名称、影响版本、触发方式、攻击后果以及修复版本。 最后,检查语言是否简洁明了,没有使用复杂的术语,确保用户能快速理解主要内容。 </think> Vim在处理标签文件中的文件名时存在命令注入漏洞(CVE待定),影响版本低于v9.2.0357。当标签文件中的文件名包含反引号(如`command`),Vim会将其作为shell命令执行。攻击者可通过恶意标签文件触发此漏洞,导致任意命令执行。已修复于v9.2.0357版本。 2026-4-15 20:32:0 Author: seclists.org(查看原文) 阅读量:7 收藏

oss-sec logo

oss-sec mailing list archives


From: Christian Brabandt <cb () 256bit org>
Date: Wed, 15 Apr 2026 22:30:56 +0200

Command injection via backtick expansion in tag filenames in Vim < v9.2.0357
============================================================================
Date: 15.04.2026
Severity: Medium
CVE: *requested, not yet assigned*
CWE: Improper Neutralization of Special Elements used in an OS Command
     ('OS Command Injection') (CWE-78)

## Summary
A command injection vulnerability exists in Vim's tag file processing.
When resolving a tag, the filename field from the tags file is passed
through wildcard expansion to resolve environment variables and wildcards.
If the filename field contains backtick syntax (e.g., `` `command` ``), Vim
executes the embedded command via the system shell with the full privileges of
the running user.

## Description
Vim includes built-in support for tag navigation (`:tag`, `Ctrl-]`).
When a tag is resolved, `jumpto_tag()` calls `expand_tag_fname()` to
resolve the filename field of the matching tags file entry.
`expand_tag_fname()` passes this filename to `ExpandOne()`, which
performs wildcard expansion. Because backtick characters cause
`mch_has_wildcard()` to return TRUE, `ExpandOne()` calls
`expand_backtick()`, which invokes `get_cmd_output()` and executes the
backtick-embedded string as a shell command.

A malicious tags file entry of the form:

    main        `touch /tmp/pwned`      /^int main(int argc, char **argv) {$/;" f

is sufficient to trigger execution when the user navigates to the `main`
tag.

Exploitation requires the following conditions:
- The user opens Vim in a directory containing a malicious `tags` file,
  or has configured additional tag sources via `set tags+=...`.
- The user performs tag navigation (`:tag`, `Ctrl-]`, or `vim -t`) for a
  malicious tag target.

Tag files in the working directory are consulted by default, making
repository-hosted `tags` files (e.g. in a cloned git repository) a
plausible delivery mechanism.

## Impact
Impact is **medium** because exploitation requires the user to perform
tag navigation, but no further confirmation or interaction is needed
once that navigation is triggered. Successful exploitation results in
arbitrary shell command execution with the privileges of the Vim
process.

## Acknowledgements
The Vim project would like to thank Srinivas Piskala Ganesh Babu and
Andy Ngo for identifying the vulnerability, providing a call graph
analysis and proof-of-concept reproduction.

## References
The issue has been fixed as of Vim patch [v9.2.0357](https://github.com/vim/vim/releases/tag/v9.2.0357).
- [Commit](https://github.com/vim/vim/commit/c78194e41d5a0b05b0ddf383b6679b1503f977fb)
- [GitHub Advisory](https://github.com/vim/vim/security/advisories/GHSA-cwgx-gcj7-6qh8)



Best,
Christian
-- 
Es gibt Menschen, die nur lesen, um nicht denken zu müssen.


Current thread:

  • [vim-security] Command injection via backtick expansion in tag filenames in Vim < v9.2.0357 Christian Brabandt (Apr 15)

文章来源: https://seclists.org/oss-sec/2026/q2/140
如有侵权请联系:admin#unsafe.sh