Sanaan Fayaz Wani

Comfy-Org/ComfyUI

CVE-2026-56673

Path traversal in LoadImage via the /prompt API allows arbitrary file existence probing and image exfiltration

CVE-2026-56673

7.5

High

CVSS 3.1 base

  1. 2026-07-15Published by the maintainer

What to do

If you run ComfyUI before 0.28.0, upgrade to 0.28.0 or later.

Anyone who can reach it over the network, with no account and no user interaction, can read sensitive data.Read from the CVSS 3.1 vector

CVSS 3.1 metrics

To exploit it

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None

What it gets

Confidentiality
High
Integrity
None
Availability
None
Scope
Unchanged

Open this vector in the FIRST calculator ↗

Weakness
CWE-22, CWE-863 Improper Limitation of a Pathname to a Restricted Directory · Incorrect Authorization
CVE
CVE-2026-56673
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Also in ComfyUI
CVE-2026-56671 7.5

My analysis of this finding: root cause, the vulnerable code, the impact and the fix, in the site’s format. The official advisory of record is linked above.

Affected versions

Package Ecosystem Vulnerable Fixed in
ComfyUI pip < 0.28.0 0.28.0

Summary

ComfyUI lets a node declare a VALIDATE_INPUTS classmethod, and when it does, the execution engine stops applying its own COMBO validation to every input that method names. LoadImage and LoadImageMask both declare VALIDATE_INPUTS(image) but only check that the file exists, not that it lives in the allowed directory. The result is an unauthenticated arbitrary image-file read through a crafted workflow. Co-discovered under the CISA coordinated disclosure (VU#150407) and assigned CVE-2026-56673.

Where it lives

The engine’s opt-out is in execution.py. COMBO (the dropdown list of legal filenames) is only enforced for inputs the node did not claim in its validator:

if x not in validate_function_inputs and not validate_has_kwargs:    # ... the min/max/COMBO membership checks live in this block ...

The bugskips COMBO checks for any input the node validator claims

Because image is a parameter of VALIDATE_INPUTS, it falls outside this block and the “must be one of the files in the input directory” check never runs. Control then passes entirely to the node’s own validator in nodes.py:

@classmethoddef VALIDATE_INPUTS(s, image):    if not folder_paths.exists_annotated_filepath(image):        return "Invalid image file: {}".format(image)    return True

The bugonly checks that the file exists, not where it lives

That function only asks “does this path exist”. The existence helper in folder_paths.py does the join with no containment check at all:

def exists_annotated_filepath(name) -> bool:    name, base_dir = annotated_filepath(name)    if base_dir is None:        base_dir = get_input_directory()  # fallback path    filepath = os.path.join(base_dir, name)    return os.path.exists(filepath)

The bugjoins the name onto the base with no containment check

get_annotated_filepath(), which load_image then calls to actually open the file, has the identical gap.

Impact

A workflow submitted to the unauthenticated /prompt endpoint can set the image input to a traversal path:

{"prompt": {"1": {
  "class_type": "LoadImage",
  "inputs": {"image": "../../etc/hostname [input]"}
}}}

COMBO validation is skipped, exists_annotated_filepath("../../etc/hostname [input]") resolves to /etc/hostname, exists, and returns True, so validation passes. load_image() then opens the traversed path with PIL. Any valid image file anywhere the process can read is returned, other users’ inputs and outputs included, and the pass/fail outcome is a filesystem existence oracle. The same pattern applies to LoadImageMask and LoadImageOutput.

Fix

The containment check belongs in the shared helpers so every caller inherits it:

def get_annotated_filepath(name, default_dir=None):    name, base_dir = annotated_filepath(name)    if base_dir is None:        base_dir = default_dir or get_input_directory()    filepath = os.path.abspath(os.path.join(base_dir, name))    if os.path.commonpath((os.path.abspath(base_dir), filepath)) != os.path.abspath(base_dir):        raise ValueError("Path traversal detected")    return filepath

The fixrejects paths that resolve outside the base directory

Fixing it here, rather than in each node’s VALIDATE_INPUTS, closes the class of bug instead of one instance, since the real weakness is that a node-supplied validator silently disables the engine’s own COMBO check.

The record

Weakness
CWE-22 Improper Limitation of a Pathname to a Restricted Directory
CWE-863 Incorrect Authorization
Affected
ComfyUI before 0.28.0
Fixed in
0.28.0
Disclosure
2026-07-15 Published
Advisory
GHSA-rvxv-29p8-pxgq
CVE-2026-56673
Also in ComfyUI
CVE-2026-56671 7.5

About this writeup

Sanaan Fayaz Wani (GitHub sfwani) reported this vulnerability to the ComfyUI maintainers under coordinated disclosure and is credited as a reporter in GHSA-rvxv-29p8-pxgq, published 2026-07-15.

All published findings: advisory index.