CVE-2023-48311
📋 TL;DR
This vulnerability in DockerSpawner allows JupyterHub users to launch any Docker image from public registries instead of being restricted to the configured default image. It affects JupyterHub deployments using DockerSpawner version 0.11.0 and later without explicit allowed_images configuration. This could lead to execution of arbitrary code and container escape.
💻 Affected Systems
- dockerspawner
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Attackers could run malicious containers with root privileges, escape to host system, access sensitive data, or deploy cryptocurrency miners and malware across the infrastructure.
Likely Case
Users exploit the misconfiguration to run unauthorized containers, potentially consuming excessive resources, violating compliance policies, or running vulnerable/outdated images that introduce additional security risks.
If Mitigated
With proper allowed_images configuration, users can only launch approved images, maintaining the intended security boundary and preventing unauthorized container execution.
🎯 Exploit Status
Exploitation requires authenticated JupyterHub access but is trivial once authenticated - users can simply specify any Docker image in their spawn request.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 13.0.0
Vendor Advisory: https://github.com/jupyterhub/dockerspawner/security/advisories/GHSA-hfgr-h3vc-p6c2
Restart Required: Yes
Instructions:
1. Update dockerspawner to version 13.0.0 or later using pip: 'pip install dockerspawner>=13.0.0'. 2. Restart JupyterHub service. 3. Verify configuration still works as expected.
🔧 Temporary Workarounds
Configure allowed_images
allExplicitly set DockerSpawner.allowed_images to restrict which images users can launch
c.DockerSpawner.allowed_images = ['jupyter/base-notebook:latest']
🧯 If You Can't Patch
- Immediately configure DockerSpawner.allowed_images with only approved images
- Implement network controls to restrict Docker registry access and monitor for unauthorized container pulls
🔍 How to Verify
Check if Vulnerable:
Check if running dockerspawner version 0.11.0-12.x AND DockerSpawner.allowed_images is not configured or is an empty list
Check Version:
pip show dockerspawner | grep Version
Verify Fix Applied:
Verify dockerspawner version >=13.0.0 OR DockerSpawner.allowed_images is configured with specific images
📡 Detection & Monitoring
Log Indicators:
- Docker pull requests for images not in allowed list
- Container creation events with unexpected image names
Network Indicators:
- HTTP requests to Docker registries for unauthorized images
- Unexpected outbound connections from newly created containers
SIEM Query:
source="docker" AND (event="pull" OR event="create") AND image NOT IN ["allowed-image-1", "allowed-image-2"]
🔗 References
- https://github.com/jupyterhub/dockerspawner/commit/3ba4b665b6ca6027ea7a032d7ca3eab977574626
- https://github.com/jupyterhub/dockerspawner/security/advisories/GHSA-hfgr-h3vc-p6c2
- https://github.com/jupyterhub/dockerspawner/commit/3ba4b665b6ca6027ea7a032d7ca3eab977574626
- https://github.com/jupyterhub/dockerspawner/security/advisories/GHSA-hfgr-h3vc-p6c2