Which model file formats can run code when loaded in ComfyUI, and what protections exist at the pinned versions?
Corrected 2026-10-23 - see C3-B595-06; the original statements below are kept for history and are superseded where the correction says so. Pickle-based model files (.ckpt, .pt, .pth, .bin) can execute code when loaded, according to Hugging Face's documentation; safetensors is designed not to. ComfyUI at commit 46aad33e loads .safetensors/.sft files with safetensors.safe_open and everything else with torch.load(..., weights_only=True), which PyTorch documents as narrowing, not eliminating, remote-code-execution risk (denial of service and memory corruption may still be possible). ComfyUI-Manager's install_model path requires the 'middle' security level and a whitelist match against model-list.json, and for non-.safetensors filenames without 'high' permission it also requires a default-channel URL match. The ComfyUI frontend's missing-model download allowlist (huggingface.co, civitai.com and civitai.red prefixes plus a few exact URLs) still permits .ckpt, .pt and .pth suffixes. Huggin...
Structured fields
{
"citations": [
{
"url": "https://github.com/huggingface/hub-docs/blob/2fccef08a10181d0cdda4600ecdcc5d04d160595/docs/hub/security-pickle.md",
"note": "ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weights_only security'; HF hub-docs security-pickle.md 'Hub's Security Scanner' disclaimer"
},
{
"url": "https://github.com/Comfy-Org/ComfyUI/blob/46aad33e4d4c0696582611bf450dd93742fa9090/comfy/utils.py",
"note": "ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weights_only security'; HF hub-docs security-pickle.md 'Hub's Security Scanner' disclaimer"
},
{
"url": "https://github.com/pytorch/pytorch/blob/b40a4f2c025f42d1c2d4ece32daa39295b436f72/docs/source/notes/serialization.md",
"note": "ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weights_only security'; HF hub-docs security-pickle.md 'Hub's Security Scanner' disclaimer"
},
{
"url": "https://github.com/Comfy-Org/ComfyUI-Manager/blob/a74929c65b49d7d7d81b9a6f140de878a818b893/glob/manager_server.py",
"note": "ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weights_only security'; HF hub-docs security-pickle.md 'Hub's Security Scanner' disclaimer"
},
{
"url": "https://github.com/Comfy-Org/ComfyUI_frontend/blob/1b7a412da009ebd82ac1b254ab8e32094f0e8a72/src/platform/missingModel/missingModelDownload.ts",
"note": "ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weights_only security'; HF hub-docs security-pickle.md 'Hub's Security Scanner' disclaimer"
},
{
"url": "https://github.com/Comfy-Org/ComfyUI/blob/46aad33e4d4c0696582611bf450dd93742fa9090/SECURITY.md",
"note": "ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weights_only security'; HF hub-docs security-pickle.md 'Hub's Security Scanner' disclaimer"
},
{
"url": "https://github.com/huggingface/safetensors/blob/e246a2560645b7525f5775669ed816eb57c5bcc8/README.md",
"note": "ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weights_only security'; HF hub-docs security-pickle.md 'Hub's Security Scanner' disclaimer"
},
{
"url": "https://github.com/Comfy-Org/ComfyUI/blob/46aad33e4d4c0696582611bf450dd93742fa9090/requirements.txt",
"note": "ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weights_only security'; HF hub-docs security-pickle.md 'Hub's Security Scanner' disclaimer"
}
]
}Evidence claims
- [sourced_fact] Pickle-based model files (.ckpt, .pt, .pth, .bin) can execute code when loaded, according to Hugging Face's documentation; safetensors is designed not to. ComfyUI at commit 46aad33e loads .safetensors/.sft files with safetensors.safe_open and everything else with torch.load(..., weights_only=True), which PyTorch documents as narrowing, not eliminating, remote-code-execution risk (denial of service and memory corruption may still be possible). ComfyUI-Manager's install_model path requires the 'middle' security level and a whitelist match against model-list.json, and for non-.safetensors filenames without 'high' permission it also requires a default-channel URL match. The ComfyUI frontend's missing-model download allowlist (huggingface.co, civitai.com and civitai.red prefixes plus a few exact URLs) still permits .ckpt, .pt and .pth suffixes. Hugging Face says its pickle scanner is not foolproof. Code read at the pins; nothing was executed. · locator: ComfyUI 46aad33e comfy/utils.py load_torch_file (curator lines 158-192); ComfyUI 46aad33e comfy/sd1_clip.py lines 378-395, 449-457 (embedding load); ComfyUI 46aad33e comfy_extras/nodes_dataset.py line 2104; ComfyUI 46aad33e nodes.py line 581; SECURITY.md lines 5-10, 27-29; requirements.txt lines 4-6; Manager a74929c6 manager_server.py lines 39, 127-138, 1755-1778; frontend 1b7a412d missingModelDownload.ts lines 7-36; PyTorch b40a4f2c serialization.md 'torch.load with weights_only=True' and 'weig source
Rights
| component | license | hosting | redistribution | modification | training | Evidence and notes |
|---|---|---|---|---|---|---|
| documentation | unknown | permitted | permitted | unknown | unknown | Applies to this original summary only, not to the cited sources. |
Linked records
- cites → https://github.com/Comfy-Org/ComfyUI-Manager/blob/a74929c65b49d7d7d81b9a6f140de878a818b893/glob/manager_server.py
- cites → https://github.com/Comfy-Org/ComfyUI/blob/46aad33e4d4c0696582611bf450dd93742fa9090/SECURITY.md
- cites → https://github.com/Comfy-Org/ComfyUI/blob/46aad33e4d4c0696582611bf450dd93742fa9090/comfy/utils.py
- cites → https://github.com/Comfy-Org/ComfyUI/blob/46aad33e4d4c0696582611bf450dd93742fa9090/requirements.txt
- cites → https://github.com/Comfy-Org/ComfyUI_frontend/blob/1b7a412da009ebd82ac1b254ab8e32094f0e8a72/src/platform/missingModel/missingModelDownload.ts
- cites → https://github.com/huggingface/hub-docs/blob/2fccef08a10181d0cdda4600ecdcc5d04d160595/docs/hub/security-pickle.md
- cites → https://github.com/huggingface/safetensors/blob/e246a2560645b7525f5775669ed816eb57c5bcc8/README.md
- cites → https://github.com/pytorch/pytorch/blob/b40a4f2c025f42d1c2d4ece32daa39295b436f72/docs/source/notes/serialization.md