CVE-2025-2733
OpenManus Prompt Handler in python_execute.py allows OS command injection. Critical.
- CVSS 5.3
- CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')
- "Input Validation and Sanitization"
- Remote
A vulnerability classified as critical has been found in mannaandpoem OpenManus up to 2025.3.13. This affects an unknown part of the file app/tool/python_execute.py of the component Prompt Handler. The manipulation leads to os command injection. It is possible to initiate the attack remotely. The exploit has been disclosed to the public and may be used. The vendor was contacted early about this disclosure but did not respond in any way.
- CVSS base score
- 5.3
- Published
- 2025-03-25
- OWASP
- A03 Injection
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Functionality
- Category
- "Input Validation and Sanitization"
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- OpenManus
Solution
Upgrade OpenManus to a version greater than 2025.3.13 or apply a patch that sanitizes user input in `app/tool/python_execute.py` to prevent OS command injection.
Vulnerable code sample
import subprocess
import os
from flask import Flask, request
app = Flask(__name__)
@app.route('/execute', methods=['POST'])
# VULNERABLE: This code is susceptible to command injection
def execute_python():
"""Vulnerable function that demonstrates the security issue."""
code = request.form.get('code')
if not code:
return "No code provided", 400
try:
# Vulnerable code: Directly passing user input to subprocess.run
result = subprocess.run(['python', '-c', code], capture_output=True, text=True, timeout=10)
return f"Output:\n{result.stdout}\nError:\n{result.stderr}"
except subprocess.TimeoutExpired:
return "Execution timed out", 500
except Exception as e:
return f"Error executing code: {str(e)}", 500
if __name__ == '__main__':
app.run(debug=True)Patched code sample
import subprocess
import shlex
def execute_python_code(code):
"""
Executes Python code using subprocess. This example shows a potential fix
to prevent OS command injection. It uses shlex.quote to properly escape
user-provided code before passing it to the shell.
Args:
code: The Python code to execute.
Returns:
A tuple containing the standard output and standard error of the execution.
"""
try:
# Properly escape the code using shlex.quote. This is crucial!
escaped_code = shlex.quote(code)
# Use subprocess.run with shell=False and a list of arguments.
# This avoids shell injection vulnerabilities.
result = subprocess.run(['python', '-c', escaped_code], capture_output=True, text=True, timeout=10)
stdout = result.stdout
stderr = result.stderr
return stdout, stderr
except subprocess.TimeoutExpired:
return "", "Execution timed out."
except Exception as e:
return "", f"Error executing code: {e}"
# Example usage (demonstrates how injection is prevented)
if __name__ == '__main__':
user_input = "import os; os.system('rm -rf /'); print('Hello')" # Malicious input
stdout, stderr = execute_python_code(user_input)
print("Stdout:", stdout)
print("Stderr:", stderr)Payload
;$(whoami);
Cite this entry
@misc{vaitp:cve20252733,
title = {{OpenManus Prompt Handler in python_execute.py allows OS command injection. Critical.
}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2025},
note = {VAITP Python Vulnerability Dataset, entry CVE-2025-2733},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-2733/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
