CVE-2021-39159: Remote code execution in Binderhub

Published Aug 25, 2021
·
Updated

Impact

A remote code execution vulnerability has been identified in BinderHub, where providing BinderHub with maliciously crafted input could execute code in the BinderHub context, with the potential to egress credentials of the BinderHub deployment, including JupyterHub API tokens, kubernetes service accounts, and docker registry credentials. This may provide the ability to manipulate images and other user created pods in the deployment, with the potential to escalate to the host depending on the underlying kubernetes configuration.

Patches

Patch below, or on GitHub

diff From 9f4043d9dddc1174920e687773f27b7933f48ab6 Mon Sep 17 00:00:00 2001 From: Riccardo Castellotti <rcastell@cern.ch> Date: Thu, 19 Aug 2021 15:49:43 +0200 Subject: [PATCH] Explicitly separate git-ls-remote options from positional arguments

--- binderhub/repoproviders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/binderhub/repoproviders.py b/binderhub/repoproviders.py index f33347b..5d4b87c 100755 --- a/binderhub/repoproviders.py +++ b/binderhub/repoproviders.py @@ -484,7 +484,7 @@ class GitRepoProvider(RepoProvider): self.sha1validate(self.unresolvedref) except ValueError: # The ref is a head/tag and we resolve it using git ls-remote - command = ["git", "ls-remote", self.repo, self.unresolvedref] + command = ["git", "ls-remote", "--", self.repo, self.unresolvedref] result = subprocess.run(command, universalnewlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if result.returncode: raise RuntimeError("Unable to run git ls-remote to get the resolvedref: {}".format(result.stderr)) -- 2.25.1

Workarounds

Disable the git repo provider by specifying the BinderHub.repoproviders config, e.g.:

python from binderhub.repoproviders import (GitHubRepoProvider, GitLabRepoProvider, GistRepoProvider, ZenodoProvider, FigshareProvider, HydroshareProvider, DataverseProvider)

c.BinderHub.repoproviders = { 'gh': GitHubRepoProvider, 'gist': GistRepoProvider, 'gl': GitLabRepoProvider, 'zenodo': ZenodoProvider, 'figshare': FigshareProvider, 'hydroshare': HydroshareProvider, 'dataverse': DataverseProvider, }

References

Credit: Jose Carlos Luna Duran (CERN) and Riccardo Castellotti (CERN).

For more information

If you have any questions or comments about this advisory:

Email us at security@ipython.org

Other sources

BinderHub is a kubernetes-based cloud service that allows users to share reproducible interactive computing environments from code repositories. In affected versions a remote code execution vulnerability has been identified in BinderHub, where providing BinderHub with maliciously crafted input could execute code in the BinderHub context, with the potential to egress credentials of the BinderHub deployment, including JupyterHub API tokens, kubernetes service accounts, and docker registry credentials. This may provide the ability to manipulate images and other user created pods in the deployment, with the potential to escalate to the host depending on the underlying kubernetes configuration. Users are advised to update to version 0.2.0-n653. If users are unable to update they may disable the git repo provider by specifying the BinderHub.repoproviders as a workaround.

MITRE

Affected Software

2 affected componentsFixes available
pip/binderhub<0.2.0
0.2.0
jupyter Binderhub<0.2.0-n653

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/binderhub to a version that resolves this vulnerability.

    Fixed in 0.2.0
  2. Upgrade

    Upgrade binderhub to a version that resolves this vulnerability.

    Fixed in 0.2.0-n653Patch 195caac172690456dcdc8cc7a6ca50e05abf8182
  3. Configuration

    Disable the git repo provider by specifying `BinderHub.repo_providers` (workaround described).

    BinderHub BinderHub.repo_providers = disable/omit git repo provider(s)

Event History

Aug 25, 2021
CVE Published
via MITRE·06:20 PM
Data Sourced
via MITRE·06:20 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·07:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Aug 30, 2021
Advisory Published
via GitHub·04:16 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2021-39159?

The severity of CVE-2021-39159 is critical with a severity value of 9.8.

2

How does CVE-2021-39159 impact BinderHub?

CVE-2021-39159 allows for remote code execution in BinderHub, potentially exposing credentials and allowing unauthorized access.

3

What software is affected by CVE-2021-39159?

The software affected by CVE-2021-39159 is BinderHub version 0.2.0 and Jupyter Binderhub version up to 0.2.0-n653.

4

How can I fix CVE-2021-39159?

To fix CVE-2021-39159, ensure you are running BinderHub version 0.2.0 or later and Jupyter Binderhub version later than 0.2.0-n653.

5

Where can I find more information about CVE-2021-39159?

You can find more information about CVE-2021-39159 in the provided references: [GitHub Advisory](https://github.com/jupyterhub/binderhub/security/advisories/GHSA-9jjr-qqfp-ppwx) and [NVD](https://nvd.nist.gov/vuln/detail/CVE-2021-39159).

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203