CVE-2020-26222
JSON

8.7high

Remote code execution in dependabot-core

Severity
8.7high CVSS:3.1 by GitHub_M
Exploit likelihood
3.09% (higher than 88% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-23f7-99jx-m54r

Description

Dependabot is a set of packages for automated dependency management for Ruby, JavaScript, Python, PHP, Elixir, Rust, Java, .NET, Elm and Go. In Dependabot-Core from version 0.119.0.beta1 before version 0.125.1, there is a remote code execution vulnerability in dependabot-common and dependabot-go_modules when a source branch name contains malicious injectable bash code. For example, if Dependabot is configured to use the following source branch name: "/$({curl,127.0.0.1})", Dependabot will make a HTTP request to the following URL: 127.0.0.1 when cloning the source repository. The fix was applied to version 0.125.1. As a workaround, one can escape the branch name prior to passing it to the Dependabot::Source class.

Affected

Product or packageVersionsReported by
dependabot dependabot-core< 0.125.1CVE List
dependabot-omnibus (RubyGems)from 0.119.0.beta1 before 0.125.1GitHub Advisory Database
dependabot-common (RubyGems)from 0.119.0.beta1 before 0.125.1GitHub Advisory Database
dependabot_project dependabotfrom 0.119.1 before 0.125.1, 0.119.0NVD

All scores

GitHub_M8.7high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
GitHub8.7high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD6.5medium CVSS:2.0AV:N/AC:L/Au:S/C:P/I:P/A:P

Classification

What each source says

CVE List

Dependabot is a set of packages for automated dependency management for Ruby, JavaScript, Python, PHP, Elixir, Rust, Java, .NET, Elm and Go. In Dependabot-Core from version 0.119.0.beta1 before version 0.125.1, there is a remote code execution vulnerability in dependabot-common and dependabot-go_modules when a source branch name contains malicious injectable bash code. For example, if Dependabot is configured to use the following source branch name: "/$({curl,127.0.0.1})", Dependabot will make a HTTP request to the following URL: 127.0.0.1 when cloning the source repository. The fix was applied to version 0.125.1. As a workaround, one can escape the branch name prior to passing it to the Dependabot::Source class.

GitHub Advisory Database
Impact

Remote code execution vulnerability in dependabot-common and dependabot-go_modules when a source branch name contains malicious injectable bash code.

For example, if Dependabot is configured to use the following source branch name: "/$({curl,127.0.0.1})", Dependabot will make a HTTP request to the following URL: 127.0.0.1 when cloning the source repository.

When Dependabot is configured to clone the source repository during an update, Dependabot runs a shell command to git clone the repository:

git clone --no-tags --no-recurse-submodules --depth=1 --branch=<BRANCH> --single-branch <GITHUB_REPO_URL> repo/contents/path

Dependabot will always clone the source repository for go_modules during the file fetching step and can be configured to clone the repository for other package managers using the FileFetcher class from dependabot-common.

source = Dependabot::Source.new(
  provider: "github",
  repo: "repo/name",
  directory: "/",
  branch: "/$({curl,127.0.0.1})",
)

repo_contents_path = "./file/path"
fetcher = Dependabot::FileFetchers.for_package_manager("bundler").
                  new(source: source, credentials: [],
                  repo_contents_path: repo_contents_path)
fetcher.clone_repo_contents
Patches

The fix was applied to version 0.125.1: https://github.com/dependabot/dependabot-core/pull/2727

Workarounds

Escape the branch name prior to passing it to the Dependabot::Source class.

For example using shellwords:

require "shellwords"
branch = Shellwords.escape("/$({curl,127.0.0.1})")
source = Dependabot::Source.new(
  provider: "github",
  repo: "repo/name",
  directory: "/",
  branch: branch,
)
NVD (es)

Dependabot es un conjunto de paquetes para la administración automatizada de dependencias para Ruby, JavaScript, Python, PHP, Elixir, Rust, Java, .NET, Elm y Go.&#xa0;En Dependabot-Core desde la versión 0.119.0.beta1 versiones anteriores a 0.125.1, se presenta una vulnerabilidad de ejecución de código remota en dependdabot-common y dependdabot-go_modules cuando el nombre de una rama de origen contiene código bash inyectable malicioso.&#xa0;Por ejemplo, si Dependabot está configurado para usar el siguiente nombre de rama de origen: "/$({curl,127.0.0.1})", Dependabot realizará una petición HTTP a la siguiente URL: 127.0.0.1 cuando clona el repositorio de origen.&#xa0;La corrección fue aplicada en versión 0.125.1.&#xa0;Como solución alternativa, se puede escapar el nombre de la rama antes de pasarlo a la clase Dependabot::Source

References

Sources

SourceRecordLicence
CVE ListCVE-2020-26222 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-23f7-99jx-m54r changed 2026-07-08CC-BY-4.0
NVDCVE-2020-26222 changed 2026-06-17Public domain