/

CVE-2026-92816

Severity:

HIGH RISK

(7.8)

Path Traversal (CWE-22) in ComfyUI Dataset Save Nodes

CVE-2026-92816

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Write and Potential Code Execution

Severity:

HIGH RISK

(7.8)

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 dataset save nodes allows crafted workflows to use attacker-controlled folder names to write files outside the intended output directory. If an attacker can get a victim or exposed instance to load such a workflow, the written files may alter startup components and enable code execution.

Affected context

The issue occurs in ComfyUI deployments that use affected dataset save nodes and accept workflows containing attacker-controlled folder_name values. Risk increases when the process has write access beyond its designated output directory or when startup scripts, package initializers, or other executable application files are writable.

Exploit preconditions

  • Attack surface: ComfyUI workflow loading and dataset save nodes
  • Required access: Ability to submit, import, or cause a user to load a crafted workflow
  • Trigger point: Processing a dataset save node with an untrusted folder_name value
  • Why exploitation is possible: The folder name is not sufficiently constrained to the intended output directory, allowing path traversal and attacker-controlled file placement

Why this happens

The vulnerability results from treating a user-controlled folder_name value as a filesystem path without enforcing a trusted directory boundary. This insecure path construction pattern permits traversal sequences or equivalent path representations to escape the intended output location. The behavior maps to CWE-22, Improper Limitation of a Pathname to a Restricted Directory, and may become especially serious when the process can overwrite files that are later executed or imported.

Potential impact

  • Attackers may write arbitrary content to accessible filesystem locations.
  • Application startup behavior may be altered.
  • Python package initializers or related files could be modified and executed.
  • The ComfyUI process or host may be compromised.
  • Stored data, configuration, or workflows may be tampered with.

General mitigation guidance

Mitigation generally focuses on enforcing a strict filesystem trust boundary

for every dataset output path.

Common defensive patterns include:

  • Resolve candidate paths and verify that they remain beneath an approved output directory.
  • Reject traversal components, absolute paths, alternate separators, and other ambiguous path forms.
  • Prefer generated identifiers or controlled path components over user-supplied directory names.
  • Apply allowlists and strict schema validation before performing filesystem operations.
  • Run the application with least-privilege filesystem permissions and isolate writable data from executable code.
  • Use read-only mounts for application code, startup files, and package metadata where practical.
  • Treat imported workflows as untrusted content and require explicit review or approval before execution.

How teams detect issues like this

Detection approaches may include:

  • Static analysis for path joins or file writes that incorporate workflow-controlled values without canonicalization and boundary checks.
  • Code review of dataset and export nodes for absolute paths, traversal sequences, separator normalization gaps, and symlink handling.
  • Runtime logging of resolved output paths, rejected path values, and writes outside approved directories.
  • Filesystem monitoring for unexpected changes to startup scripts, package initializers, configuration files, or source code.
  • Policy enforcement that restricts application write access to dedicated data directories.
  • Automated security review tools can help identify unsafe path construction patterns in pull requests.

Sources

SourceLink
github.comgithub.com/Comfy-Org/ComfyUI
github.comgithub.com/Comfy-Org/ComfyUI/blob/v0.24.0/comfy_extras/nodes_dataset.py#L303-L318
github.comgithub.com/Comfy-Org/ComfyUI/blob/v0.30.0/comfy_extras/nodes_dataset.py
github.comgithub.com/geo-chen/oss/blob/main/ComfyUI.md
vulncheck.comvulncheck.com/advisories/comfyui-before-0.30.0-path-traversal-via-dataset-save-nodes

Frequently asked

questions

It may be exploitable through a remotely accessible ComfyUI instance if an

attacker can submit or cause a crafted workflow to be loaded. In other

deployments, user interaction or local access may be required.

The attacker generally needs workflow submission, import, or equivalent

influence over the dataset save node's folder_name value. The resulting

impact also depends on the ComfyUI process's filesystem permissions.

Constrain every resolved output path to a dedicated, non-executable output

directory and reject values that escape that boundary. User-controlled path

components should not be trusted as filesystem locations.

Use allowlisted path handling, canonicalize and validate paths before writing,

minimize process privileges, isolate writable data from application code, and

monitor sensitive files for unexpected modifications.

Find out what's already
exploitable in your codebase.