Vulnerabilities in pkg:gem/ruby-lsp

PACKAGE
Advisory Identifier: GHSA-c4r5-fxqw-vh93
Advisory Summary

CVE-2026-34060 is a HIGH ruby lsp has arbitrary code vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Ruby lsp libraries in the RubyGems ecosystem. The issue involves ruby lsp has arbitrary code execution through branch setting. Remediation is available by upgrading affected packages to version 0.26.9.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/ruby-lsp

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/ruby-lsp. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-c4r5-fxqw-vh93 CVE-2026-34060 HIGH Ruby LSP has arbitrary code execution through branch setting

CVE-2026-34060 at a Glance

CVE Identifier CVE-2026-34060
GHSA Identifier GHSA-c4r5-fxqw-vh93
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Ruby lsp
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2026-34060

To remediate this vulnerability, upgrade all affected Ruby lsp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

ruby-lsp fixed: 0.26.9
Upgrade ruby-lsp to 0.26.9
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for ruby-lsp

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-34060, inspect your project dependencies for Ruby lsp:

inspect dependencies for ruby-lsp

Analyze the terminal output to locate any version of Ruby lsp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.26.9), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Ruby lsp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

**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.

CVE-2026-34060 Affected Ruby lsp Versions

1 component(s)
Fixed Versions:
0.26.9
Product / Package Ecosystem Affected Versions Fixed Version
ruby-lsp
RubyGems
< 0.26.9
0.26.9

References

Frequently Asked Questions

What is CVE-2026-34060?
CVE-2026-34060 is a security vulnerability in Ruby lsp involving Ruby LSP has arbitrary code execution through branch setting under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Ruby lsp versions are affected?
Affected versions include releases prior to 0.26.9 across affected packages: ruby-lsp.
What version fixes CVE-2026-34060?
Upgrading to 0.26.9 (or the latest patched release for your respective branch) resolves the vulnerability.
Is ruby-lsp affected?
Yes, ruby-lsp is affected in releases prior to 0.26.9. Upgrade your dependency to 0.26.9 or later.
What CWE is associated with CVE-2026-34060?
CVE-2026-34060 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check RubyGems dependencies for CVE-2026-34060?
Run the dependency tree command: 'inspect dependencies for ruby-lsp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c4r5-fxqw-vh93",
  "modified" : "2026-03-31T18:41:33Z",
  "published" : "2026-03-27T19:43:14Z",
  "aliases" : [ "CVE-2026-34060" ],
  "summary" : "Ruby LSP has arbitrary code execution through branch setting",
  "details" : "**Summary**\n\nThe `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`.\n\nOther 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.\n\n**Details**\n\nThe `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.\n\n**Impact**\n\nCode 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.\n\n**Remediation**\n\nThe `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.\n\nThe `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.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "ruby-lsp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.26.9"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Shopify/ruby-lsp/security/advisories/GHSA-c4r5-fxqw-vh93"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-34060"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Shopify/ruby-lsp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Shopify/ruby-lsp/releases/tag/v0.26.9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/ruby-lsp/CVE-2026-34060.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-27T19:43:14Z",
    "nvd_published_at" : "2026-03-31T03:15:58Z"
  }
}