MEDIUM 5.3

CVE-2026-47167: Vim Cucumber Plugin Code Injection via Unsafe Ruby Eval

Vim, a widely-used command-line text editor, contains a code injection flaw in its Cucumber filetype plugin when Ruby support is enabled. The vulnerability arises from unsafe handling of step-definition patterns extracted from Ruby files in a repository's features or stories directories. When a user attempts to jump to a step definition using Vim's step-jump mapping, malicious patterns can execute arbitrary Ruby code and shell commands. This requires local access and user interaction—the attacker must first get the user to open a repository containing a crafted .rb file, then the user must trigger the vulnerable mapping. The issue is resolved in Vim version 9.2.0496.

Source data · NVD / CISA · public domain

CVSS
3.1 · 5.3 MEDIUM · CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L
Weaknesses (CWE)
CWE-94, CWE-95
Affected products
1 configuration(s)
Published / Modified
2026-06-11 / 2026-06-17

NVD description (verbatim)

Vim is an open source, command line text editor. Prior to version 9.2.0496, a code injection vulnerability exists in s:stepmatch() in the cucumber filetype plugin (runtime/ftplugin/cucumber.vim) on Vim builds with +ruby support. Step-definition patterns read from .rb files under the repository's features/*/ or stories/*/ directories are embedded into a Ruby Kernel.eval argument without sufficient escaping, allowing a crafted pattern in an attacker-controlled repository to execute arbitrary Ruby (and through it arbitrary shell commands) when the user invokes a step-jump mapping ([d, ]d). This issue has been patched in version 9.2.0496.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The s:stepmatch() function in runtime/ftplugin/cucumber.vim fails to properly escape step-definition patterns before embedding them into a Ruby Kernel.eval() call. The plugin reads .rb files from features/* and stories/* directories within a repository and constructs dynamic Ruby code that is evaluated without sanitization. An attacker who controls repository content can inject arbitrary Ruby expressions that execute with the privileges of the user running Vim. The vulnerability is classified as CWE-94 (Improper Control of Generation of Code) and CWE-95 (Improper Neutralization of Directives in Dynamically Evaluated Code). This affects Vim builds compiled with the +ruby configuration option prior to version 9.2.0496.

Business impact

For organizations where developers regularly clone and open untrusted or third-party repositories in Vim, this vulnerability creates a supply-chain risk. A malicious contribution to a repository's test fixtures could compromise a developer's machine, potentially leading to theft of source code, credentials, or lateral movement into internal networks. Teams using Vim as their primary editor for Rails or Cucumber-based projects face elevated exposure. However, the attack requires both repository access and active user interaction with a specific Vim mapping, limiting the scope of automated exploitation.

Affected systems

Vim versions prior to 9.2.0496 with +ruby support enabled are affected. This typically includes Vim installations on Linux, macOS, and other Unix-like systems where Ruby development libraries were available at build time. Windows Vim builds with Ruby support are also affected. Users who build Vim without Ruby support or who do not use the Cucumber filetype plugin are not vulnerable. Organizations should verify their Vim build configuration by running :version in Vim and checking for +ruby in the feature list.

Exploitability

Exploitation requires local system access and user interaction. The attacker must ensure a victim opens a repository containing a malicious .rb file in features/ or stories/, then the user must invoke the step-jump mapping ([d or ]d). While these conditions are not trivial, they align with common developer workflows when reviewing external pull requests or exploring unfamiliar codebases. The vulnerability is not remotely exploitable and does not require elevated privileges. No public exploit code has been widely distributed, but the attack surface—Ruby's Kernel.eval() on unsanitized input—is straightforward to weaponize.

Remediation

Update Vim to version 9.2.0496 or later. Users unable to immediately upgrade should disable the Cucumber filetype plugin by removing or renaming runtime/ftplugin/cucumber.vim, or build Vim without Ruby support (--without-ruby during compilation). Teams should review Vim configuration in development environments and consider enforcing a minimum Vim version in developer onboarding documentation. For high-risk teams handling sensitive repositories, consider sandboxing repository inspection in isolated virtual machines or using dedicated, minimally-configured review environments.

