CVE-2026-39987·Python vulnerability
marimo is a reactive Python notebook. Prior to 0.23.0, Marimo has a Pre-Auth RCE vulnerability. The terminal WebSocket endpoint /terminal/ws lacks authentication validation, allowing an unauthenticated attacker to obtain a full PTY shell and execute arbitrary system commands. Unlike other WebSocket endpoints (e.g., /ws) that correctly call validate_auth() for authentication, the /terminal/ws endpoint only checks the running mode and platform support before accepting connections, completely skipping authentication verification. This vulnerability is fixed in 0.23.0.
- Severity
- critical
- Software
- Python
- Fixed in
- 0.23.0
- Published
- 2026-04-09
Affected versions
Until: 0.23.0
Fixed in: 0.23.0
How to fix this CVE
Upgrade Marimo to version 0.23.0 or later. If upgrading is not possible, restrict network access to Marimo instances and ensure they are not exposed to the internet. Block WebSocket connections to /terminal/ws via reverse proxy.
docker pull ghcr.io/marimo-team/marimo:latest
# Verify version >= 0.23.0
# Never expose Marimo directly to the internet without auth proxyDefensia detects this vulnerability
What an exploitation attempt looks like
Sample log line indicative of exploitation attempts:
GET /terminal/ws HTTP/1.1
Upgrade: websocket
Connection: Upgrade
The attacker connects to the WebSocket endpoint at /terminal/ws without any authentication token or session cookie. Upon successful WebSocket upgrade, they have an interactive terminal with the same privileges as the Marimo server process, enabling arbitrary command execution.WAF mitigation (if patching is not yet possible)
Add this rule to your WAF to block exploitation attempts while you schedule the patch.
# Block unauthenticated WebSocket to terminal:
SecRule REQUEST_URI "@streq /terminal/ws" "id:20263998,phase:1,deny,status:403,msg:'CVE-2026-39987 Marimo terminal WebSocket blocked',severity:CRITICAL"
# Nginx:
location /terminal/ws { deny all; return 403; }How to check if you are affected
- Check Marimo version: pip show marimo | grep Version — vulnerable if < 0.23.0
- Check for running Marimo instances: ps aux | grep marimo
- Check if Marimo is exposed to the network: ss -tlnp | grep marimo
- Search access logs for WebSocket upgrade to terminal: grep 'terminal/ws' /var/log/nginx/access.log
- Check for outbound connections from Marimo process: lsof -i -P -n | grep marimo
Indicators of compromise
- WebSocket connections to /terminal/ws from external IPs
- Unexpected commands executed by the Marimo server process
- Reverse shell connections originating from Marimo's PID
- New files or modified system files created by the Marimo user
- Cryptocurrency miners or malware downloaded via the terminal
FAQ
What is Marimo?
Marimo is a reactive Python notebook that runs as a web application. It is gaining popularity as a modern alternative to Jupyter notebooks, especially for data science and ML workflows. It includes a built-in terminal feature for command execution.
Is this exploitable from the internet?
Yes, if the Marimo instance is exposed to the internet without authentication proxy. The WebSocket endpoint requires no authentication at all. Any attacker who can reach the Marimo port gets a full shell.
What privileges does the attacker get?
The attacker gets a terminal session running as the same user as the Marimo process. If Marimo runs as root (not recommended but sometimes seen), the attacker gets root access. Otherwise, they get the service user's privileges.
Does this affect Jupyter notebooks too?
No. This vulnerability is specific to Marimo's terminal WebSocket implementation. Jupyter has its own authentication mechanisms (tokens) that protect terminal access.
How do I check if I was compromised?
Check process trees for the Marimo process (unexpected child processes), review shell history for the Marimo user, scan for newly created files, and check for unauthorized outbound connections.
Related Python CVEs
References
- https://github.com/marimo-team/marimo/commit/c24d4806398f30be6b12acd6c60d1d7c68cfd12a
- https://github.com/marimo-team/marimo/pull/9098
- https://github.com/marimo-team/marimo/security/advisories/GHSA-2679-6mx9-h9xc
- https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2026-39987
- https://www.sysdig.com/blog/marimo-oss-python-notebook-rce-from-disclosure-to-exploitation-in-under-10-hours
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-39987. Free for 1 server.
Get started free