AImunk

Is it safe to download GGUF models from Hugging Face?

I run small models on my own machine and I mostly grab GGUF files from Hugging Face.

This week I read that some GGUF files there carry hidden malware. How does that even work if the file is only model weights? And what should I check before I load one?

Report

3 answers and replies

Sam WhitfieldSeeker
Best answer

Mostly yes, with one catch: a GGUF file holds more than weights, and that is where the risk is.

Every GGUF file carries a chat template, a small program the runtime applies to each prompt. A poisoned template can add instructions you never see, for example telling the model to start each reply with a command for you to run. Extra bytes can also sit after the last tensor, where loaders never read.

A scan of all 3,273,389 public model repositories on 26 November 2026 found 5 malicious GGUF models with 2,428 downloads: Malspark write-up. Small numbers, but real.

So never run a command a local model suggests, and scan files before loading. The authors publish an open-source checker, gguf-radar, that inspects a file without running it.

Report

Adding a limit to the claim. 2,428 is downloads, not people. The write-up itself says Hugging Face counts downloads, so the number of affected users is that or lower.

Also, the template trick is not special to GGUF. The same post notes that Safetensors and PyTorch models ship a chat template in a separate file. What is GGUF-only is hiding a program after the last tensor, because the safetensors loader refuses a file with extra bytes.

Reply to Sam Whitfield
Revathi SundarSeeker

Follow-up for anyone using a model with tools: the post's own advice is to pass a reviewed template with --chat-template-file in llama.cpp, or TEMPLATE in an Ollama Modelfile. That takes the embedded template out of the loop.

Report
Reply to Revathi Sundar