/

CVE-2026-56398

Severity:

HIGH RISK

(7.3)

Stored XSS (CWE-20) via SVG profile images in Open WebUI

CVE-2026-56398

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (Stored)

CWE:

CWE-20

Impact:

Account Takeover via Stored Cross-Site Scripting

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Open WebUI before 0.9.5 contains a stored cross-site scripting flaw in its OAuth profile image handling, where the MIME type of the picture claim URL is inferred from the file extension instead of the HTTP Content-Type header.

Malicious SVG files can bypass validation, be persisted as data URIs, and later be rendered for other authenticated users, enabling attacker-controlled script execution in the same origin that can steal tokens and lead to account takeover.

Affected context

This vulnerability arises in Open WebUI deployments that:

  • Integrate OAuth providers and consume the picture claim from user profile responses
  • Infer image MIME types from URL file extensions rather than the Content-Type header
  • Persist profile images as data URIs and serve them back to authenticated users
  • Render SVG content without strict sanitization, content security policies, or restrictive response headers

In such contexts, a crafted SVG profile image from an attacker-controlled OAuth account can be stored and later displayed to other users within the same origin.

Exploit preconditions

  • Attack surface: Web UI profile image rendering within the authenticated application origin.
  • Required access: Ability to authenticate via OAuth and control the picture claim URL (e.g., by hosting a custom image endpoint).
  • Trigger point: A victim user or administrator visits any page or endpoint that loads the attacker's stored profile image as a data URI.
  • Why exploitation is possible: The application trusts the URL file extension to infer image type, allowing SVG content to bypass validation. The SVG is stored and served without robust sanitization or protective security headers, permitting inline script execution in the browser.

Why this happens

The underlying issue is improper input validation and trust decisions around external profile image data, aligning with CWE-20 (Improper Input Validation).

Instead of using authoritative metadata such as the Content-Type header and enforcing a strict set of allowed image formats, the implementation infers MIME type from the URL's file extension and accepts SVG content without sanitization.

This insecure pattern allows attacker-controlled script-capable content to be persisted and rendered in a trusted origin, turning a seemingly benign profile image feature into a stored XSS vector.

Potential impact

  • Attackers can execute arbitrary JavaScript in the context of the Open WebUI origin.
  • Malicious scripts can access authentication tokens or session data, enabling account takeover.
  • User profiles, application settings, and conversation history may be viewed or modified by attackers.
  • Elevated or administrative accounts can be compromised if they view attacker-controlled profile images.
  • Further lateral movement is possible through impersonation or API abuse using stolen credentials.

General mitigation guidance

Effective mitigation focuses on tightening validation of profile image inputs and reducing the trust placed in external content.

Common defensive patterns include:

  • Validating image responses using the Content-Type header and accepting only a small, fixed list of safe raster formats (e.g., JPEG, PNG, WEBP).
  • Rejecting, stripping, or strictly sanitizing SVG content before storage, especially when used in user profile images.
  • Avoiding the storage and rendering of untrusted content as data URIs; prefer serving images as static resources through a controlled media pipeline.
  • Applying least-privilege principles to client-side exposure, coupled with robust Content Security Policy (CSP) to restrict script execution and inline content.
  • Implementing secure defaults for any profile-related features so that ambiguous or unsupported content types are blocked rather than allowed.

How teams detect issues like this

To detect similar issues, organizations can:

  • Use static analysis rules and secure coding checks that flag reliance on file extensions for MIME type determination and any unsanitized handling of SVG or data URIs.
  • Incorporate code review practices focusing on user profile features, OAuth claim consumption, and image processing paths, looking for improper validation and missing sanitization.
  • Employ dynamic application security testing (DAST) to probe profile image endpoints with crafted SVG payloads and observe script execution behavior.
  • Enforce internal policies and automated CI checks requiring Content-Type-based validation and disallowing script-capable formats in user-uploaded or external profile images.

Sources

SourceLink
github.comgithub.com/open-webui/open-webui/security/advisories/GHSA-3wgj-c2hg-vm6q
vulncheck.comvulncheck.com/advisories/open-webui-stored-cross-site-scripting-via-oauth-picture-claim-svg-data-uri

Frequently asked

questions

Yes. Any attacker who can authenticate via OAuth and control their profile image URL can exploit it. Other authenticated users who load the attacker's profile image, including administrators, are at risk of script execution in their browsers.

The attacker needs the ability to create or use an OAuth identity accepted by the application and to set the picture claim to a URL they control. No special privileges are required beyond normal authenticated access to get their profile rendered.

The most robust fix is to strictly validate and constrain profile images: trust only the Content-Type header, allow only safe raster formats, reject or sanitize SVG, and avoid rendering untrusted content as data URIs. Combined with safer response headers and CSP, this closes the stored XSS vector.

Design profile and media features around a "deny by default" model, where only explicitly approved formats and sources are accepted. Use centralized validation utilities, apply strong input sanitization, enforce CSP and secure headers, and include checks for script-capable formats (SVG, data URIs) in your secure coding guidelines and automated testing pipelines.

Find out what's already
exploitable in your codebase.