Summary
Open WebUI exposes an API endpoint that allows arbitrary Python code execution via Jupyter for any verified user, even when administrators have disabled code execution through configuration.
Because the feature gate is not enforced at the /api/v1/utils/code/execute endpoint, environments that assume code execution is disabled may still permit remote code execution within the application context.
Affected context
This issue affects Open WebUI deployments where:
- The application is configured with ENABLE_CODE_EXECUTION=false
- Users can authenticate as "verified" users and access API endpoints
- The /api/v1/utils/code/execute endpoint remains reachable within the deployment
The vulnerability is present when administrators rely on the configuration flag to disable code execution and do not apply additional network or role-based restrictions around this API.
Exploit preconditions
- Attack surface: Application HTTP API at /api/v1/utils/code/execute
- Required access: Authenticated "verified" user account with ability to call the endpoint
- Trigger point: Submitting Python code to the code execution API while ENABLE_CODE_EXECUTION is set to false
- Why exploitation is possible: The feature gate configuration is not enforced on the backend endpoint, so authorization decisions do not reflect the intended policy and code is executed regardless of the disabled setting
Why this happens
The underlying issue is an authorization logic error where the system's intended policy (disabling code execution via ENABLE_CODE_EXECUTION=false) is not consistently enforced at the API layer.
This aligns with CWE-863: Incorrect Authorization, where security-relevant functionality assumes a control is in place but does not actually verify the corresponding condition when executing sensitive operations.
In this case, the backend endpoint responsible for dispatching Python code to Jupyter omits a runtime check of the configuration flag, allowing any verified user to invoke the capability even when administrators have explicitly disabled it.
Potential impact
- Authenticated users could execute arbitrary Python code on the host or container running Open WebUI
- Attackers may access or manipulate local data processed by the platform
- Execution of reconnaissance or lateral movement scripts from the affected environment
- Potential compromise of other services reachable from the Open WebUI deployment, depending on network and OS-level permissions
General mitigation guidance
Mitigation generally focuses on enforcing security controls consistently at every access point to sensitive features and reducing the blast radius of code execution.
Recommended patterns include:
- Applying configuration checks directly in the handlers for high-risk endpoints so that feature gates are enforced server-side, not only in the UI
- Introducing role-based authorization for code execution endpoints and treating them as privileged actions
- Isolating any code execution environment using containers, restricted kernels, or sandboxing so that even misconfigurations have limited impact
- Ensuring defense-in-depth via network policies, process-level restrictions, and least-privilege runtime permissions for components that execute user-provided code
These approaches help ensure that disabling a feature in configuration actually results in its unavailability at all programmatic entry points.
How teams detect issues like this
Detection for this type of issue typically combines configuration validation and behavioral monitoring:
- Static or configuration analysis that verifies security-related flags (like ENABLE_CODE_EXECUTION) are consulted wherever corresponding functionality is invoked
- Code review practices that treat any "execute" or "eval"-style endpoints as sensitive and require explicit checks for feature flags and authorization
- API gateway or middleware policies that centralize enforcement of feature gates and role checks, making it easier to detect missing validations
- Runtime monitoring or logging to identify unexpected usage of code execution endpoints when configuration indicates they should be disabled
Automated review tools can be configured to flag endpoints that perform execution-related actions without accompanying authorization and configuration checks.

