Skip to main content
Vulnerability Database/CVE-2024-10481

CVE-2024-10481: Comfy ComfyUI CSRF Vulnerability

CVE-2024-10481 is a cross-site request forgery flaw in Comfy ComfyUI that lets attackers perform unauthorized API requests through malicious websites. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-10481 Overview

CVE-2024-10481 is a Cross-Site Request Forgery (CSRF) vulnerability in comfyanonymous/comfyui versions up to and including v0.2.2. The flaw affects unauthenticated API endpoints including /upload/image, /prompt, and /history. An attacker who tricks an authenticated ComfyUI user into visiting a malicious website can issue arbitrary API requests from the user's browser. Successful exploitation enables unauthorized file uploads and workflow execution against the victim's ComfyUI instance. The weakness is tracked as CWE-352: Cross-Site Request Forgery.

Critical Impact

Attackers can upload arbitrary files and execute workflows on behalf of an authenticated ComfyUI user, with potential chaining to stored XSS for session compromise.

Affected Products

  • comfyanonymous/comfyui versions up to and including v0.2.2
  • ComfyUI deployments exposing the web interface to authenticated users
  • Any ComfyUI instance accessible via browser without CSRF protections

Discovery Timeline

  • 2025-03-20 - CVE-2024-10481 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in the NVD database

Technical Details for CVE-2024-10481

Vulnerability Analysis

ComfyUI exposes a REST API used by the web front end to manage image uploads, prompts, and generation history. The server does not validate the origin of state-changing requests. It also does not require anti-CSRF tokens on sensitive endpoints such as /upload/image, /prompt, and /history.

An attacker hosts a crafted page that issues cross-origin requests to a victim's ComfyUI instance. The victim's browser attaches any ambient session context, and the server processes the forged requests as legitimate. This allows unauthorized file uploads, submission of attacker-controlled generation prompts, and manipulation of history records.

The impact escalates when combined with other weaknesses. Uploading content via /upload/image can plant payloads that trigger stored XSS, which can then hijack the authenticated session or pivot to further API abuse.

Root Cause

The root cause is the absence of CSRF protections on state-changing API endpoints. ComfyUI does not implement same-site cookie restrictions, origin or referer validation, or synchronizer tokens on the affected routes.

Attack Vector

Exploitation requires an authenticated ComfyUI user to visit an attacker-controlled page. The malicious page submits a cross-origin HTML form or fetch request to the victim's ComfyUI endpoint. User interaction is required, but no privileges or credentials need to be known by the attacker. Refer to the Huntr Bug Bounty Report for the submitted proof of concept.

Detection Methods for CVE-2024-10481

Indicators of Compromise

  • Unexpected files appearing in the ComfyUI uploads directory that do not correspond to user-initiated actions
  • API requests to /upload/image, /prompt, or /history with Origin or Referer headers pointing to untrusted third-party domains
  • Workflow executions or history entries that users do not recognize

Detection Strategies

  • Enable application-level logging for all requests to /upload/image, /prompt, and /history and alert on cross-origin referrers
  • Correlate browser session activity with ComfyUI API calls to identify requests originating outside the application
  • Monitor file system changes in ComfyUI input and output directories for unexpected writes

Monitoring Recommendations

  • Instrument the reverse proxy fronting ComfyUI to log and alert on requests missing a trusted Origin or Referer header
  • Review web server access logs for POST requests to the vulnerable endpoints from external referrers
  • Track user agent and IP anomalies on authenticated ComfyUI sessions

How to Mitigate CVE-2024-10481

Immediate Actions Required

  • Upgrade ComfyUI to a release later than v0.2.2 that implements CSRF protections
  • Restrict ComfyUI exposure to trusted networks or place it behind an authenticating reverse proxy with origin validation
  • Advise users to log out of ComfyUI sessions when not actively using the application

Patch Information

The vulnerability affects comfyanonymous/comfyui versions up to v0.2.2. Users should update to a fixed release from the upstream repository. Review the Huntr Bug Bounty Report for additional remediation context and references to the fix commit.

Workarounds

  • Deploy a reverse proxy (NGINX, Caddy, Traefik) that enforces strict Origin and Referer header validation on state-changing endpoints
  • Bind the ComfyUI listener to 127.0.0.1 and tunnel access through SSH or a VPN rather than exposing it to a browser session shared with untrusted sites
  • Use a dedicated browser profile for ComfyUI to isolate session cookies from general web browsing
bash
# NGINX snippet enforcing Origin validation for ComfyUI API endpoints
location ~ ^/(upload/image|prompt|history) {
    if ($http_origin !~* ^https?://(localhost|comfyui\.internal\.example\.com)(:[0-9]+)?$) {
        return 403;
    }
    proxy_pass http://127.0.0.1:8188;
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.