{"id":1308,"cve":"CVE-2025-2733","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2025-2733\/","cwe":"CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')","cwe_number":77,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/77","cvss_score":5.3,"published":"2025-03-25","owasp":"A03 Injection","odc":"Interface","cdc":"Incorrect Functionality","category":"Input Validation and Sanitization","subcategory":"Command Injection","scope":"Remote","impact":"Arbitrary Code Execution","summary":"OpenManus Prompt Handler in python_execute.py allows OS command injection. Critical.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2025-2733\/","description":"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.","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.","affected_component":"OpenManus","fixed_by_upgrading":false,"vulnerable_code":"import subprocess\nimport os\nfrom flask import Flask, request\n\napp = Flask(__name__)\n\n@app.route('\/execute', methods=['POST'])\n    # VULNERABLE: This code is susceptible to command injection\ndef execute_python():\n    \"\"\"Vulnerable function that demonstrates the security issue.\"\"\"\n    code = request.form.get('code')\n    if not code:\n        return \"No code provided\", 400\n\n    try:\n        # Vulnerable code: Directly passing user input to subprocess.run\n        result = subprocess.run(['python', '-c', code], capture_output=True, text=True, timeout=10)\n        return f\"Output:\\n{result.stdout}\\nError:\\n{result.stderr}\"\n    except subprocess.TimeoutExpired:\n        return \"Execution timed out\", 500\n    except Exception as e:\n        return f\"Error executing code: {str(e)}\", 500\n\nif __name__ == '__main__':\n    app.run(debug=True)","patched_code":"import subprocess\nimport shlex\n\ndef execute_python_code(code):\n  \"\"\"\n  Executes Python code using subprocess.  This example shows a potential fix \n  to prevent OS command injection.  It uses shlex.quote to properly escape\n  user-provided code before passing it to the shell.\n\n  Args:\n    code: The Python code to execute.\n\n  Returns:\n    A tuple containing the standard output and standard error of the execution.\n  \"\"\"\n  try:\n    # Properly escape the code using shlex.quote.  This is crucial!\n    escaped_code = shlex.quote(code)\n\n    # Use subprocess.run with shell=False and a list of arguments.\n    # This avoids shell injection vulnerabilities.\n    result = subprocess.run(['python', '-c', escaped_code], capture_output=True, text=True, timeout=10)\n    stdout = result.stdout\n    stderr = result.stderr\n    return stdout, stderr\n  except subprocess.TimeoutExpired:\n    return \"\", \"Execution timed out.\"\n  except Exception as e:\n    return \"\", f\"Error executing code: {e}\"\n\n# Example usage (demonstrates how injection is prevented)\nif __name__ == '__main__':\n  user_input = \"import os; os.system('rm -rf \/'); print('Hello')\" # Malicious input\n  stdout, stderr = execute_python_code(user_input)\n  print(\"Stdout:\", stdout)\n  print(\"Stderr:\", stderr)","payload_needed":true,"payload":"```python\n;$(whoami);\n```","payload_status":"available","published_fix":[],"references":null}