GHSA-v7m9-9497-p9gr

Suggest an improvement
Source
https://github.com/advisories/GHSA-v7m9-9497-p9gr
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/07/GHSA-v7m9-9497-p9gr/GHSA-v7m9-9497-p9gr.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-v7m9-9497-p9gr
Aliases
Published
2020-07-22T23:07:16Z
Modified
2026-07-08T06:28:50Z
Severity
  • 6.8 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N CVSS Calculator
  • 7.6 (High) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N CVSS Calculator
Summary
Possible pod name collisions in jupyterhub-kubespawner
Details

Impact

What kind of vulnerability is it? Who is impacted?

JupyterHub deployments using:

  • KubeSpawner <= 0.11.1 (e.g. zero-to-jupyterhub 0.9.0) and
  • enabled named_servers (not default), and
  • an Authenticator that allows:
    • usernames with hyphens or other characters that require escape (e.g. user-hyphen or user@email), and
    • usernames which may match other usernames up to but not including the escaped character (e.g. user in the above cases)

In this circumstance, certain usernames will be able to craft particular server names which will grant them access to the default server of other users who have matching usernames.

Patches

Has the problem been patched? What versions should users upgrade to?

Patch will be released in kubespawner 0.12 and zero-to-jupyterhub 0.9.1

Workarounds

Is there a way for users to fix or remediate the vulnerability without upgrading?

KubeSpawner

Specify configuration:

for KubeSpawner

from traitlets import default
from kubespawner import KubeSpawner

class PatchedKubeSpawner(KubeSpawner):
    @default("pod_name_template")
    def _default_pod_name_template(self):
        if self.name:
            return "jupyter-{username}-{servername}"
        else:
            return "jupyter-{username}"

    @default("pvc_name_template")
    def _default_pvc_name_template(self):
        if self.name:
            return "claim-{username}-{servername}"
        else:
            return "claim-{username}"

c.JupyterHub.spawner_class = PatchedKubeSpawner

Note for KubeSpawner: this configuration will behave differently before and after the upgrade, so will need to be removed when upgrading. Only apply this configuration while still using KubeSpawner ≤ 0.11.1 and remove it after upgrade to ensure consistent pod and pvc naming.

Changing the name template means pvcs for named servers will have different names. This will result in orphaned PVCs for named servers across Hub upgrade! This may appear as data loss for users, depending on configuration, but the orphaned PVCs will still be around and data can be migrated manually (or new PVCs created manually to reference existing PVs) before deleting the old PVCs and/or PVs.

References

Are there any links users can visit to find out more?

For more information

If you have any questions or comments about this advisory:

Credit: Jining Huang

Database specific
{
    "cwe_ids": [
        "CWE-863"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2020-07-17T20:49:37Z",
    "nvd_published_at": "2020-07-17T21:15:00Z",
    "severity": "HIGH"
}
References

Affected packages

PyPI / jupyterhub-kubespawner

Package

Name
jupyterhub-kubespawner
View open source insights on deps.dev
Purl
pkg:pypi/jupyterhub-kubespawner

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
0.12.0

Affected versions

0.*
0.1
0.5
0.5.1
0.6.0
0.7.1
0.8
0.8.1
0.9.0b1
0.9.0b2
0.9.0
0.10.0
0.10.1
0.11.0
0.11.1

Database specific

last_known_affected_version_range
"<= 0.11.1"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2020/07/GHSA-v7m9-9497-p9gr/GHSA-v7m9-9497-p9gr.json"