/

CVE-2026-56673

Severity:

HIGH RISK

(7.5)

Path Traversal (CWE-22) in ComfyUI Media Load Nodes

CVE-2026-56673

Awaiting Analysis

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Read / Information Disclosure

Severity:

HIGH RISK

(7.5)

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

A path traversal vulnerability in ComfyUI's media loading nodes allows workflow-controlled filenames to be joined to a base directory without verifying they stay within that directory.

An unauthenticated attacker can craft a POST /prompt workflow that probes arbitrary host paths and exfiltrates readable image-format files via the /view endpoint when certain loader nodes are used.

Affected context

The issue arises in ComfyUI deployments that expose the HTTP API and allow untrusted users to submit or modify workflows.

The vulnerable behavior appears when nodes such as LoadImage, LoadImageMask, LoadImageOutput, LoadAudio, LoadLatent, LoadVideo, and Load3D accept annotated filenames that are concatenated with a base directory without performing containment or canonicalization checks.

When the execution engine honors the nodes' VALIDATE_INPUTS behavior and skips directory validation, attacker-controlled paths can reference files outside the intended media folder structure, subject to OS-level read permissions.

Exploit preconditions

  • Attack surface: HTTP API endpoints, specifically POST /prompt for workflow submission and /view for viewing outputs.
  • Required access: Network reachability to the ComfyUI instance; no authentication required in default open deployments.
  • Trigger point: Use of vulnerable loader nodes (e.g., LoadImage, LoadAudio, LoadVideo) in a crafted workflow with annotated filenames containing path traversal sequences or absolute paths.
  • Why exploitation is possible: The functions folder_paths.get_annotated_filepath and exists_annotated_filepath concatenate workflow-controlled filenames with a base directory without checking that the resulting path remains inside the intended directory, and the VALIDATE_INPUTS logic can bypass COMBO input-directory validation.

Why this happens

At its core, this vulnerability stems from improper validation of file paths constructed using user-controlled input.

The application takes annotated filenames provided by the workflow, joins them with a base folder, and then uses the resulting path without normalizing or confirming that it resides within an approved directory.

This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where path traversal sequences (such as relative directory components or absolute paths) allow access to files outside the intended root.

The additional use of a VALIDATE_INPUTS mechanism that disables directory validation for certain nodes further weakens the trust boundary between user workflows and the host filesystem.

Potential impact

  • An attacker may read arbitrary image or media files on the host that are accessible to the ComfyUI process.
  • An attacker could probe the filesystem to discover the presence or absence of specific paths, aiding reconnaissance.
  • Sensitive information, such as configuration screenshots, cached images, or media-derived data, could be exfiltrated via the /view endpoint.
  • In environments where media-format files contain confidential or proprietary content, this could lead to broader information disclosure and privacy violations.

General mitigation guidance

Effective mitigation focuses on constraining how file paths are derived and enforced at the boundary between workflows and the filesystem.

Common patterns include:

  • Performing canonicalization and containment checks on all user-influenced paths to ensure they resolve within a designated media directory.
  • Using strict allowlists of directories and disallowing absolute paths or parent-directory components in annotated filenames.
  • Enforcing validation logic consistently across all nodes so that no node can bypass directory checks through custom validation hooks.
  • Running the ComfyUI process under an account with least-privilege filesystem permissions, isolating it from sensitive host directories.
  • Segregating user-uploaded or workflow-referenced media into dedicated, sandboxed storage locations rather than sharing host-wide paths.

How teams detect issues like this

Organizations can identify similar weaknesses by:

  • Applying static analysis or linters that flag manual path concatenation with user-controlled input (e.g., string-based joining of directory and filename).
  • Reviewing code for any helper functions that build file paths and confirming they enforce canonicalization and directory whitelisting.
  • Implementing security-focused code review checklists that highlight filesystem access, especially around media loaders and plug-in nodes.
  • Using runtime logging and monitoring to track unusual file access patterns, such as repeated attempts to access parent directories or non-media paths via workflow submissions.
  • Integrating automated security testing or fuzzing of API endpoints (like POST /prompt) with path traversal payloads to ensure defenses are effective.

Sources

SourceLink
github.comgithub.com/Comfy-Org/ComfyUI/pull/14734
github.comgithub.com/Comfy-Org/ComfyUI/releases/tag/v0.28.0
github.comgithub.com/Comfy-Org/ComfyUI/security/advisories/GHSA-rvxv-29p8-pxgq

Frequently asked

questions

Yes, it can be exploited remotely as long as the ComfyUI HTTP API is reachable over the network and allows workflow submissions from untrusted clients.

The attacker needs the ability to send crafted POST /prompt requests and reach the /view endpoint; in many default or test setups, this does not require authentication.

The safest pattern is to canonicalize all user-influenced paths, verify that they reside inside a predefined root directory, and reject any path that attempts to escape that boundary, while also ensuring no node-level logic can bypass these checks.

Developers can standardize on centralized path-handling utilities that enforce containment, avoid manual string concatenation for filesystem paths, add unit tests for path traversal edge cases, and include filesystem access reviews as a mandatory step in code review.

Find out what's already
exploitable in your codebase.