Skip to main content
Vulnerability Database/CVE-2024-28233

CVE-2024-28233: Jupyter JupyterHub XSS Vulnerability

CVE-2024-28233 is a cross-site scripting vulnerability in Jupyter JupyterHub that allows attackers to gain full access to the Hub API and user servers. This article covers the technical details, affected configurations, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-28233 Overview

CVE-2024-28233 is a cross-site scripting (XSS) vulnerability [CWE-79] in JupyterHub, an open source multi-user server for Jupyter notebooks. An attacker who lures a user into visiting a malicious subdomain can execute script in the context of the user's JupyterHub session. Successful exploitation grants full access to the JupyterHub API and the victim's single-user server. The flaw affects single-origin JupyterHub deployments and deployments where user-controlled applications run on subdomains or peer subdomains of the Hub or single-user server. JupyterHub 4.1.0 contains the fix.

Critical Impact

Successful exploitation gives an attacker full control of the victim's JupyterHub API session and single-user notebook server, enabling arbitrary code execution within that user's environment.

Affected Products

  • JupyterHub versions prior to 4.1.0
  • Single-origin JupyterHub deployments
  • JupyterHub deployments with user-controlled applications on subdomains or peer subdomains of the Hub or single-user server

Discovery Timeline

  • 2024-03-27 - CVE-2024-28233 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-28233

Vulnerability Analysis

The vulnerability stems from insufficient cross-site request forgery (XSRF) protection on GET requests to JupyterHub API endpoints. An attacker controlling a subdomain or peer subdomain of the Hub or a single-user server can perform cookie tossing, planting cookies that the browser submits to JupyterHub. Combined with weak XSRF checks on GET handlers, this allows the attacker to achieve reflected XSS against the authenticated user. Because JupyterHub cookies authorize full API access, the resulting script execution yields complete session takeover rather than limited data exposure.

Root Cause

Prior to 4.1.0, the API base handler enforced XSRF cookie checks only during the prepare phase for non-safe methods. XSRF validation on GET requests was not consistently applied through a safe-methods allowlist, and authentication cookies lacked the __Host- prefix. Subdomains could therefore set cookies accepted by the Hub, enabling cookie-tossing attacks against single-origin deployments.

Attack Vector

Exploitation requires user interaction: the victim must visit an attacker-controlled page on a sibling or sub-domain of the JupyterHub deployment. Once visited, the attacker's page issues requests to the Hub using tossed cookies, achieving XSS inside the Hub origin. From there, the attacker invokes JupyterHub API endpoints and controls the user's single-user server.

python
# Security patch in jupyterhub/apihandlers/base.py
# Removes the prepare-time XSRF check and introduces a safe-methods allowlist
# so XSRF validation runs on GET requests to API endpoints as well.

#    async def prepare(self):
#        await super().prepare()
#        # tornado only checks xsrf on non-GET
#        # we also check xsrf on GETs to API endpoints
#        if self.request.method not in {"HEAD", "OPTIONS"} and self.settings.get(
#            "xsrf_cookies"
#        ):
#            self.check_xsrf_cookie()

# Replaced with:
_xsrf_safe_methods = {"HEAD", "OPTIONS"}

def check_xsrf_cookie(self):
    if not hasattr(self, '_jupyterhub_user'):
        ...

Source: JupyterHub commit e2798a0

Detection Methods for CVE-2024-28233

Indicators of Compromise

  • Unexpected GET requests to JupyterHub API endpoints originating from referrers on sibling or sub-domains of the Hub.
  • Authenticated API calls bearing session cookies but missing or mismatched XSRF tokens in logs.
  • Single-user server spawn, kernel execution, or token creation events that do not correspond to interactive user activity.

Detection Strategies

  • Inspect JupyterHub access logs for API requests with Referer or Origin headers from untrusted subdomains of the Hub's parent domain.
  • Alert on GET requests to /hub/api/* endpoints that lack a valid _xsrf parameter or cookie match.
  • Correlate browser-driven API calls with user interaction telemetry to identify silent, scripted invocations.

Monitoring Recommendations

  • Enable verbose Tornado access logging on the Hub and ship it to a centralized log store for retention and search.
  • Monitor DNS records for the Hub's parent domain to identify new or unauthorized subdomains that could host attacker content.
  • Track JupyterHub version metadata across deployments to ensure no instance remains below 4.1.0.

How to Mitigate CVE-2024-28233

Immediate Actions Required

  • Upgrade JupyterHub to version 4.1.0 or later on all Hub nodes.
  • Audit which domains and subdomains serve user-controlled content near the Hub, and remove or isolate untrusted applications.
  • Rotate JupyterHub API tokens and force re-authentication of active users after patching.

Patch Information

The fix is delivered in JupyterHub 4.1.0 via commit e2798a0. The patch enforces XSRF cookie validation on API GET requests using a safe-methods allowlist and introduces the cookie_host_prefix_enabled option, which applies the __Host- prefix to authentication cookies to prevent cookie tossing from subdomains. Review the GitHub Security Advisory GHSA-7r3h-4ph8-w38g for full remediation guidance.

Workarounds

  • Serve each user's single-user server from a dedicated per-user subdomain to eliminate cookie-tossing adjacency.
  • Prevent untrusted applications from being deployed on any subdomain of the Hub's parent domain.
  • After upgrading, set JupyterHub.cookie_host_prefix_enabled = True where per-user domains are also configured.
bash
# Configuration example for jupyterhub_config.py
c.JupyterHub.cookie_host_prefix_enabled = True
c.JupyterHub.subdomain_host = 'https://hub.example.com'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.