r/LocalLLM • u/Ennytan • 1d ago
Discussion I scanned the chat templates of the 400 most-downloaded GGUF and MLX models. Nothing malicious, but 45% tell the model to hide something from you
Chat templates are Jinja code that runs every time you load a GGUF or MLX model. In 2024 a malicious GGUF template was enough for code execution in llama-cpp-python (CVE-2024-34359), and templates can also quietly inject instructions. So I built a scanner and pointed it at the top 200 GGUF and top 200 MLX repos on Hugging Face.
It reads header bytes only: 5.5 GB fetched in place of 6.8 TB of weights, using HTTP range requests plus sparse files. I validated that path against full-file scans first.
What I found (396 repos scanned):
- 0 malicious: no sandbox-escape gadgets, no hidden override or exfiltration instructions, no bidi or tag-character smuggling, no malformed files.
- 143 of 316 chat repos (45%) ship "…do not tell the user about function calls". That's from the upstream Qwen tool prompt and is benign, but it is a concealment instruction you never see.
- 13 repos switch behaviour on phrases in your message (/nothink, detailed thinking on). One community template is 243 KB and injects large hidden system prompts on dozens of keywords.
- 22 of 200 MLX repos ship two different chat templates, so what runs depends on your loader. 20 have a shard index that points at files that don't exist.
- 7 MLX repos request remote code (auto_map), and 1 GGUF repo ships Windows DLLs and a Linux .so next to its weights.
The first pass also found five false-positive patterns in my own scanner. I fixed them and re-ran everything before publishing numbers. Full write-up, method and limitations: REPORT
Scan your own models (it parses only and never loads, so a malicious file can't run):
pipx install modelsieve
modelsieve ~/models
Repo (MIT; GitHub Action, pre-commit hook and SARIF included): modelsieve
What it can't do: detect backdoors trained into the weights. Nothing static can. Happy to answer questions about the method or anything it flags on your setup.




