Running AI models on your own hardware keeps your data in house. It does not make the model file safe. On 27 November, security researcher Düzgün of the open-source project Malspark published a scan of every public model repository on Hugging Face, 3,273,389 of them, and found five GGUF model files built to deliver malware. Together they had been downloaded 2,428 times.
GGUF is the file format most local AI tools use, including llama.cpp, Ollama and LM Studio. Most people think of it as a container for model weights. These five files show it carries more than that.
Facts below are from Malspark's write-up, linked under Sources.
How the attack worked
The weights were not touched. Two other parts of the file were.
The chat template. Every GGUF file carries a small template that turns a conversation into the text the model sees. It is meant for formatting. In two of the models, it quietly added a hidden instruction telling the model to start every reply with a single PowerShell command.
The bytes after the weights. The same two files had a Windows program appended after the last block of weights, where the model loader never looks. The hidden PowerShell command found the largest model file in the user's folder, read those last bytes, and saved them as a program in the temporary folder. Malspark identified it as a remote access trojan that also mines cryptocurrency, steals saved browser passwords and targets crypto wallets.
The other three models used a different trick: when a user's message contained a trigger phrase, the template inserted a fake system directive telling an AI agent with shell access to download and run a hidden script.
Why your local AI tool did not stop it
Local AI tools render the template in a restricted engine, so the template cannot run code by itself. It can only add text to the conversation. That is still enough:
- If a person runs the command the model suggests, the malware runs.
- If an AI agent with shell access reads the injected directive, it may run the command itself.
This is why the risk is growing. As more people give local models access to files, terminals and tools, text that only reached a chat window last year can now become an action.
What made these models tempting
All five were presented as "uncensored" or "abliterated" versions of popular models, and their names were close to well-known community uploads. One, Inkling-2-Mini-Uncensored-GGUF, matched the name of a legitimate uncensored release of the same model from another publisher. Total downloads grew by more than half in a single day, from 1,502 on 26 November to 2,428 on 27 November, mostly on the two most popular models. All five pages now show as disabled on Hugging Face, as reported by On The Wire.
Malspark reported that the dangerous template was switched on several days after the payloads were first uploaded, so a file that looked clean when someone first checked it may not have stayed that way.
Five checks for anyone running local AI
Each has a test and a record to keep.
1. Know who published every model you run. Test: list every model file on your machines and servers, with the Hugging Face account it came from. Prefer the original developer or a well-known quantiser. Treat "uncensored" re-uploads from unknown accounts as untrusted until checked. Keep: the list, with the publisher and download date for each file.
2. Record a hash of every model file. Test: calculate the SHA-256 of each file and compare it with the hash shown on the publisher's Hugging Face page. Do it again whenever a file is updated. Keep: the hashes and dates. A file whose hash changes without a new release is a finding.
3. Scan unfamiliar files before they reach a developer machine. Test: run an inspection tool over any third-party GGUF file. Malspark released gguf-radar (MIT licence), which checks templates and hidden trailing data without running the model, and can rebuild a clean copy with the weights unchanged. It is new, so read it before you rely on it. Keep: the scan output for each file.
4. Use a chat template you have read.
Test: for any model you did not get from its original developer, supply your own reviewed template instead of the one inside the file. llama.cpp accepts --chat-template-file, and Ollama accepts a TEMPLATE in a Modelfile.
Keep: the template file you use, in version control.
5. Never let a model's suggestion become a command on its own. Test: check whether any AI agent in your business can run shell commands without a person approving each one. If it can, limit it to named commands and folders, run it in a container, and log what it runs. Keep: the agent's permissions, and a sample of its command log.
Where this fits
The model file is part of your software supply chain, just like a code library. Our AI agent and private AI hardening work checks where your models come from, what they can reach and what your agents are allowed to run. For a related risk on the same kind of setup, see the UPS and the AI server, where exposed local AI servers were already being used by strangers.
Sources
- Düzgün, Malspark, "GGUF LLM Models with Hidden Malware on Hugging Face Reached 2400+ Victims", 27 November 2026
- gguf-radar on GitHub
- Pasquale Pillitteri, "Hugging Face blocks GGUF models with hidden malware after 2,428 downloads"
- On The Wire, "Open-source security project Malspark says five GGUF models on Hugging Face were malicious"
Sam Sultan
Founder, Enact Cyber
Building evidence-first compliance methodology at Enact Cyber. Every report grounded in real findings, never pre-written, never fabricated.