Summary
Open WebUI's audio transcription upload endpoint allowed HTML files to be stored under a web-accessible cache path and served back with a text/html Content-Type.
A verified user with speech-to-text permissions could upload a polyglot WAV+HTML file and trick other users into opening its URL, causing attacker-controlled JavaScript to execute in the Open WebUI origin.
Affected context
This vulnerability appears in Open WebUI deployments where:
- The audio transcription upload feature is enabled
- The chat.stt permission is left at its default-on setting for verified users
- Uploaded files are stored under CACHE_DIR/audio/transcriptions and then exposed via the /cache/{path} HTTP route
In this context, the application trusts the user-supplied filename extension to determine how the uploaded file will be served, and does not enforce a download-only disposition for cached content.
Exploit preconditions
- Attack surface: Web UI, specifically the audio transcription upload endpoint and /cache/{path} serving route
- Required access: Verified user account with chat.stt permission (enabled by default in vulnerable configurations)
- Trigger point: Victim user follows or is redirected to the cached file URL, which is served as text/html in the Open WebUI origin
- Why exploitation is possible: The server:
- Accepts user-controlled filenames and trusts their extensions
- Saves the file under a web-accessible path
- Serves the file with Content-Type derived from the extension and without Content-Disposition, allowing inline rendering of attacker-controlled HTML/JavaScript
Why this happens
The core issue is a combination of:
- CWE-79 (Improper Neutralization of Input During Web Page Generation): The application delivers attacker-controlled HTML/JavaScript content directly in the Open WebUI origin, allowing execution of arbitrary scripts.
- CWE-434 (Unrestricted Upload of File with Dangerous Type): The upload endpoint accepts files whose effective type (based on extension) can be interpreted as active web content (e.g., .html) without restriction.
- CWE-646 (Reliance on File Name or Extension of Client-Side File for Security): The server relies on the user-supplied extension to determine how content is served and trusted, instead of enforcing server-side type checks and safe serving semantics.
Abstractly, this reflects a pattern where uploaded files are stored under locations served by the main application origin, and their handling (MIME type and disposition) is derived directly from attacker-controlled metadata, enabling stored XSS via file upload.
Potential impact
- Execution of arbitrary JavaScript in the Open WebUI origin for targeted users
- Theft or exposure of session data accessible to JavaScript within the application context (e.g., tokens, local storage)
- Cross-user request forgery within the application (e.g., triggering actions on behalf of the victim)
- Manipulation of UI content, leading to phishing, credential harvesting, or misleading model responses
- Potential pivoting into broader account or configuration misuse, depending on available client-side capabilities
General mitigation guidance
Effective mitigation centers on treating uploaded content as untrusted and isolating or neutralizing it before any browser can interpret it as active content.
Pattern-based mitigations include:
- Restricting upload types: Enforce strict server-side validation of acceptable content types for the audio transcription endpoint (e.g., only audio formats) using a combination of content sniffing and whitelist-based checks, independent of the filename or extension.
- Separating content origins: Serve user-uploaded files from a distinct domain or origin (e.g., a static file host or CDN) so that even if HTML is rendered, it does not share cookies, storage, or scripting context with the main application.
- Forcing safe content disposition: Configure file responses to use Content-Disposition: attachment for user-uploaded or cached files, especially when their exact content type cannot be guaranteed, preventing inline rendering.
- Normalizing filenames and extensions: Override user-provided filenames and extensions with server-generated naming schemes and safe extensions that match the treatment of the content (e.g., using .bin for opaque cache artifacts).
- Reducing privileges of risky features: Gate audio transcription and file upload capabilities behind explicit, least-privilege roles and consider disabling them by default in deployments where they are not required.
How teams detect issues like this
Detecting this class of vulnerability typically involves a combination of static and dynamic approaches:
- Static analysis and code review:
- Flag any routes that serve files from user-writable directories without enforcing safe Content-Disposition or strict MIME-type controls.
- Look for use of FileResponse (or equivalents) where the Content-Type is derived from on-disk extension or user-controlled values.
- Identify upload endpoints that accept arbitrary filenames or extensions and store them under web-accessible paths.
- Security testing:
- Conduct targeted tests where files with HTML or script payloads are uploaded via audio or media endpoints and then accessed via application routes to see if they execute in the browser.
- Use automated scanners configured to test for stored XSS via upload mechanisms and subsequent asset serving routes.
- Policy enforcement:
- Introduce architectural guidelines requiring that all user-uploaded content is served from a sandboxed origin or with attachment-only disposition.
- Integrate checks in CI/CD pipelines that lint for unsafe file-serving patterns and unrestricted upload endpoints.

