ComfyUI Botnet: Custom-Node Execution, Malicious Installs and Reinfection
Censys investigated a campaign targeting internet-exposed ComfyUI, a node-based interface for image-generation workflows. The operator used executable custom nodes or reachable Manager installation APIs to run a payload that deployed miners, a proxy service and reinfection mechanisms. Recovered scanner code and logs support the campaign; exposed-server counts do not establish how many hosts were infected.
The attack targets extensibility: recovered scanner revisions enumerate custom nodes and submit Python-bearing workflows to /prompt. If suitable nodes are absent, reachable Manager APIs offer alternate installation paths. The primary report does not establish a specific ComfyUI core CVE as the root cause.
Installation can already execute code: the v8.2 pip path installs an attacker repository whose setup.py launches the payload. It contains no genuine node, so a later reboot or successful workflow retry is not required for that route. Other Manager routes install executable nodes and retry after reboot.
Recovery must address reinfection: the recovered code includes a six-hour custom-node downloader and a poisoned startup workflow, alongside mining and proxy functions. Censys describes the workflow as restart-triggered reinfection; that exact loading/execution behavior is not independently validated here. Internet-exposed server counts are not infection counts. Later q12.txt Docker/Redis propagation capabilities are distinct from proof of successful lateral compromise.
The hosting/network owner can put ComfyUI behind an authenticated private gateway and allow the ComfyUI listener only from that gateway’s dedicated network identity. Deny direct public, peer-workload and alternate IPv4/IPv6 routes, then read back actual interface/rule attachments and test an authorized session plus a denied unlisted source. This removes direct scanner reachability; it does not make arbitrary custom-node Python safe for a trusted user.
Move dependency installation out of the serving ComfyUI process into a controlled ephemeral, no-network build using approved offline packages, read-only inputs and prebuilt hash-pinned wheels. Deny VCS/source builds, build backends and lifecycle scripts; the running service must not retain an alternate Manager installer. This blocks the setup.py execution path when fully enforced. Test a harmless source-build fixture and confirm it never executes or calls out. It requires a build/deployment redesign, not a claimed Manager toggle.
Constrain the entire ComfyUI service to a non-root runtime with minimal capabilities, no host home or Docker socket and only required GPU/device access. Verify actual runtime mounts and privileges. This limits host takeover after node execution; it does not deny legitimate GPU use to code running as the service and therefore is not by itself a mining-prevention control. Make the application code, installed custom-node roots and startup-workflow source read-only in the serving runtime, with separate bounded writable output/scratch volumes. Verify writes to both recovered reinfection paths fail. If the product requires editing those roots, this protection requires a controlled promotion workflow. It prevents those file-backed persistence writes, not temporary miners or changes to another writable startup source.
A network control outside ComfyUI can default-deny outbound traffic and allow only approved model/artifact services through constrained routes. It can block the unapproved payload host, mining pools and proxy control routes if no unrestricted gateway remains. Test each required destination and live denied canaries from the actual GPU workload. This limits external operation, not arbitrary local Python or data returned over an allowed request.
After preserving evidence and isolating the host, the response owner must remove confirmed malicious startup workflows and custom-node code from authoritative images, volumes and deployment sources. Rebuild from trusted artifacts and verify normal custom-node import and the deployment’s actual workflow-execution trigger in a credentialless, network-denied replica. Stopping a miner or finding one filename absent is insufficient; active processes require separate termination and no repeated download may occur. Remove confirmed downloaded payload/package artifacts as well, using an approved exact digest/path population, quarantine and deployment-source tombstones; independently verify all copies before a clean restart. A root-compromised host requires trusted recovery or replacement rather than self-attested cleanup.
After preserving evidence and isolating the affected runtime, an authorized managed-Linux administrator can terminate the compromised ComfyUI service, downloader, miner and proxy processes. Bind the approved population to host, PID namespace, start time, executable identity and cgroup membership; use pidfd-based termination, disable relaunch, and obtain separately credentialed complete-process absence checks. A successful kill command or a missing process name is insufficient. A root-compromised host cannot prove its own cleanliness: use a trusted external/recovery vantage or leave the result unresolved. This response still requires separate patching, artifact cleanup and revocation of any exposed credentials.
Public AI Endpoint & Agent-Service Exposure Discovery
High
The exposure-management owner can reconcile authorized cloud/IPAM inventories with read-only outside-in probes of actual ComfyUI ports and root/object_info routes, including nonstandard ports. Bind results and failed probes to a fresh signed product-specific profile and independently corroborate ownership, reachability and required authentication. Literal-IP scope needs an approved IPAM/EASM adapter; do not substitute a domain-only scanner input or an HTML title. This finds unintended exposure before remediation; it neither proves infection nor blocks exploitation.
On managed Linux, bind ComfyUI to the approved loopback/private addresses and gate readiness on observed listeners of the actual Python process tree, including TCP, UDP and Unix sockets after plugins load and after restarts. Compare independent readback with a signed endpoint profile; missing or partial observations cannot pass. Official CLI defaults to 127.0.0.1, but bare --listen enables IPv4 and IPv6 wildcard binds. This prevents an unintended listener configuration; firewall reachability and gateway authentication remain separate controls.
A separately trusted verifier can detect unauthorized persistence-file changes by comparing complete custom-node and startup-workflow roots against an approved signed baseline using actual immutable read-only filesystem snapshots. Baseline changes need controlled approval; include unexpected new files, not only hashes of known names. Verify changed/extra/clean fixtures, delivered alerts and explicit coverage/error results. A live writable-directory scan is not this method. This detects file-backed persistence drift, not memory-only miners or every compromise.
After isolating the real service, an operator can expose a separate credentialless synthetic GET root/object_info trap with signed fixture and route profiles. It must have no ComfyUI execution backend, production configuration, secrets or production connectivity; deny /prompt and installation methods. Pair the responder with a gateway contract that proves no production fallback, and retain independent append-only interaction evidence. The campaign actually queried node inventories and encountered honeypots. This withholds the genuine inventory and observes reconnaissance; a probe is not proof of malicious intent and the trap does not protect a still-public real backend.
AI Runtime Code and Module Loading Integrity Monitoring
Medium
A trusted Linux host observer can detect unauthorized native miner execution provenance by reconciling the complete release-bound runtime/descendant process population and checking actual executable mappings against signed required/allowed manifests. The full method flags unexpected, deleted and anonymous executable mappings; it can therefore flag the recovered memfd/deleted-file execution pattern without claiming to verify in-memory payload bytes. Use Linux 5.3+ pidfds, actual host PID/mount namespaces, required ptrace/map_files capabilities, stable quiesced captures, syscall/startup/cadence observation and independently retained evidence. Missing generations, dropped events or unreadable maps cannot pass. Validate harmless approved, unexpected, deleted and anonymous fixtures plus alert delivery. Legitimate JIT behavior requires a trustworthy compatible adapter or an explicit unresolved/not-applicable boundary; this is not a detector for arbitrary Python semantics or proof of malicious intent from memfd alone. A compromised kernel cannot attest itself clean.
What Defenders Should Do Now
Remove direct public ComfyUI and Manager access. Use an authenticated gateway into a private backend and verify that unlisted external and internal sources cannot reach the listener through alternate routes. Official policy trusts users who can reach the URL and treats custom nodes as arbitrary trusted Python.
Disable runtime installation paths. Review and prebuild required nodes in a controlled offline installation environment, reject source-build/lifecycle execution and deploy the verified result. Simply moving pip into another container does not help if the serving Manager can still install arbitrary repositories.
Run the service with minimal privileges and protect code, node-import roots and startup-workflow sources with read-only mounts. Keep output/scratch writes separate. Restrict outbound routes outside the service, including direct and proxy bypasses, and prove denial from the actual GPU workload. Allowed GPU access still permits resource abuse by compromised code.
On suspected compromise, isolate and preserve evidence before rebuilding. Review both custom_nodes/comfyui_perf_monitor/__init__.py and userdata/default/workflows/default.json against trusted sources, as well as active miners, proxy processes and alternate startup artifacts. Remove confirmed malicious sources, terminate active workloads separately and test ordinary startup in a disposable clean environment.
Inventory actual exposure and verify listener bindings after node loading and restart. On installed versions supporting them, disable unnecessary custom nodes with --disable-all-custom-nodes and keep any --whitelist-custom-nodes exceptions exact. For Manager versions with separate allow_pip_install/allow_git_url_install controls, keep both disabled and verify after restart; security_level alone is insufficient. --disable-manager-ui still permits scheduled installation/background work and is not a complete installer shutdown. Monitor complete approved node/workflow roots through immutable snapshots. An isolated synthetic reconnaissance trap is optional and must never forward to production.
Where the Linux prerequisites and complete process coverage can be met, monitor signed native executable-map provenance and explicit deleted/anonymous-map violations as a separate miner-execution signal. Do not substitute Python source hashes, GPU utilization or a clean-looking process name; legitimate JIT and incomplete observation require an explicit coverage decision.
Conclusion
The practical controls are private listener reachability, contained dependency installation, restricted service privileges and writes, externally enforced egress and complete removal of confirmed persistence. None requires assuming a prompt-injection mechanism or an unverified core CVE. Exposure inventory and listener readback identify and close unintended public entry; independent snapshot drift detection finds file-backed reinfection changes. Exact process termination, artifact eviction and an optional isolated reconnaissance decoy have different response and observation roles. Supported Linux deployments can additionally detect unapproved native executable mappings, with explicit anonymous/deleted-map findings and JIT/coverage limits.