Poisoned GGUF template unpacks hidden RAT
New AI TTP: Attackers armed GGUF models on Hugging Face with chat templates that make the model print the command unpacking a RAT hidden in the file
Posted · Spectrum Delta Research Team
Summary
Attackers published malicious GGUF models on Hugging Face whose chat templates make every reply start with a command that unpacks and runs a Windows RAT hidden inside the model file itself, a procedure found in the wild by researcher Duzgun (A/1). Scanning 3,273,389 public repositories on 26 November, Malspark recovered Mir2k models that append a RAT named ollie after the last tensor, where GGUF loaders never read, and later swap the chat template so replies print a command carving those bytes into %TEMP%\d.exe; actor timdedid armed templates that direct AI agents to download and run a remote script. The five repositories drew 2,428 downloads by 27 November; downloads do not establish infections. The boundary is new: Delta Tradecraft's model-artifact object (DT-AAG1-AI-021) covers artifacts that execute code when loaded, and its shell-tool object (DT-AAG1-AI-023) covers agents steered at runtime, but neither covers a template inside a published model inducing execution of hidden bytes. Observability is CONDITIONAL: the printed command appears only where chat transcripts or agent tool-call capture exist; endpoint telemetry can show the unpacking but not that the model induced it.
Breakdown
Technical exposure
- GGUF model with a chat template, loaded locally from Hugging Face
- User or AI agent executes the command a model reply prints
- GGUF loaders ignore bytes after the last tensor in the file
Adversary
Mir2k and timdedid (unattributed Hugging Face accounts) · identified by Malspark (A/1)
Procedures (1)
Model reply prints command unpacking RAT hidden in its GGUF file
Logs
- EDR process events · powershell.exe or shell child of a local model client or agent CLI reading a byte range from a .gguf file into %TEMP%\d.exe then executing it (Sysmon 1, 3, 11)
- Agent tool-call telemetry · Captured shell-tool command text reading bytes from a local .gguf model or downloading and running a .ps1 after a hidden template directive; requires content capture
Detectors
- gguf-radar · Flags chat templates with hidden directives and executable bytes after the last tensor in GGUF filesNot built-in
Sources
- A/1Malspark: GGUF LLM Models with Hidden Malware on Hugging Face Reached 2400+ Victims
- B/1GitHub: Root0ne/gguf-radar
Grades are source reliability (A–F) and information credibility (1–6).
Questions, detections or sightings of Poisoned GGUF template unpacks hidden RAT? Bring them to the community.