Share
## https://sploitus.com/exploit?id=6E749E5D-7CC9-5007-BBBD-022C5E9EBB81
# Ni8mare: n8n Pre-Auth RCE (CVE-2026-21858 & CVE-2025-68613) — Vulnerability Lab & PoC Report
Môi trường thực hành (Vulnerable Lab) và Báo cáo phân tích khai thác chi tiết chuỗi lỗ hổng **Ni8mare** trên nền tảng **n8n** — từ **Arbitrary File Read** (CVE-2026-21858) đến **Remote Code Execution** (CVE-2025-68613), không cần xác thực.
---
## Báo Cáo Phân Tích & Khai Thác Chi Tiết
Mời xem tài liệu phân tích đầy đủ kèm hình ảnh PoC minh họa từng bước tại báo cáo chính thức:
### [Xem Báo Cáo Khai Thác Chi Tiết (REPORT.md)](./REPORT.md)
*(Báo cáo bao gồm: Phân tích kiến trúc n8n, nguyên lý Content-Type Confusion, Expression Injection sandbox escape, chuỗi khai thác từ file read đến RCE, debug trace source code, root cause analysis và khuyến nghị khắc phục).*
---
## Thông Tin Lỗ Hổng
| Thuộc tính | Chi tiết |
|:---|:---|
| **CVE ID** | CVE-2026-21858 (File Read) + CVE-2025-68613 (RCE) |
| **Tên gọi** | Ni8mare |
| **Loại lỗ hổng** | Content-Type Confusion (Arbitrary File Read) + Expression Injection (Sandbox Escape → RCE) |
| **Mức độ nghiêm trọng** | Critical — CVSS 10.0 + 9.9 |
| **Sản phẩm bị ảnh hưởng** | n8n Đọc config + DB --> Tạo workflow với
filepath: /etc/passwd Tính jwt_secret malicious expression
Ký admin token this.process.mainModule
.require("child_process")
Arbitrary File Read --> Auth Bypass --> Remote Code Execution
(CVSS 10.0) (CVSS 9.9)
```
---
## Hướng Dẫn Khởi Động Lab (Docker)
### Yêu cầu
- Docker & Docker Compose đã cài đặt trên hệ thống.
### 1. Khởi chạy môi trường
```bash
cd ni8mare-lab
docker compose up -d --build
```
### 2. Kiểm tra trạng thái
```bash
docker compose logs -f
```
Khi thấy banner **"Ni8mare Lab -- READY!"** kèm version 1.65.0, lab đã sẵn sàng. Truy cập n8n tại `http://localhost:5678/`.
- **Tài khoản admin**: `admin@exploit.local` / `ExploitLab123!`
- **Workflow**: "Vulnerable Form" (đã active)
### 3. Dọn dẹp môi trường
```bash
docker compose down -v
```
---
## Cấu Trúc Repository
```text
├── REPORT.md # Báo cáo phân tích kỹ thuật & PoC chi tiết
├── ni8mare-lab/ # Môi trường Docker lab
│ ├── docker-compose.yml # Cấu hình Docker n8n 1.65.0
│ ├── Dockerfile # Custom image với setup script
│ └── init/setup.sh # Script tạo admin + workflow vulnerable
├── ni8mare_exploit.py # Exploit script — target Docker Linux (lab)
├── ni8mare_exploit_2.py # Exploit script — target Windows (n8n build từ source, dùng để debug)
└── img/ # Hình ảnh minh chứng PoC
├── setup-*.png # Screenshots thiết lập lab
├── condition-*.png # Screenshots điều kiện khai thác
├── recon-*.png # Screenshots reconnaissance
├── exploit-*.png # Screenshots exploitation
└── debug-*.png # Screenshots debug source code
```
---
## Tham Khảo
- [GHSA-v4pr-fm98-w9pg](https://github.com/n8n-io/n8n/security/advisories/GHSA-v4pr-fm98-w9pg) — Advisory CVE-2026-21858 (File Read)
- [GHSA-v98v-ff95-f3cp](https://github.com/n8n-io/n8n/security/advisories/GHSA-v98v-ff95-f3cp) — Advisory CVE-2025-68613 (RCE)
- [NVD — CVE-2026-21858](https://nvd.nist.gov/vuln/detail/CVE-2026-21858)
- [NVD — CVE-2025-68613](https://nvd.nist.gov/vuln/detail/CVE-2025-68613)