r/LocalLLaMA • u/pmttyji • 3d ago
Discussion GGUF LLM Models with Hidden Malware on Hugging Face Reached 2400+ Victims
https://malspark.com/blog/malicious-gguf-models-hugging-face/GGUF LLM Models with Hidden Malware on Hugging Face Reached 2400+ Victims. Scanning 3.27 million public model repositories, I found 5 GGUF models with hidden malware, downloaded more than 2400 times. A GGUF file's header says where the model weights end, and loaders read nothing beyond that point, so an attacker can append an executable there and the model still works normally. The chat template, a small program in the GGUF metadata, can then add hidden instructions, such as making the model print a command that pulls those bytes out of the file and runs them. I also released GGUF Radar, an open-source tool that detects and removes these payloads. - Düzgün / Root0ne
•
u/WithoutReason1729 3d ago
Your post is getting popular and we just featured it on our Discord! Come check it out!
You've also been given a special flair for your contribution. We appreciate your post!
Stylome classified this post's text as human-written. View analysis Learn ^more
I am a bot and this action was performed automatically.
157
u/Keanne1021 3d ago
Hi. Care to share some info about those 5 malware infected ggufs?
129
u/simplir 3d ago edited 3d ago
Appreciate you sharing this actually, I didn't know that was possible. Always thought the risk is the harness and the GGUF is only the weights.
133
u/ironborn123 3d ago
even when there is no executable a model can be trained to trigger a tool call or an external http request based on the evolving context window in a chat.
your data, your ip, passwords, etc can thus reach and be logged by an external entity even though you were using an open source model on your own machine with no external malicious scripts. the maliciousness is baked into the model weights itself.
maybe you dont care about all this. but if you do then use only earlier era models which are limited, or block net access on the machine running your model, or maybe the most realistic use open models only from reputed providers. we all know who the reputed ones are and who are not so I dont need to specify the lists.
27
u/WhoRoger 3d ago
Why does everything have to suck these days? This is so tiring.
13
u/henbone11 3d ago
I just swept 110 models that I have downloaded on 3 different boxes and it throws A LOT of false alarms "zero scale blocks" and "new template tags". There are a shit ton of custom engines and models out there, with new hitting by the minute. Not sure how long a tag has to exist for it to not get flagged as suspicious, but that might be something to look at. Thank you for the tool, much appreciated.
https://drive.google.com/file/d/1bPNK_1tOGzWU2QyWLmUkaJSexJbKl2_d/view?usp=drive_link
24
u/a_beautiful_rhind 3d ago
So it's not some RCE from GGUF itself, it's tampered metadata, mainly in the chat template?
And all the non tool call compromises had code for windows. I'd say we're still pretty safe. Creative attack vector though.
10
u/Individual_Peach533 3d ago
I always run local models via bwrap out of security practice, seems like my paranoia is justified
8
u/PhotographyBanzai 3d ago
I speculated on the idea of LLMs being trained to spy on users and/or covertly take actions. Well dang.
21
u/sleight42 3d ago
<goldblum>Well, there it is.</goldblum>
43
u/volleyneo 3d ago
But no it cannot be! Some users here said so and downvoted me to hell when pointing this out, in some security advisory article some time ago. It can't be guys, world is made of candy
15
u/Bulky-Condition-3490 3d ago
Thank you, Gemini is sorting this out now for my setup . I had near misses apparently but no compromise. Hugging face should add automated detections for this stuff
35
u/phatouls 3d ago
5 out of 3.27 million repos have Malware. Good to know. Thought it would be worse with all the fear mongering out there.
4
u/zante2033 3d ago edited 3d ago
Is this applicable to models run on studio server without agentic tools?
4
u/MerePotato 3d ago
I wonder how many are actual victims vs scraper bots
7
u/krileon 3d ago
If it's not official or Unsloth I ain't downloading it. All those look like random nobodies why is anyone downloading from random nobodies.
3
u/mycall 3d ago
Huggingface needs to own this and keep improving it. It is all on them here.
3
u/TheMericanIdiot 3d ago
Which models?
3
u/iboneyandivory 3d ago edited 3d ago
Huihui-Qwen3.5-9B-abliterated-GGUF is quoted as one of the effected models in the article.
Yikes. The gguf-radar security scanner (that I belated discovered only today) has questions about this particular model variant:
Huihui-Qwen3-Coder-30B-A3B-Instruct-abliterated-Q3_K_S.gguf
I downloaded it .. 2 days ago? and ran it locally once or twice.
I've quarantined the file and am not running it again until I have a better understanding of if it's compromised.
Here's what know so far:
What pre-scanning should we be doing before running a model? Clearly, just finding it HuggingFace isn't going to be sufficient, moving forward.
FTA "Static analysis of its strings, imports and code shows what it does once started. It first looks for VirtualBox, VMware and Sandboxie drivers and for usernames such as
sandbox,malwareandtest, and exits if it finds them. On a real machine it settles in: a scheduled task runs it every 10 minutes with highest privileges, two watchdog processes keep it alive, theStartupApprovedregistry keys re-enable it, and its process is marked as critical, so ending it crashes Windows."I'll be running everything in a container now.
Update: I checked the exact file's Hugging Face commit history. It appears to have been uploaded August 3, 2025, with no subsequent modifications recorded for that particular GGUF.
I also gen'ed the SHA-256 of my quarantined copy and compared it with Hugging Face's (year old) published hash. They match exactly:
406bfee0a79342aa81dbe6a12f23ef75e191dff40e62e0f4f7dae2be3402b67f
GGUF Radar continues to flag the file as SUSPICIOUS, reporting 2,176 zero-scale blocks that don't resemble normal quantizer output.
I wonder if there is an explaination for those blocks. In any case I feel I've dodged a bullet regarding this model, for this latest HF exploit.
5
u/Cool-Chemical-5629 3d ago
Am I the only one who thinks about how this method could be used positively, like bundling a small tool the model could use to enhance its output? 😂
8
u/unknown-one 3d ago
download only official releases
2
u/fallingdowndizzyvr 3d ago
I just run everything on separate machines with their own little network and their own separate internet access. There's no way I would download and run a model on my real machines, say with my passwords, on my real subnet. That's crazy.
2
u/QuantumFascist 3d ago
Isnt it impossible for gguf files to have malware? what am I missing? Thought it was just checkpoints/weight. Also is there a list/way to check if I have a 'bad' gguf?
3
u/FinBenton 3d ago
Interesting, I guess you wouldnt even need all that metadata stuff, you could just finetune or weight edit to make the model do a malicious thing upon trigger or something like that too.
2
u/idocne 3d ago
The part worth noticing is that the payload sits after the end of the weights, so the file itself is inert. Nothing runs just by loading the model. According to the write-up, the chat template has to talk the model into printing a command that extracts and executes those bytes. So the real exposure is any setup where model output gets piped into a shell or an agent with tool access. If your frontend only displays text, you're mostly fine. Either way, treat third-party chat templates like code you're about to run, and hash-check files against the original publisher.
2
u/Citadel_Employee 3d ago
Can someone explain like I’m dumb, why do most LLMs come in gguf files. Why can’t they come in safetensor files like diffusion models? Or can they?
1
u/mrdevlar 3d ago
Do thing.
Make no mistakes.
Don't hack me bro.
1
u/New_Guitar_9121 3d ago
You should always set up an agent download gate!
1
u/69420trashpanda69420 3d ago
This is a plant
1
u/Ithinkyouareabot 3d ago
They need to implement your tool into Huggingface
1
u/81_satellites 3d ago
Thanks for your work on this, and for sharing it.
1
u/leanXORmean_stack 3d ago
If you must run these ggufs, dump the metadata and chat template with gguf-dump and load the model in a network-isolated container with a patched llama.cpp. The biggest risk is the software that runs the models so watch for unexpected processes or connections and don't give it tools until it behaves normally.
1
u/Mitchy103 3d ago
ouch! Thanks for rising awarness
1
u/33rpm_neutron_star 2d ago
Feeling pretty good about my new localllm setup.
Still have a ton to learn, including managing the network access of the harness, but having everything in a pretty "locked down" environment seemed like an eminently good idea.
1
u/TheGlobinKing 2d ago
I tried gguf-radar on a "trusted" user's quants: https://huggingface.co/TrevorJS/gemma-4-E4B-it-uncensored-GGUF/tree/main
It said:
Chat template findings (risk=55/100, sha256=55572b8d3c834204...): [HIGH] conditional_logic_bomb: Conditional branch inspects user/tool content for trigger literal(s): ['tool_responses']
Maybe a false positive / template fix or something?
1
u/mickeyknoxnbk 3d ago
Is there a no-malware skill yet?
1
u/djipdjip 3d ago
Curious, could $LARGEVENDOR create malicious models in order to destroy or sabotage the local LLM concept?
1
u/Historical-Camera972 2d ago
Maybe I'm just paranoid, but I've personally accepted that all local models for the past 18 months have backdoor malware in them.
Do people really trust them? hahahahaha, naive.
-2
u/m_adduci 3d ago
I wonder if there's a way to detect if OpenAI or Anthropic do the same, is there any kind of valid proxy that scans the responses before those do anything?
4
u/[deleted] 3d ago
[removed] — view removed comment