Patch guidance

Verify the installed Vim version via :version in the editor or vim --version on the command line. Confirm that the build includes +ruby support. Download or build Vim 9.2.0496 or later from the official Vim repository or pre-built packages provided by your Linux distribution. Test the patch in a non-production environment before rolling out organization-wide to ensure no local customizations are broken. For teams using package managers (apt, brew, yum, etc.), check that distribution repositories have released the patched version; some distributions may lag behind the upstream release.

Detection guidance

Monitor for unexpected Ruby process execution spawned by Vim, particularly when users access repositories with Cucumber test suites. Review audit logs for Kernel.eval calls or unusual shell command execution originating from Vim processes. Implement file integrity monitoring on ftplugin/cucumber.vim to detect unauthorized modifications. For developer endpoints, consider behavioral detection rules that flag Vim launching shell commands or accessing credentials when editing untrusted repositories. Note that legitimate Cucumber workflows may execute Ruby code, so correlation with user intent and repository origin is important.

Why prioritize this

This vulnerability merits prompt but not emergency patching. The CVSS score of 5.3 (Medium) reflects the local-only nature and requirement for user interaction. However, for teams with high repository churn, frequent code review workflows, or developers regularly examining third-party projects, the practical risk is elevated. The flaw exploits a common developer practice—opening external repositories—and touches infrastructure (development machines) that often have access to sensitive assets. Prioritize patching for teams working with open-source contributions or diverse codebases; teams in air-gapped environments or those who rarely review external code can deprioritize slightly.

Risk score, explained

The CVSS 3.1 score of 5.3 reflects: (AV:L) local attack vector—no remote exploitation; (AC:L) low attack complexity—once a malicious repo is opened, triggering the flaw is straightforward; (PR:N) no privileges required; (UI:R) user interaction is required to invoke the step-jump mapping; and (S:U/C:L/I:L/A:L) impact is confined to the local user's confidentiality, integrity, and availability. The score appropriately penalizes the local requirement but acknowledges that a compromised development machine is a serious concern for most organizations.

Frequently asked questions

Do I need to worry about this if I use Vim but never work with Cucumber or Ruby test files?

Only if you have +ruby support compiled in and the Cucumber filetype plugin is active. If you do not open repositories containing Cucumber tests, the attack vector is closed. You can verify your Vim build via :version and look for +ruby. If you see -ruby, you are not vulnerable.

Will updating Vim break my existing plugins or configuration?

Version 9.2.0496 is a patch release and should not break existing configurations or well-maintained plugins. However, test in a non-production environment first if you have heavily customized your Vim setup or rely on third-party plugins that interact with filetype plugins. Keep backups of your .vimrc and plugin directory before updating.

Can this vulnerability be exploited if I only clone repositories from trusted sources?

The risk is significantly reduced but not eliminated if you trust your sources. The concern arises when reviewing external contributions (pull requests, forks) or when a trusted repository is compromised upstream. To minimize risk, inspect .rb files in features/ and stories/ directories before opening them, and use a separate editor or sandbox for reviewing untrusted code.

What is the difference between this and other Vim vulnerabilities I may have patched before?

This flaw is specific to the Cucumber plugin and only manifests when +ruby support is enabled and the user invokes a specific mapping. Many Vim vulnerabilities are more general or affect core functionality. Check your organization's Vim version against the patch release to determine applicability rather than assuming all developers are affected.

This analysis is provided for informational purposes to support vulnerability management and risk prioritization. It is not a substitute for official vendor advisories or your organization's security assessment. Always verify patch applicability against your specific Vim build configuration and consult with your internal security and development teams before deploying patches to production environments. SEC.co does not provide exploit code or detailed attack walkthroughs; the goal is to enable informed remediation decisions. Source: NVD (public-domain), retrieved 2026-07-20. Analysis generated by SEC.co (claude-haiku-4-5).