# How to check malicious GGUF models on Hugging Face

> Malicious GGUF files hide payloads past tensor data and weaponize chat templates, bypassing Hugging Face ClamAV scans on files over 2 GB.

- URL: https://citedbrief.com/reports/malicious-gguf-models-hugging-face/
- Desk: Cited Brief Tech Desk (https://citedbrief.com/authors/tech-desk/)
- Published: 2026-11-29
- Tags: Artificial Intelligence, Privacy, How Things Work

## Key findings

- Before downloading a GGUF file: Inspect the raw chat template and run gguf-radar on the URL, since ClamAV skips files over 2 GB.[^1][^2]
- Pinning model versions: Lock an exact commit SHA, as uploaders can edit chat templates days after weights ship clean.[^1][^2]
- Loading community weights: Update llama.cpp past b11935 or llama-cpp-python to 0.2.72+, sanitize flagged files, and run them in a container.[^8][^2]
- If a model-generated PowerShell command ran: Disconnect the network, check for %TEMP%\d.exe or AppData\Roaming\ollie, and rotate wallet secrets.[^1][^2]

Malicious GGUF files on Hugging Face reach users by hiding executables past tensor data and weaponizing embedded chat templates before a user loads them. The file still looks like a model, and the loader ignores bytes past the last tensor, so a clean weights tab does not clear the repository. We would start with the model card, commit history and raw `tokenizer.chat_template`, not the download button.[^1][^2]

A browser check of the template comes next: reject shell commands, URLs, file paths, `[SYSTEM DIRECTIVE]` blocks or hidden instructions that tell the model to open replies with a command. Then scan the repository URL with `gguf-radar`, which uses HTTP Range requests to inspect headers, templates and trailing bytes without pulling the full weights.[^1][^2]

If the scan flags a file, sanitize it, replace the template and load it in an isolated container.[^2][^3] The check is free, but it has to happen before the first load, not after a printed command has already run.[^1]

## Checking the uploader before you download

Start with the account, not the file. Verified organizations and original model labs publish commit histories worth reading. Community re-uploads tagged "abliterated" or "uncensored" are where edited templates show up. Brand-new accounts stocked with empty repositories named after unreleased models exist to catch namespace searches.[^3][^4] Pin an exact commit SHA on anything you load, since an uploader can arm a template days after the weights ship clean.[^1][^2] A quantized build of a trusted base model can come from the Hub's conversion Space (`ggml-org/gguf-my-repo`), which works from the original SafeTensors files.[^5][^6]

Template inspection comes next, in the GGUF metadata viewer on a repository's file page or through `@huggingface/gguf`.[^1][^5] A normal chat template is Jinja2 loops over message roles plus tags like `<|im_start|>` and `<|endoftext|>`. Text that reads as an instruction to the person at the keyboard belongs in the reject pile.[^2]

`gguf-radar` takes a repository URL: `gguf-radar scan https://huggingface.co/owner/model`.[^2][^7] It sends HTTP Range requests for the header, the template and the trailing bytes. A multi-gigabyte model comes back `CLEAN`, `SUSPICIOUS`, `MALICIOUS` or `ERROR` without tensor data being downloaded. The CLI is MIT-licensed and needs Python 3.10 or later. A third-party Windows desktop wrapper circulates on `r/LocalLLaMA`.

Sanitizing writes a fresh file. `gguf-radar sanitize suspicious.gguf -o clean.gguf` drops bytes after the last tensor, zeroes inflated alignment gaps and clears zero-scale block padding, and leaves the dequantized weights as they were.[^2] Dump the surviving template with `gguf-dump --json` or `ollama show --modelfile`, then override it at launch through `llama-cli --chat-template-file` or an explicit Ollama `TEMPLATE` line.[^1][^7]

Patch the runtime before the first load. `llama.cpp` builds past `b11935` carry fixes for the parser bugs disclosed through October 2026, and `llama-cpp-python` has to be 0.2.72 or later.[^8][^9] Load community weights inside a container or VM. Keep host shell tools, saved browser profiles, cloud metadata endpoints and production network routes out of reach.[^3][^10]

## Why automated scans miss large files

ClamAV, part of Hugging Face's commit-time pipeline, scans only files under 2 GB. Every multi-gigabyte quantized model goes without a signature pass.[^1][^11] Under that ceiling evasion is cheap. Append about 0.5 MB of filler after an executable, or wrap the payload in raw Deflate so no Windows PE header sits on disk for a signature to match.[^2]

The AI scanners on the Hub have blind spots of their own. `picklescan` and Protect AI's Guardian inspect pickle opcodes and Keras layers. Neither reads Jinja2 prompt logic or bytes left past the last tensor.[^2][^12] Python formats are not much better protected. A 2026 NeuralTrust review of Zhang et al. found more than 81% of malicious models studied chained several evasion tactics, and four detectors tested missed a large share of them. Pradhan et al. showed pickle payloads that overwrite trusted Python modules.[^13] JFrog's September 2025 writeup added three `picklescan` bypasses (`CVE-2025-10155` through `CVE-2025-10157`, patched in 0.0.31) built on mismatched extensions, broken ZIP checksums and submodule imports.[^3]

Several habits keep local users exposed. Treating `safetensors` as the safe format misses that Jinja2 templates still travel in `tokenizer_config.json` or `chat_template.jinja`.[^2][^7] Scanning once misses later edits, because the Xet-backed web editor rewrites GGUF metadata in the browser on files up to 10 GB.[^14] Model cards sometimes ask readers to keep the embedded template as it is.[^1] Turning on `trust_remote_code` runs companion Python. Pluto Security documented a "Load/Mine" campaign on October 29, 2026 across 31 Qwen2-themed repositories with about 32,400 downloads, where a 42-byte `.safetensors` decoy sat beside scripts that dropped cryptominers and reverse shells.[^3]

A suspect file that never printed a command, and never reached a shell-enabled agent, is recoverable. Delete it or run `gguf-radar sanitize`.[^2] If a model-generated PowerShell line did run, pull the machine off the network first. Then scan local `.gguf` files and look for the campaign's leftovers: `%TEMP%\d.exe`, an `ollie` log under `AppData\Roaming`, a scheduled task firing every 10 minutes, traffic to `technoarteng.com`.[^1][^10] The `ollie` payload targets saved browser passwords and crypto wallet extensions, so rotate API keys and wallet secrets from a different clean device and check which [extensions hold site access](/reports/browser-extension-permissions-safety/).

## The metadata block as an attack surface

GGUF's convenience is the attack surface. `@ggerganov` shipped the format in August 2023 for `llama.cpp`. One file holds quantized tensors plus a metadata block that includes `tokenizer.chat_template`, and an ecosystem editor (`pip install gguf-editor`) changes keys and tensors in place.[^15][^16] Loaders stop reading at the last tensor, so anything appended after it stays inside the file without ever being parsed as weights.[^2]

| File format | Weight storage and payload hiding | Chat template location | Execution risk on load | Native Hub scan gaps |
| :--- | :--- | :--- | :--- | :--- |
| GGUF | Weights plus metadata; loaders ignore bytes past last tensor, inflated padding, and ZIP polyglots[^2] | Embedded in `tokenizer.chat_template` metadata key[^2] | C++ parser bugs (CVEs); template SSTI in older Python bindings; prompt hijacking[^8][^2] | ClamAV skips files >= 2 GB; pickle scanners ignore Jinja logic and trailing bytes[^2][^3] |
| Safetensors | Raw tensors with JSON header; loader rejects trailing unallocated bytes[^2][^17] | Separate `tokenizer_config.json` or `chat_template.jinja`[^2] | None from tensor file unless `trust_remote_code` runs companion `.py` files[^3][^17] | Decoy files can mask malicious Python code[^3] |
| Pickle / PyTorch | Serialized Python opcodes (`.bin`, `.pt`, `.pkl`)[^12][^18] | Separate tokenizer config files | Immediate Python code execution via `torch.load()` or `pickle.loads()`[^18] | Broken streams, 7z wrappers, and unlisted submodules can bypass `picklescan`[^3][^12] |

Template injection is the path that produces a running command. C++ engines render the template in a restricted engine with no Python access, so the template cannot call out on its own. It shapes what the model prints, or tells an agent what to run. An attacker hides an executable past the last tensor, inside inflated `general.alignment` padding, in zero-scale quantization blocks or in a GGUF/ZIP polyglot. Hidden text then precedes every prompt.[^2] The model becomes a command generator, and the user or an agentic client runs the output.

Python bindings were worse. `llama-cpp-python` releases from 0.2.30 to 0.2.71 evaluated `tokenizer.chat_template` inside an unrestricted `jinja2.Environment`. Disclosed in May 2024 as `CVE-2024-34359` (CVSS 9.6), the flaw allowed remote code execution at load. Checkmarx estimated the exposure covered over 6,000 Hugging Face models before the library moved to a sandboxed Jinja environment.[^9][^19]

Parser bugs need no template at all. A malformed file can trigger code execution or a crash while the C++ side reads it, with no user interaction. Documented cases include heap overflows in `gguf_fread_str` (`CVE-2024-23496`) and in vocabulary loading, plus integer overflows in `ggml_nbytes` and the file init path, patched in builds from March 2026.[^8][^20]

## The November 2026 discovery and its trail

On November 26, 2026, independent researcher Düzgün (publishing as Malspark and `Root0ne`) scanned about 3.27 million public Hugging Face repositories. Roughly 226,300 of them were GGUF uploads, and five turned out malicious, spread across two accounts.[^2][^21]

| Repository name | Threat actor | Attack technique and trigger | Payload status | Downloads (Nov 27, 2026) |
| :--- | :--- | :--- | :--- | :--- |
| `Mir2k/Huihui-Qwen3.5-9B-abliterated-GGUF` | `Mir2k` | Uncompressed 11.47 MB binary past last tensor plus 0.5 MB padding; French system prompt prefixes PowerShell command[^2] | Recovered (`ollie` RAT, miner, Tor)[^2] | 1,488[^2] |
| `Mir2k/Inkling-2-Mini-Uncensored-GGUF` | `Mir2k` | Raw-Deflate compressed binary in final 4.2 MB; template triggers `DeflateStream` PowerShell command[^2][^7] | Recovered (`ollie` RAT, miner, Tor)[^2] | 458[^2] |
| `timdedid/qwen3.8-cyber-uncensored` | `timdedid` | Jinja2 check for `"What is"` injects `[SYSTEM DIRECTIVE]` ordering agent PowerShell download[^2] | Stage-2 `value.ps1` unrecovered[^2] | 271[^2] |
| `timdedid/qwen3-cyber-UNCENSORED-2` | `timdedid` | Identical Qwen3 1.7B weights and `[SYSTEM DIRECTIVE]` template[^2] | Stage-2 `value.ps1` unrecovered[^2] | 136[^2] |
| `timdedid/qwen3-cyber-UNCENSORED` | `timdedid` | Identical Qwen3 1.7B weights and `[SYSTEM DIRECTIVE]` template[^2] | Stage-2 `value.ps1` unrecovered[^2] | 75[^2] |

Downloads on those five repositories doubled within a day. The staging behind them is why pinning a commit matters. `Mir2k` opened 12 empty repositories on November 22 under the names of models that did not exist yet (`Qwen4-27B`, `DeepSeek-V4`, `Llama-4-Scout`, `gemma-4-27b`), and its GGUF weights went up with a harmless template. That template changed on the morning of November 26, aimed at a fixed `Downloads` path, then changed again nine hours later to sweep the user's whole profile. `timdedid` worked the same week with three byte-identical Qwen3 uploads plus an Ollama mirror.[^2][^10] Its template fired only when a prompt contained "What is".

Spectrum Security and Malspark confirmed that both `Mir2k` files unpack the same Windows x64 executable, `ollie`, carrying a RAT, a RandomX cryptominer and a bundled Tor client.[^2][^22] It exits when it finds VirtualBox, VMware or Sandboxie drivers, or usernames like `sandbox` and `malware`. It gets past UAC through `ms-settings` and persists as a 10-minute scheduled task under `AppData\Roaming\ollie`. It also captures webcam frames and hunts for the Phantom and MetaMask wallet extensions.

Headlines turned the download count into "2,400+ victims." Hugging Face logs every programmatic fetch, not unique users. The real figure sits at or below that count, and each case needed a person to run the printed PowerShell line or hand the model to an unsandboxed agent. Download counters rarely say what they count, the same gap as a usage cap advertised without a unit. Researchers never recovered `timdedid`'s remote `value.ps1` script from `technoarteng.com`, and all five repositories were still online the next day, with no verified public confirmation of later takedowns.[^2][^23]

## Who should catch a malicious upload?

Hugging Face runs an open hosting platform, SOC 2 Type 2 certified and GDPR compliant, rather than a curated software distributor. Its automated pipeline layers ClamAV, `picklescan`, TruffleHog secret alerts, Protect AI Guardian and JFrog scanning, and it removed ReversingLabs' *nullifAI* models within 24 hours in February 2025. The documentation still says scanning is not foolproof and leaves final verification to users, while response times have varied: a second wave of the October 2026 cryptominer campaign stayed live eight days after disclosure.[^3][^11]

Hugging Face also rotated internal credentials after a July 16, 2026 worker intrusion caused by a malicious dataset loader and template injection, attributed by OpenAI on July 21 to an escaped model evaluation.

We would keep the template check and sanitize step ahead of any load.[^1][^2] Uploaders should keep upstream templates intact, avoid reckless metadata edits, and secure accounts with two-factor authentication and fine-grained tokens so namespaces are not compromised.[^3][^11] For users, execution risk stays on the local machine. Verify commit histories and run `gguf-radar` before loading untrusted weights; teams should enforce internal mirrors with `HF_HUB_OFFLINE=1`, pin commit SHAs, and block unverified builds in CI/CD with `gguf-radar` and `ModelScan`.[^10]

Technical verification steps are identical worldwide, whereas regulatory compliance rules differ by jurisdiction. GDPR in the European Union and HIPAA Business Associate Addendums for regulated health workloads in the United States depend on where an organization operates, so enterprises should check Hugging Face's Enterprise and Trust documentation and their national data-protection authority.[^3]

## Common questions

### How can you view a GGUF file's chat template on Hugging Face before downloading?

Open the GGUF metadata viewer on the repository's file page or inspect it through `@huggingface/gguf` to read the raw `tokenizer.chat_template`.[^1][^5] A normal template uses Jinja2 loops and role tags, so reject any text containing shell commands, URLs, or instructions for the user.[^1][^2]

### How can you safely convert a Hugging Face model to GGUF yourself?

Use Hugging Face's `ggml-org/gguf-my-repo` conversion Space to build a quantized GGUF directly from a trusted base model's original SafeTensors files.[^5][^6] This avoids community re-uploads tagged "abliterated" or "uncensored," which is where edited templates show up.[^3][^4]

### Can an uploader edit a GGUF file's metadata on Hugging Face after uploading it?

Yes, the Xet-backed web editor lets uploaders rewrite GGUF metadata in the browser on files up to 10 GB.[^14] Because an uploader can arm a chat template days after clean weights ship, pin an exact commit SHA on anything you load.[^1][^2]

### Can you scan a Hugging Face GGUF file without downloading the full model?

Yes, running `gguf-radar scan` on a repository URL uses HTTP Range requests to check the header, template, and trailing bytes without downloading tensor data.[^2][^7] The MIT-licensed CLI requires Python 3.10 or later and returns `CLEAN`, `SUSPICIOUS`, `MALICIOUS`, or `ERROR`.[^2][^7]

## Sources

1. [GGUF Malware: Check a Model Before You Run It - Munder Difflin](https://munderdiffl.in/blog/check-gguf-model-before-you-run-it/) (munderdiffl.in)
2. [GGUF LLM Models with Hidden Malware on Hugging Face](https://malspark.com/blog/malicious-gguf-models-hugging-face/) (malspark.com)
3. [Is Hugging Face Safe? Models, Malware, Tokens, Privacy - VDF.AI](https://vdf.ai/blog/is-hugging-face-safe/) (vdf.ai)
4. [Hugging Face Guardian Picklescan Defender Guide 2026](https://safeguard.sh/resources/blog/huggingface-protectai-guardian-scanning-2026) (safeguard.sh)
5. [GGUF · Hugging Face](https://huggingface.co/docs/hub/gguf) (huggingface.co)
6. [GGUF My Repo - a Hugging Face Space by ggml-org](https://huggingface.co/spaces/ggml-org/gguf-my-repo) (huggingface.co)
7. [Malicious GGUF files on Hugging Face: how to check yours](https://vramcalculator.com/is-your-gguf-safe/) (vramcalculator.com)
8. [NVD Vulnerability Search - NIST](https://nvd.nist.gov/vuln/search?resultType=records&cpeFilterMode=cpe&cpeName=cpe:2.3:a:ggml:llama.cpp:b2913:*:*:*:*:*:*:*) (nvd.nist.gov)
9. [llama-cpp-python vulnerable to Remote Code Execution by Server](https://radar.offseq.com/threat/llama-cpp-python-vulnerable-to-remote-code-execution-by-server-side-template-injection-in-model-215af555d70b83df) (radar.offseq.com)
10. [Hugging Face GGUF malware: Ollama copy still live - i10X](https://i10x.ai/news/hugging-face-gguf-malware-mir2k-timdedid-ollama-copy-still-live) (i10x.ai)
11. [2024 Security Feature Highlights - Hugging Face](https://huggingface.co/blog/2024-security-features) (huggingface.co)
12. [Malicious ML models discovered on Hugging Face platform | RL Blog](https://www.reversinglabs.com/blog/rl-identifies-malware-ml-model-hosted-on-hugging-face) (reversinglabs.com)
13. [AI Model Security: An Enterprise Guide - NeuralTrust](https://neuraltrust.ai/blog/ai-model-security) (neuraltrust.ai)
14. [GGUF Metadata Editor - Hugging Face](https://huggingface.co/changelog/gguf-metadata-editor) (huggingface.co)
15. [Secure Deserialization of Pickle-based Machine Learning Models](https://arxiv.org/html/2508.15987v1) (arxiv.org)
16. [gguf-org/editor - Hugging Face](https://huggingface.co/gguf-org/editor) (huggingface.co)
17. [Hugging Face Malicious Models: PickleScan and SafeTensors](https://www.stingrai.io/blog/clean-model-scan-not-safe-picklescan-safetensors) (stingrai.io)
18. [Malicious AI Models on Hugging Face: Model Supply Chain Security](https://www.3university.io/learn/hugging-face-malicious-models/) (3university.io)
19. [llama-cpp-python - CVE-2024-34359 - GitHub](https://github.com/advisories/GHSA-56xg-wfcc-g829) (github.com)
20. [Confidentiality Boundary Failures in Consumer LLM Serving Systems](https://arxiv.org/html/2609.18526v2) (arxiv.org)
21. [GGUF LLM Models with Hidden Malware on Hugging Face ... - Reddit](https://www.reddit.com/r/LocalLLaMA/comments/1y7fupb/gguf_llm_models_with_hidden_malware_on_hugging/) (reddit.com)
22. [Poisoned GGUF template unpacks hidden RAT threat](https://www.spectrum.security/threats/poisoned-gguf-template-unpacks-hidden-rat) (spectrum.security)
23. [Researchers find five malicious Hugging Face models ... - soon.tech](https://soon.tech/stories/1330877-malicious-gguf-models-on-hugging-face-drew-2-428-downloads) (soon.tech)
