A new kind of attack hides inside AI model files. Here is the thirty-second version, how it works, and two free tools that check a model before it ever runs on your machine.
If you run AI models on your own computer, you download big files from strangers and let a program read them. For a long time that felt safe: a model is just numbers. In late 2026, researchers found model files that were not just numbers. This is new, it's on the people doing it, not on the sites that host models, and you can protect yourself in a few minutes.
In November 2026, a security firm reported model files on Hugging Face carrying a Windows trojan: it steals passwords and crypto wallets, logs keystrokes, watches the webcam and mines cryptocurrency. Their report counts more than 2,400 victims. The files were dressed as popular "uncensored" versions of real models.
The people behind them were patient and clever. One copied the exact name of a real repository with about two million downloads. The same account created empty repositories named after models that weren't out yet, ready for the day people went searching. One file sat quietly with a clean template for days, then a re-upload swapped the template and armed it. Another case skipped the hidden program entirely: a small "cyber security assistant" model whose template told any agent running it to download a script from a website and run it in a hidden window.
Hosting sites are full of honest work, and their virus scans catch plenty. But a virus scanner looks for known programs; it doesn't read the instructions inside a chat template. So the last check has to happen on your own machine.
None of this needed a bug in your software. It used two things every model file already has: room for extra bytes, and a template that runs before every reply.
Step one, the payload. A model file (a GGUF) begins with a header that says exactly where the model's data ends. Runners like llama.cpp, LM Studio and Ollama read only that range. Anything glued on after it is never read, never checked, and never warned about. That's where the trojan went.
Step two, the trigger. The chat template is a small program inside the file that runs before every answer and builds the text the model actually reads. You never see that text. A rewritten template can add a hidden instruction, in plain language, even in another language, telling the model to start every answer with one command. That command finds the model file on your disk, cuts out the hidden program and runs it. A person who pastes it, or an agent with a terminal, sets it off.
Extra bytes after the model data, in the padding before it, in the gaps between tensors, or inside "dead" weight blocks that decode to zero no matter what they hold. Safetensors loaders refuse a file with leftover bytes at the end, which closes the tail there, but not every loader checks the gaps.
The trigger. It works on GGUF files and on full-weight models alike, since those carry their template in a file beside the weights. Reading templates by eye doesn't scale: real ones run to thousands of characters, and honest ones differ from the lab's on purpose to fix bugs. The defence is to compare against the lab's own, byte for byte, and to run with the lab's template pinned.
Copied repository names, names squatted for models not released yet, and accounts a few days old. Every case in these reports was an "uncensored" or "cyber" build from an account with no history.
The hardest one. Researchers at Microsoft showed in 2026 that a backdoor can be written straight into a handful of a model's neurons (seven, in one 8-billion-parameter model) so that a trigger phrase makes it emit an attacker's command, while it behaves normally the rest of the time. No scanner can prove a model's weights clean. The best defence is comparing against the original release, and "uncensored" builds, edited on purpose, are the hardest to judge.
Every one of these attacks needed a person to run a printed command, or an agent with shell access. The trojan was Windows-only: a Mac or Linux machine that only chats with a model was never in reach. A model can only touch what you hand it.
Two small, free Python scripts we wrote and use on every model we download or publish. Nothing to install beyond Python 3, numpy, and the gguf package that comes with llama.cpp. They only read; they never run the model.
Looks at a Hugging Face repository without downloading any weights: the uploader's account age and history, the same name under other owners, a copy younger than the original, a disabled repository, the chain of base models back to the real lab, each file's header (fetched over the network) against its real size, and the chat template against every version the lab ever published.
# a GO, or a list of things to LOOK at before you pull anything
python3 precheck_hub.py owner/repo-name --gguf-py llama.cpp/gguf-py
Reads the whole file: nothing after the model data, all padding and gaps zero, no NaN or infinity in any weight, every zero-scale block clean, no Windows, Linux or Mac programs, archives or script text anywhere inside, and the chat template compared byte for byte with the lab's own. It works on GGUF and safetensors files.
# --auto-refs finds each file's lab from its own metadata and fetches that lab's templates to compare
python3 check_gguf.py --auto-refs --out report/ --gguf-py llama.cpp/gguf-py your-model.gguf
No llama.cpp folder? Run pip install gguf numpy, then hand the tools the folder pip put it in:
--gguf-py "$(python3 -c 'import gguf,os;print(os.path.dirname(os.path.dirname(gguf.__file__)))')"
Honest limits. These tools catch hidden data and changed templates. They cannot prove that a model's weights are free of a backdoor; nothing can yet. They look for the lab's template in the usual places; when a lab keeps it somewhere unusual (Qwen 4 keeps it in a subfolder), download the lab's template yourself and pass its folder with --refs.
--chat-template-file. Ollama: a TEMPLATE line in your Modelfile. LM Studio: the prompt-template override. Then a tampered template in the file never runs.The twenty-seven-minute video this page condenses: Kai, "I Was Wrong About Local AI Security" (3 December 2026). The security firm's report: Malspark, "GGUF LLM Models with Hidden Malware on Hugging Face". The weight-backdoor research: Microsoft's 2026 "Lazarus" work, as presented in the video. Our tools are the ones we used to scan our own first release.
If this page saves one person a bad day, it did its job. 🖤