/

CVE-2026-56670

Severity:

HIGH RISK

(8.2)

Stored XSS (CWE-79) via SVG handling in ComfyUI

CVE-2026-56670

Awaiting Analysis

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting in Web UI

Severity:

HIGH RISK

(8.2)

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

ComfyUI contained a stored cross-site scripting (XSS) flaw where uploaded SVG files were rendered inline at the /view endpoint without treating them as potentially dangerous content types.

If an attacker can upload or influence SVG content, they could persist malicious scripts that execute in users' browsers whenever the affected files are viewed within the ComfyUI origin.

Affected context

This vulnerability arises in ComfyUI deployments that allow users or automated processes to upload image assets that are later viewed through the /view endpoint.

The issue specifically involves SVG and related XML-based image content types that are displayed inline in the browser, rather than being treated as potentially active content.

It becomes relevant in environments where multiple users share the same ComfyUI origin or where uploaded assets are reused, linked, or previewed within the web interface.

Exploit preconditions

  • Attack surface: Web-based /view endpoint serving uploaded files
  • Required access: Ability to upload or otherwise cause storage of SVG/XML image content accessible via /view
  • Trigger point: A victim user visits a page or resource in ComfyUI that renders the crafted SVG inline under the ComfyUI origin
  • Why exploitation is possible: SVG files are capable of embedding script-like behavior, and the lack of dangerous-content-type handling for image/svg+xml allows these files to be served in a way that the browser executes embedded scripts in the page context

Why this happens

The underlying issue is a failure to treat script-capable image types, such as image/svg+xml, as potentially dangerous content that must be sanitized or isolated.

ComfyUI's dangerous-content-type handling did not include SVG and related XML content types, so uploaded SVGs were served inline through the /view endpoint.

This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because attacker-controlled SVG data is embedded into pages without proper neutralization or containment, allowing arbitrary script execution in the browser.

Potential impact

  • Malicious scripts can execute in the context of the ComfyUI web origin
  • Attackers may steal session data or user-specific tokens accessible via the browser
  • User interface manipulations could deceive users into performing unintended actions
  • Stored payloads can affect multiple users who later view or interact with the compromised SVG assets

General mitigation guidance

Effective mitigation focuses on reducing trust in user-supplied content and constraining how active content types are handled.

Common defensive patterns include:

  • Treating image/svg+xml and related XML-based content types as potentially dangerous and serving them with headers that prevent inline execution (for example, downloading instead of rendering)
  • Applying server-side sanitization or transformation to uploaded SVGs to strip active or script-like elements
  • Restricting which file types can be uploaded, favoring inert raster formats where appropriate
  • Enforcing a clear separation between untrusted content and the main application origin, such as serving untrusted assets from a distinct, locked-down domain or path
  • Applying least-privilege principles to browser-accessible data, avoiding exposure of sensitive information through client-side scripts

How teams detect issues like this

High-level detection approaches for this class of issue include:

  • Static and dynamic review of routes that serve user-uploaded files, focusing on content-type handling and response headers
  • Code review checks for inline rendering of SVG or XML-based image formats without sanitization or containment
  • Security testing that attempts to upload crafted SVG payloads and observes whether scripts execute when viewed in the UI
  • Automated tooling or CI policies that flag additions to file-serving endpoints which do not treat script-capable types as dangerous

Sources

SourceLink
github.comgithub.com/Comfy-Org/ComfyUI/commit/96e0e3585b41e1417442eaa14ec57f7b4ffcb5e0
github.comgithub.com/Comfy-Org/ComfyUI/releases/tag/v0.28.0
github.comgithub.com/Comfy-Org/ComfyUI/security/advisories/GHSA-rj8c-c4p8-3c5h

Frequently asked

questions

The primary risk described involves SVG (image/svg+xml) and closely related XML-based image content types that can embed active elements. Other inert image formats like PNG or JPEG are not inherently script-capable in the same way.

An attacker needs the ability to upload or otherwise store SVG content that will later be served through the /view endpoint. This can be direct user access or indirect control via a compromised process that uploads assets.

The safest pattern is to treat script-capable image types as untrusted active content: either disallow or strictly sanitize SVG uploads, and ensure that any remaining SVG content is served in a non-inline, non-executable context that cannot run scripts under the main application origin.

Establish a consistent policy for handling user-uploaded files: categorize file types by risk, apply strict content-type checks and response headers, avoid inline rendering of active content, and incorporate security-focused code review and testing for endpoints that serve stored user content.

Find out what's already
exploitable in your codebase.