PyPI: mercury
CVE-2026-111058
Safety vulnerability ID: SFTY-20261019-84238
Affected versions of the `mercury` package are vulnerable to Missing Authorization due to the Mercury server exposing the Jupyter kernel API to anonymous users without restricting the code they can run. `mercury_app/__main__.py` starts the JupyterLab server with `--IdentityProvider.token=''` and XSRF checks disabled when no `--token` or `MERCURY_TOKEN` is given, and while `mercury_app/block_handler.py` blocks `/lab`, `/api/terminals`, `/api/shutdown` and `/files`, the `/api/kernels` endpoint stays open because Mercury needs kernels to run notebooks, and `patch_kernel_websocket_handler()` forwards every message on the kernel websocket, `execute_request` included, without any check. An unauthenticated attacker who can reach a Mercury server running with the default tokenless configuration can create a kernel with `POST /api/kernels`, open its `/api/kernels/<id>/channels` websocket and send an `execute_request` that runs arbitrary Python code as the Mercury server process, leading to full compromise of the host or container.
Overview
Mercury: Unauthenticated Remote Code Execution via /api/kernels
Advisory
mercury – Missing Authorization
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20261019-84238/CVE-2026-111058
- https://github.com/mljar/mercury/security/advisories/GHSA-rv4m-xm3f-3ccq
- https://github.com/mljar/mercury/commit/73a40ceb0becf057f495a5738ad7f5a5222a53e1
- https://github.com/mljar/mercury/releases/tag/3.2.6
- https://github.com/advisories/GHSA-rv4m-xm3f-3ccq
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
