CVE-2026-142241 — CWE-306
Mljar Mercury from 3.0.1 before 3.2.12 contains a missing authentication vulnerability in MercuryContentsHandler that allows unauthenticated attackers to read notebooks via the /api/contents route. Attackers can send GET or PUT requests for any .ipynb file under the contents root to retrieve full notebook JSON, including cell source and saved outputs, despite token or password authentication.
Mljar Mercury from 3.0.1 before 3.2.12 contains a missing authentication vulnerability in MercuryContentsHandler that allows unauthenticated attackers to read notebooks via the /api/contents route. Attackers can send GET or PUT requests for any .ipynb file under the contents root to retrieve full notebook JSON, including cell source and saved outputs, despite token or password authentication.
🎯 What is this vulnerability?
Technical flaw
The vulnerability is a classic Missing Authentication (CWE‑306).
In Mljar Mercury versions 3.0.1 – 3.2.11 the MercuryContentsHandler – the HTTP handler that serves the /api/contents REST endpoint – does not perform any authentication check before returning the contents of a notebook file.
The handler accepts both GET and PUT requests for any file under the configured contents root and returns the full notebook JSON (cell source, metadata, and any cached outputs). Because the handler bypasses the token‑ or password‑based authentication that the rest of the API normally enforces, an unauthenticated attacker can read any .ipynb file that the Mercury instance can access.
Why it matters
- The notebook JSON can contain arbitrary Python code, data, and even secrets that were previously stored in the notebook (e.g., API keys, database credentials, personal data).
- No additional privileges are required; the attacker only needs network connectivity to the Mercury instance.
- The flaw is purely an information‑leak; it does not provide RCE or privilege escalation, but the confidentiality impact is high.
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L) – a simple HTTP request suffices
- Privileges Required: None (PR:N)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H)
- Integrity & Availability: None (I:N/A:N)
CVSS
⚡ Attack Chain
Below is a realistic, step‑by‑step chain that an attacker could follow, assuming the target is a publicly reachable or internally exposed Mljar Mercury instance.
| Step | Description | Example / PoC | |
|---|---|---|---|
| 1. Discovery & Reconnaissance | • Identify that the target hosts Mljar Mercury.<br>• Determine the version (e.g., via a GET /api/version endpoint, or by inspecting the Server header or a robots.txt hint).<br>• Verify that the version is < 3.2.12. | ``bash<br># Enumerate API endpoints (simple GET to root)<br>curl -s -I http://target/ | grep -i 'Server'\n# If the response contains 'Mljar Mercury 3.1.4', the target is vulnerable.\n` |
| 2. Exploitation | • Craft a request to /api/contents/<path>.ipynb.<br>• No authentication header is required; the handler will return the notebook JSON.<br>• The attacker can use GET for read or PUT to overwrite (though the CVE focuses on read). | `bash<br># PoC – read a notebook named 'secret.ipynb' located under the root\ncurl -s http://target/api/contents/secret.ipynb\n# The response will be the full JSON representation of the notebook.\n` | |
| 3. Post‑Exploitation | • Parse the JSON to extract code cells, outputs, and metadata.<br>• Look for hard‑coded secrets, API keys, database passwords, or any sensitive data.<br>• If the notebook contains executable code, the attacker can copy it and run it locally or on another system to further compromise the environment. | `python<br>import json, sys\nnotebook = json.load(open('secret.ipynb'))\nfor cell in notebook['cells']:\n if cell['cell_type'] == 'code':\n print('--- CODE CELL ---')\n print(''.join(cell['source']))\n`` |
Note: The/api/contentsroute is the only endpoint explicitly mentioned in the CVE. If an attacker discovers a different route that serves notebooks (e.g.,/api/notebooks/<id>), the same principle applies – the handler must enforce authentication. The examples above are illustrative of the vulnerability class.
🌍 Real World Impact
| Impact | Detail |
|---|---|
| Confidentiality | High – the attacker can read any notebook file, potentially exposing code, data, and secrets. |
| Integrity | None – the flaw does not allow modification of files (though PUT is accepted, the CVE focuses on read). |
| Availability | None – the vulnerability does not affect service uptime. |
Practical consequences
1. Data exfiltration – Sensitive data embedded in notebooks (e.g., customer data, internal metrics) can be harvested.
2. Credential theft – Hard‑coded API keys, database passwords, or OAuth tokens can be extracted.
3. Code reuse – Attackers can copy malicious code cells and re‑inject them into other notebooks or systems.
4. Compliance violations – Exposure of personal data or regulated information can trigger legal penalties.
🛡️ Remediation & Mitigation
1. Patch
| Affected | Fixed |
|---|---|
| Mljar Mercury 3.0.1 – 3.2.11 | Upgrade to 3.2.12 or later. |
Action: Download the latest release from the official repository or package manager and apply the update. Verify the version with GET /api/version after the upgrade.2. Workarounds (if patching is not immediately possible)
| Approach | Implementation |
|---|---|
| Reverse‑proxy authentication | Place a reverse proxy (NGINX, Apache, Traefik) in front of Mercury and enforce HTTP Basic Auth or OAuth for /api/contents. Example NGINX snippet: |
``nginx<br>location /api/contents/ {<br> auth_basic "Restricted";<br> auth_basic_user_file /etc/nginx/.htpasswd;<br> proxy_pass http://localhost:8000; <br>}<br>` | |
| WAF / ModSecurity rule | Block unauthenticated requests to /api/contents/*.ipynb. Example ModSecurity rule: |
`apache<br># Block GET/PUT to /api/contents/*.ipynb without Authorization header<br>SecRule REQUEST_URI "@beginsWith /api/contents/" "phase:1,block,log,id:1001,deny,status:403,msg:'Unauthenticated access to notebook content'\nSecRule REQUEST_URI "@endsWith .ipynb" "phase:1,block,log,id:1002,deny,status:403,msg:'Unauthenticated access to notebook content'\nSecRule REQUEST_HEADERS:Authorization \"\" \"phase:1,block,log,id:1003,deny,status:403,msg:'Missing Authorization header'\n` | |
| File‑system ACLs | Restrict the contents root directory to only the Mercury user (e.g., chmod 700 /var/mercury/notebooks). This prevents the web process from reading notebooks that are not meant to be exposed. |
| Disable the endpoint | If notebooks are not needed via the API, comment out or remove the route registration for /api/contents` in the Mercury configuration. |
3. Detection
| Log Pattern | IoC |
|---|---|
GET /api/contents/.*\.ipynb from an unknown IP | Unauthenticated read attempt |
PUT /api/contents/.*\.ipynb from an unknown IP | Potential overwrite attempt |
Repeated requests to /api/contents/ within a short time window | Automated scanning activity |
Response status 200 with JSON payload containing "cells" field | Successful notebook exfiltration |
Sample WAF log entry
[2026-12-02T14:32:07Z] 192.0.2.123 - - [02/Dec/2026:14:32:07 +0000] "GET /api/contents/secret.ipynb HTTP/1.1" 200 15234 "-" "curl/7.68.0"⚠️ Urgency
[🤖 CVE Professor AI Security Engine]