{"id":"CVE-2021-39159","aliases":["CVE-2021-39159","GHSA-9jjr-qqfp-ppwx","PYSEC-2021-371"],"related":[],"kind":"vulnerability","state":"published","title":"Remote code execution in Binderhub","summary":"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.repo_providers` as a workaround.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.repo_providers` as a workaround.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nA 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.\n\n### Patches\n\nPatch below, or [on GitHub](https://github.com/jupyterhub/binderhub/commit/195caac172690456dcdc8cc7a6ca50e05abf8182.patch)\n\n```diff\nFrom 9f4043d9dddc1174920e687773f27b7933f48ab6 Mon Sep 17 00:00:00 2001\nFrom: Riccardo Castellotti <rcastell@cern.ch>\nDate: Thu, 19 Aug 2021 15:49:43 +0200\nSubject: [PATCH] Explicitly separate git-ls-remote options from positional\n arguments\n\n---\n binderhub/repoproviders.py | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/binderhub/repoproviders.py b/binderhub/repoproviders.py\nindex f33347b..5d4b87c 100755\n--- a/binderhub/repoproviders.py\n+++ b/binderhub/repoproviders.py\n@@ -484,7 +484,7 @@ class GitRepoProvider(RepoProvider):\n             self.sha1_validate(self.unresolved_ref)\n         except ValueError:\n             # The ref is a head/tag and we resolve it using `git ls-remote`\n-            command = [\"git\", \"ls-remote\", self.repo, self.unresolved_ref]\n+            command = [\"git\", \"ls-remote\", \"--\", self.repo, self.unresolved_ref]\n             result = subprocess.run(command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n             if result.returncode:\n                 raise RuntimeError(\"Unable to run git ls-remote to get the `resolved_ref`: {}\".format(result.stderr))\n-- \n2.25.1\n\n```\n\n### Workarounds\n\nDisable the git repo provider by specifying the `BinderHub.repo_providers` config, e.g.:\n\n```python\nfrom binderhub.repoproviders import (GitHubRepoProvider,\n                            GitLabRepoProvider, GistRepoProvider,\n                            ZenodoProvider, FigshareProvider, HydroshareProvider,\n                            DataverseProvider)\n\nc.BinderHub.repo_providers =  {\n            'gh': GitHubRepoProvider,\n            'gist': GistRepoProvider,\n            'gl': GitLabRepoProvider,\n            'zenodo': ZenodoProvider,\n            'figshare': FigshareProvider,\n            'hydroshare': HydroshareProvider,\n            'dataverse': DataverseProvider,\n        }\n```\n\n### References\n\nCredit: Jose Carlos Luna Duran (CERN) and Riccardo Castellotti (CERN).\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* Email us at [security@ipython.org](mailto:security@ipython.org)","format":"markdown","source":"ghsa"},{"lang":"es","text":"BinderHub es un servicio en la nube basado en kubernetes que permite a usuarios compartir entornos informáticos interactivos reproducibles a partir de repositorios de código. En las versiones afectadas se ha identificado una vulnerabilidad de ejecución de código remota en BinderHub, en la que al proporcionar a BinderHub una entrada maliciosamente diseñada se podría ejecutar código en el contexto de BinderHub, con el potencial de sacar las credenciales del despliegue de BinderHub, incluidos los tokens de la API de JupyterHub, las cuentas de servicio de kubernetes y las credenciales del registro de Docker. Esto puede proporcionar la habilidad de manipular imágenes y otros pods creados por el usuario en el despliegue, con el potencial de escalar al host dependiendo de la configuración subyacente de kubernetes. Se recomienda a usuarios que actualicen a la versión 0.2.0-n653. Si los usuarios no pueden actualizar pueden deshabilitar el proveedor de repo git al especificar \"BinderHub.repo_providers\" como solución alternativa.","source":"nvd"}],"published":"2021-08-25T18:20:09.000Z","modified":"2026-07-08T06:28:25.928Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":9.6,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":9.6,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":9.6,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H","rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","score":7.5,"rating":"HIGH"}],"cwes":["CWE-78","CWE-94"],"affected":[{"ranges":[{"version":"< 0.2.0-n653","status":"affected"}],"vendor":"jupyterhub","product":"binderhub","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.2.0"}],"ecosystem":"PyPI","package":"binderhub","purl":"pkg:pypi/binderhub","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.2.0-n653"}],"vendor":"jupyter","product":"binderhub","cpe":"cpe:2.3:a:jupyter:binderhub:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"git","introduced":"0","status":"affected","fixed":"195caac172690456dcdc8cc7a6ca50e05abf8182.patch"},{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.2.0-n653"}],"ecosystem":"PyPI","package":"binderhub","purl":"pkg:pypi/binderhub","repo":"https://github.com/jupyterhub/binderhub","source":"pysec"}],"references":[{"url":"https://github.com/jupyterhub/binderhub/security/advisories/GHSA-9jjr-qqfp-ppwx","tags":["advisory","patch","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/jupyterhub/binderhub/commit/195caac172690456dcdc8cc7a6ca50e05abf8182.patch","tags":["fix","mailing-list","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-39159","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/jupyterhub/binderhub/commit/195caac172690456dcdc8cc7a6ca50e05abf8182","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/jupyterhub/binderhub","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/binderhub/PYSEC-2021-371.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-39159","url":"https://www.cve.org/CVERecord?id=CVE-2021-39159","licence":"CVE Terms of Use","modified":"2024-08-04T01:58:18.117Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9jjr-qqfp-ppwx","url":"https://github.com/advisories/GHSA-9jjr-qqfp-ppwx","licence":"CC-BY-4.0","modified":"2026-07-08T06:28:25.928Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-39159","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-39159","licence":"Public domain","modified":"2026-06-17T04:03:13.090Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2021-371","url":"https://osv.dev/vulnerability/PYSEC-2021-371","licence":"CC-BY-4.0","modified":"2026-02-22T22:56:11.676Z"}],"updatedAt":"2026-11-25T22:58:03.500Z","epss":{"score":0.01928,"percentile":0.80576,"date":"2026-12-01T12:00:22.000Z"}}