gguf malware on Hugging Face: A Safe Model Download Checklist for Local AI Users

2026-11-29来源 dev.toEnglish

gguf malware is the phrase local AI users are searching this weekend, after a security write-up reported that malicious GGUF model files on Hugging Face were downloaded 2,428 times (Malspark). If you run models on your own machine with llama.cpp, LM Studio or Ollama, this one is worth ten minutes. Below is a research-based summary of what the report says, plus a short checklist you can use before loading any community model.

What the report found

According to Malspark's post (27 November 2026), a scan of about 3.27 million public Hugging Face model repositories on 26 November found five malicious GGUF models. The author notes that Hugging Face counts downloads, not people, so the number of affected users is at most 2,428.

The report describes two tricks:

  • Poisoned chat templates. Every GGUF file carries a chat template (stored under tokenizer.chat_template) that the runtime applies to each prompt. In one campaign, the template told the model to start every answer with a PowerShell line the user might copy and run. In another, a trigger phrase made the template insert a hidden "system directive" telling an agent with shell access to download and run a script.
  • Hidden bytes after the model data. Runtimes only read the byte ranges the GGUF header points to. The report says one campaign appended a Windows remote access trojan after the last tensor, where loaders never look, and later changed the template to prompt the user to unpack it.

The post also says antivirus engines and checks that only look at the last few kilobytes of a file did not catch the compressed payload.

The story reached the Hacker News front page on 28 November (Hacker News), where several commenters said they already run local models inside a VM or on a separate machine.

A safe model download checklist

These steps come from the report's own recommendations, plus common-sense habits.

  1. Treat any command a model suggests as untrusted. Never paste a shell or PowerShell line from a model reply without reading it. This is the report's first recommendation.
  2. Override the embedded template when the model can use tools. The report suggests passing a reviewed template with --chat-template-file in llama.cpp, or setting TEMPLATE in an Ollama Modelfile, so the file's built-in template is out of the loop.
llama-cli -m model.gguf --chat-template-file verified_template.jinja 
  1. Scan the file before you load it. The report's author released an open-source scanner, gguf-radar (MIT licence). Per the post, it checks templates and trailing bytes without running anything, and can rebuild a clean file with the same weights:
gguf-radar scan ./model.gguf gguf-radar sanitize suspicious.gguf -o clean.gguf 
  1. Prefer well-known publishers. Uncensored or niche re-uploads from brand-new accounts are higher risk. The malicious models in the report came from two accounts.
  2. Limit what an agent can touch. If a local model drives tools, give it the smallest set of permissions it needs, and keep it away from shells on machines that hold passwords or wallets.
  3. For teams: gate models at one point. The report suggests running every incoming model through a scanner before it reaches an internal registry or developer laptops.

The takeaway

Model files are not just passive weights anymore. The chat template is a small program, and the file can carry extra data your runtime silently skips. A two-minute scan and a reviewed template remove most of the risk described here.

I write short, research-based AI news for small businesses and creators at ainews.useaifix.com.

原文:https://www.a8q9.cn/en/article/gguf-malware-on-hugging-face-a-safe-model-download-checklist-for-local-ai-users-26ee04.html

相关文章