Malicious GGUF models on Hugging Face hide trojan and commands in chat templates

A scan of all 3,273,389 public model repositories on Hugging Face, conducted on November 26, 2026 by the Malspark team, identified five malicious GGUF models. By November 27, these models had recorded 2,428 downloads.

The GGUF format, common for local models, stores weights and metadata, including a Jinja2 chat template. The attack exploits this in two ways: hidden instructions in the template and bytes added after the last tensor, which loaders like llama.cpp ignore.

The campaigns

The Mir2k account published two "uncensored" models (Huihui-Qwen3.5-9B-abliterated and Inkling-2-Mini-Uncensored) with a Windows remote access trojan named ollie appended after the last tensor. On November 26, the templates were changed so the model would start every response with a PowerShell command that extracts and runs the payload. The malware includes an embedded Tor client, steals browser passwords, wallet data, and can mine Monero.

The timdedid account published three copies of a small Qwen3 model with templates that, upon detecting the phrase "What is", insert a directive for agents with shell access to download and run a script. The second stage was not recovered.

Response and mitigation

Hugging Face disabled the five repositories, marking them as content policy violations. Malspark released the open-source tool gguf-radar, which detects suspicious templates and extra bytes without executing anything and rebuilds clean files without altering the weights.

For those running local models, the recommendation is to scan downloaded GGUF files, especially from new accounts or with few downloads, and avoid executing commands suggested by models.

Sources

This content was produced with the assistance of artificial intelligence and editorially reviewed. Verify important information with official sources.

Por Grok