/

CVE-2026-33057

Severity:

CRITICAL RISK

(9.8)

Code Injection in Mesop AI Testing Debug Server /exec-py

CVE-2026-33057

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Unauthenticated Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Mesop versions 1.2.2 and below expose a debugging Flask endpoint that accepts base64-encoded Python source code and executes it on the host without any authentication or validation.

Anyone able to send HTTP requests to this /exec-py route can achieve unrestricted remote code execution on the underlying machine.

Affected context

This vulnerability occurs in Mesop deployments that run the AI testing/sandbox infrastructure, specifically the lightweight Flask debug server defined in ai/sandbox/wsgi_app.py.

The affected context is the /exec-py HTTP route, which is reachable whenever this sandbox server is started as part of development, testing, or misconfigured production deployments.

The issue is present when:

  • The debug server is exposed on a network interface reachable by untrusted users, and
  • The route remains enabled without any authentication or access control checks.

Exploit preconditions

  • Attack surface: HTTP endpoint (POST /exec-py) exposed by the Mesop AI sandbox Flask application.
  • Required access: Network ability to send HTTP requests to the server (no authentication or session required).
  • Trigger point: A POST request with a code parameter containing base64-encoded Python source code.
  • Why exploitation is possible: The endpoint:
  • Accepts untrusted Python code payloads,
  • Decodes and writes them into a file on disk,
  • Dynamically loads and executes them via execute_module(module_path...)

with no input validation, sandboxing, or authorization checks.

Why this happens

The core issue is an intentionally permissive debugging endpoint that directly interprets user-controlled input as executable Python code.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where untrusted input is fed into code execution mechanisms without restriction.

The design couples remote HTTP input with dynamic module loading (execute_module) and filesystem writes, effectively turning the route into a remote shell.

Missing authentication, environment gating (e.g., dev-only safeguards), and execution sandboxing convert what might be acceptable in a tightly controlled local debug context into a critical RCE vulnerability when exposed on any shared or production network.

Potential impact

  • Full remote execution of arbitrary OS commands on the host running the Mesop debug server
  • Reading, modifying, or deleting application data and local files accessible to the Mesop process
  • Deployment of backdoors, web shells, or persistence mechanisms on the host
  • Lateral movement within the network using the compromised host as a foothold
  • Abuse of host resources for cryptomining, spam campaigns, or other illicit workloads
  • Complete takeover of the affected Mesop environment and potential compromise of connected systems

General mitigation guidance

Mitigation centers on eliminating direct execution of untrusted code and hardening debug infrastructure:

  • Remove or disable HTTP endpoints that execute arbitrary code; avoid exposing such routes in any non-isolated environment.
  • If dynamic code evaluation is absolutely required for internal tooling, enforce strict authentication, authorization, and network isolation, and prefer non-production environments only.
  • Replace arbitrary code execution with constrained, parameterized APIs that expose only specific, vetted operations instead of raw Python execution.
  • Gate debug/test servers behind environment checks so they cannot run unintentionally in production.
  • Run application components with least-privilege OS accounts and minimal filesystem access to reduce blast radius if a similar issue occurs.
  • Segment networks so that debug or test services are not reachable from the public internet or from untrusted internal segments.

How teams detect issues like this

Detection typically combines code-level review and operational monitoring:

  • Static analysis & code review:
  • Flag any use of dynamic code execution mechanisms (e.g., exec, eval, dynamic module loading) wired directly to HTTP request parameters.
  • Identify Flask or web routing definitions that call into sandbox or "exec" style utilities without authentication checks.
  • Enforce internal policies that prohibit unauthenticated debug endpoints in shipped artifacts.
  • Configuration & deployment checks:
  • Scan container images and deployment manifests for inclusion of debug server modules (ai/sandbox/wsgi_app.py) in production configurations.
  • Use CI/CD checks to block deployments when debug-only services or routes are enabled.
  • Runtime monitoring:
  • Monitor web access logs for unusual traffic to endpoints with names like /exec-py, /sandbox, or /debug.
  • Watch for suspicious child processes, file writes to temporary modules, or spikes in CPU usage on hosts running Mesop.
  • Automated security testing tools and web scanners can help surface exposed debug endpoints and verify that sensitive routes require authentication.

Sources

SourceLink
github.comgithub.com/mesop-dev/mesop/commit/825f55970c20686de3f28e2c66df4d74e9d4db47
github.comgithub.com/mesop-dev/mesop/security/advisories/GHSA-gjgx-rvqr-6w6v

Frequently asked

questions

Yes. If the Mesop AI sandbox Flask server is bound to a network interface reachable by an attacker, the /exec-py endpoint enables remote code execution via standard HTTP POST requests.

No. The route, as described, performs no authentication or authorization checks. Anyone who can reach the endpoint over the network can send a payload and trigger code execution.

The safest approach is to remove endpoints that accept and execute arbitrary code entirely. Where such capabilities are unavoidable, restrict them to isolated, non-production environments, require strong authentication, and limit them to a narrow set of pre-defined operations rather than arbitrary Python code.

Treat debug and sandbox interfaces as sensitive and never expose them by default. Establish coding guidelines that disallow wiring untrusted input into code execution primitives, enforce security-focused code review on web endpoints, and use CI/CD checks and static analysis to detect dangerous patterns like remote exec/eval or debug routes before deployment.

Find out what's already
exploitable in your codebase.