GHSA-v2qm-5wxj-qhj7 Open WebUI: Stored XSS to Account Takeover via Model Profile Images
Stored XSS to Account Takeover via Model Profile Images in Open WebUI**Affected:** Open WebUI <= 0.9.5
**Bypass of:** GHSA-3wgj-c2hg-vm6q, GHSA-3856-3vxq-m6fcTL;DROpen WebUI patched SVG XSS in user profile images and webhook profile images  but forgot to apply the same fix to **model** profile images. The `ModelMeta` class has no `validate_profile_image_url` field validator, and the model image serving endpoint has no MIME allowlist or `nosniff` header. Any authenticated user with `workspace.models` permission (enabled by default) can store a `data:image/svg+xml;base64,...` payload in a model's profile image and achieve full account takeover of anyone who navigates to the image URL.Past of the issueIn early 2025, two security advisories landed for Open WebUI:**GHSA-3wgj-c2hg-vm6q**  SVG XSS via user profile images**GHSA-3856-3vxq-m6fc**  SVG XSS via webhook profile imagesThe patches were clean. A `validate_profile_image_url` function was introduced in `backend/open_webui/utils/validate.py`  a compiled regex that restricts `data:` URIs to safe raster formats (`image/png`, `image/jpeg`, `image/gif`, `image/webp`), explicitly excluding `image/svg+xml` because SVG can carry embedded `<script>` tags. On the output side, `users.py` added a MIME allowlist check and `X-Content-Type-Options: nosniff`.The fix was applied to `UserUpdateForm`, `UpdateProfileForm`, and later to `ChannelWebhookForm`. Three models patched. Case closed.Except there was a fourth endpoint.The GapOpen WebUI has a concept of "Models"  user-created model configurations with metadata including a profile image. The metadata lives in `ModelMeta`:No `@field_validator`. No import of `validate_profile_image_url`. `ModelMeta` accepts any string as `profile_image_url`  including `data:image/svg+xml;base64,...`.The serving endpoint at `GET /api/v1/models/model/profile/image` has the same gap:No MIME allowlist. No `nosniff`. No CSP. The SVG is served inline with `Content-Type: image/svg+xml` on the application's origin.Compare this with the **patched** user endpoint:The fix exists. It just was never applied here.Comparison Table| Endpoint | Input Validation | MIME Allowlist | nosniff | Status |
|----------|:---:|:---:|:---:|--------|
| `GET /users/{id}/profile/image` | YES | YES | YES | **Patched** |
| `GET /webhooks/{id}/profile/image` | YES | no | no | Partially patched |
| `GET /models/model/profile/image` | **NO** | **NO** | **NO** | **Vulnerable** |Three Write VectorsThe malicious SVG data URI can be injected through any of three endpoints  all pass `ModelForm` containing `ModelMeta` without validation:**`POST /api/v1/models/create`** (line 195)  any user with `workspace.models` permission**`POST /api/v1/models/update`** (line 581)  model owner or admin**`POST /api/v1/models/import`** (line 279)  admin onlyThe `workspace.models` permission is **enabled by default** for all non-pending users in a standard deployment.The Attack**Step 1  Store the payload:****Step 2  Victim navigates to the image URL:**This happens naturally when a user right-clicks a model's avatar and selects "Open Image in New Tab", or when the attacker sends the URL directly (e.g., in a channel message).**Step 3  Token theft:**The server responds:No `X-Content-Type-Options`. No `Content-Security-Policy`. The browser renders the SVG as a top-level document in the Open WebUI origin. The embedded `<script>` executes. `localStorage.getItem("token")` returns the victim's JWT. The attacker receives it and has full API access  password changes, admin promotion, data exfiltration.PoCExpected server response at Step 3 (the proof — SVG served inline, no defenses):No X-Content-Type-Options, no Content-Security-Policy. The browser renders the SVG as a top-level document, the <script> executes in the Open WebUI origin, and the victim's JWT lands in the attacker's collector log. The attacker replays the JWT against the API for full account takeover (password change, admin promotion).Trigger note: because the frontend loads model avatars in `<img src=...>` context (where SVG scripts do not run), exploitation requires the victim to load the URL as a top-level document — e.g. right-click → "Open image in new tab", or clicking the raw link when the attacker pastes it into a channel/chat. That single click is the only user interaction needed.Root CauseAn incomplete patch. When GHSA-3wgj-c2hg-vm6q was fixed, the validator was added to `UserUpdateForm` and `UpdateProfileForm`. When GHSA-3856-3vxq-m6fc was fixed, it was added to `ChannelWebhookForm`. But `ModelMeta`  which uses the same `profile_image_url` field with the same serving logic  was never touched. The output-side defenses (MIME allowlist + `nosniff`) were also only added to `users.py`, not to `models.py` or `channels.py`.Recommended Fix**Input side**  add the validator to `ModelMeta`:**Output side**  add MIME check and nosniff to the serving endpoint:Both layers are necessary  input validation prevents storage, output validation prevents serving even if a bypass is found later.
CVSS v3.1 score: 7.6