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.
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:
execute events using new Function()ATTACK VECTOR:
5....
0.1.1240.1.1250.2.00.2.10.2.20.2.30.2.40.2.50.3.00.3.1+116 more0.6.35Exploitability
AV:NAC:LPR:LUI:RScope
S:UImpact
C:HI:HA:NCVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N