How to Detect and Remove the Returning Hugging Face GPU Miner
A crypto-mining campaign abusing Hugging Face models has resurfaced just days after an initial takedown, and this time it’s targeting GPU servers directly—one malicious model racked up over 28,000 downloads before removal. If you run any transformers-based inference or fine-tuning workloads, assume your environment is a candidate until you verify otherwise. This guide gives you a concrete detection-and-remediation checklist you can run in under 30 minutes, plus the hardening steps that stop the next wave.
The attack chain is consistent: a poisoned model repo ships a trust_remote_code=True payload that executes on load, drops a mining binary, and opens a reverse-shell backdoor. Below is how to find each stage.
Step-by-Step: Detect, Remove, and Block the Miner
Phase 1 — Audit what you’ve actually downloaded
- List recently pulled models. Check your HF cache for anything fetched in the incident window:
find ~/.cache/huggingface/hub -maxdepth 1 -type d -newermt "2026-10-01" - Flag models that require remote code. Any repo with
auto_mapinconfig.jsonor atrust_remote_codeflag is a red flag unless you authored it:grep -rl "auto_map" ~/.cache/huggingface/hub --include=config.json - Cross-check against model cards. Legitimate models rarely need
trust_remote_code=Trueanymore; if a card insists on it, treat it as untrusted.
Phase 2 — Hunt for the miner and backdoor
- Check GPU utilization at idle. A miner shows sustained 90–100% GPU load with no matching Python process. Compare:
nvidia-smi --query-gpu=utilization.gpu,memory.used --format=csv - Inspect for rogue processes and connections.
Mining pools commonly use ports 3333/5555/7777; reverse shells often hit 4444.ps aux | grep -Ei "xmrig|kdevtmpfsi|kinsing|\.cache/.*/\.sh" ss -tunp | grep -E ":(3333|4444|5555|7777|14444)\b" - Scan for persistence. The campaign plants cron jobs and systemd units:
crontab -l; ls -la /etc/cron.*/; systemctl list-units --type=service | grep -iE "update|kworker"
Phase 3 — Remediate
- Kill and quarantine. Stop the process, then move the model directory out of the cache rather than deleting blindly—preserve it for forensics:
sudo kill -9 <PID> mv ~/.cache/huggingface/hub/models--<suspicious-repo> /tmp/quarantine/ - Rotate credentials. Any
HF_TOKEN, cloud IAM keys, or SSH keys present on the host should be considered compromised. Rotate them. - Rebuild from a clean image if a backdoor was confirmed—removing a reverse shell by hand is unreliable.
Phase 4 — Harden against the next wave
| Control | Setting | Why it matters |
|---|---|---|
| Remote code | trust_remote_code=False (default) |
Blocks the primary execution vector |
| Model source | Pin to org-verified repos + commit SHA | Prevents silent repo swaps |
| Network egress | Deny outbound to unknown IPs/ports | Kills pool connectivity |
| GPU monitoring | Alert on >80% idle utilization | Catches miners early |
| Sandboxing | Run inference in gVisor/container | Limits blast radius |
Also relevant: a fake Solana starter kit on GitHub is now targeting AI coding agents into installing a NetSupport RAT. If your agent auto-runs npm install or pip install from README instructions, add a review gate before package installs.
Common Issues and What You Should Know
- “My model still loads after quarantine.” HF re-downloads on next run. Add the repo to a blocklist or set
HF_HUB_OFFLINE=1during investigation. - False positives on GPU load. Legit training jobs look identical to miners. Correlate with process ownership and network egress before acting.
- Shared CI runners. Ephemeral runners are safest; persistent GPU runners are prime targets because they hold tokens and stay warm.
- Scanning tools won’t catch it. The payload is often a benign-looking
.pyin the repo, so signature AV misses it—behavioral checks (ports, cron, GPU) matter more.
Frequently Asked Questions (FAQ)
Is it safe to download models from Hugging Face after this campaign?
Yes, with guardrails: keep trust_remote_code=False, prefer verified orgs, pin commit SHAs, and scan any repo that demands remote code execution before loading it.
How do I know if my GPU server is being used for crypto mining?
Look for sustained near-100% GPU utilization with no matching process, outbound connections to mining-pool ports (3333/5555/7777), rogue cron jobs, and unexpected xmrig/kinsing-style binaries.
Can a Hugging Face model install malware just by loading it?
Only if it uses trust_remote_code=True or auto_map custom code. Standard weight-only models are data, not executable—so disabling remote code removes the risk.
What is the fake Solana starter kit NetSupport RAT?
A malicious GitHub repo posing as a Solana dev starter that tricks AI coding agents into installing NetSupport RAT. Review install scripts and never let agents run untrusted npm/pip commands unattended.
Final Verdict
Treat this campaign as a wake-up call, not a one-off. Default to trust_remote_code=False, pin every model to a commit SHA, and monitor GPU utilization as a security signal—those three steps neutralize the current attack chain and most future variants. If you’ve already loaded a suspicious model, rotate credentials and rebuild the host rather than trusting a manual cleanup. The cost of a hardened pipeline is a few minutes of config; the cost of a hijacked GPU server is far higher.