Glad I have a stupidly paranoid setup for llama-cpp where I run it in a vm only able to be connected to. not that this is the only possible issues and stuff like malicious models quantized models (IE models that are secretly trained to do something malicious but posed as a simple quantization) is another issue people sleep on. I think securing agents is a nightmare, but those who think about them will be ahead.
I'm also as paranoid. The security model around LLMs is a joke. Some of the more popular ones (like Pi) don't even have a permission system - they just assume it should be able to do whatever the user can do.
Trying to set up a container or VM with GPU passthrough on Windows is a nightmare. It's insane to me that nobody has come up with something better. If not for the AI stuff, but it would make me feel a whole lot better about downloading mods for various games if I knew that was somehow sandboxed.
Never done it one windows, but would it be worth just having your windows system as a guest vm on a linux host. I have ran that way for games for a long time, it beats wine by a mile once you set-up vfio. On VM's for ai inference their is one caveat around PCI atomics if you have an AMD cards. I have worked around this and can post stuff if you or any one needs to know, you can use virtually everything else and nvidia works fine (not tried intel but probably works fine.)
Qubes OS makes for a natural host in your case. I think it does the job splendidly, running agents in ephemeral instances which save nothing on termination (unless I qvm-copy it off). Offline or tunneled connections are easily enforced. It's an easy and relaxing host environment for running this stuff.
Yeah I rolled my own with libvirt as I wanted to use virtiofs and such (I know less secure). My current solution works for me and I am thinking about building it out into a proper project. You can use libvirt a lot like Qubes with it and their is a lot of niceties I would like to add to it that basically an analogous domain to Xen's dom0 to exists. I have been paranoid to use frontier AI to finish the project as I don't want to leak all the cool things I want to do but at the same time I have not finished it lol but now really is the time. Maybe I should just release it and ship what I have already.
Downloading and executing gigabyte-sized blobs would’ve been unthinkable in the past. Combine that with the size/popularity of a centralized, “trusted” (even thought it’s really not, it’s just user uploads after all) platform for distribution and it was only a matter of time until this would be exploited.
What does this have to do with Linux drivers? Most of them are open source, so no blobs at all. Some require firmware blobs, but those are also not from unknown sources.
General, if you have to, you download those drivers from the manufacturers. Not saying those never get compromised, but it's different from getting a blob from some random author.
Depends on what you do. Have definetly needed to get a userspace part of a driver, with a kernel patch to give the interface from a manufacturer before.
Same. I've had hardware that was new enough when I bought it that building the drivers from the chipset manufacturer was the only way to get it working (at least on my preferred distro). I think the last time I had to do this, it was a Realtek NIC for a desktop I built around 2020.
I _have_ had to pull in a Linux driver from the manufacturer's repo (Intel in this case) and squint my eyes hard figuring out how to make it compatible with my kernel. Hooray, robotics. I don't recommend it.
Good point, the latter, which is why I failed to consider it. I guess most (?) games people install and run are from a reputable publisher or at least source where there’s been sufficiently many downloads to assume it’s safe?
Not the author of previous post but my gaming machine is treated as an untrusted machine. I run it as a game console on a separate network NATed behind its own router on which I only opened port forwarding in order to connect to it via moonlight and to llama.cpp because yed, it is also the machine I use to run models, on a different linux install/hard drive.
There is no way I would type any password other than my steam and gog passwords on it and I definitely do not save any payment details on these accounts. I actually purchase the games from a browser on another machine and only do the download on the gaming one.
> If you're just talking about blobs, I don't know anyone who's paranoid about downloading a movie...
But you don’t execute a movie on some “runtime”, you just read data from it using a well-defined spec + tested parser. The scope of what can happen is much more narrow.
In the end I agree with you, it’s an attack vector and people need to be aware of it.
> you just read data from it using a well-defined spec + tested parser.
there's some new RCE on crafted video files (or even poor old jpeg) every other month. Also you don't know how many seemingly basic file format end up having some accidentally (or mor often, voluntarily) turing complete language coming along. .mkv can embed custom fonts for subtitles, and TTF can execute arbitrary programs in its interpreter language for font hinting. So anyone sending you video files can technically execute arbitrary computations [1] in your media player, by design.
Some of the ebook jailbreaks use local script interpretation as a vulnerability path triggered by malicious epubs
The problem is very real and very much in the wild and the size of the file has little to do with how serious the vulnerability can hide in an otherwise innocuous file type
Usually, the largest attack surface is where the complexity is, i.e. in the codec. If a codec runs in the same security domain as the player, then RCE in the codec has the same implications as RCE in the player.
What no there was some weird problem with rendering custom fonts for the subtitles. Nothing to do with the codec decoding video. And then a thread full of people talking about arbitrary code execution in random things like markeddown files or open source Excel viewers, none of which is me downloading a video and watching it in VLC.
There was an update to Obsidian recently where they changed the library used to render mermaid diagrams. The notes said something about the original library being able to execute arbitrary code, where the new library doesn't. A while ago Obsidian stopped rendering mermaid diagrams automatically, likely due to that behaviour.
ZeroQuarry found and reported code execution vulnerabilities in the Tasks and Excalidraw plugin: 2 of the most popular plugins. (Both have since been fixed.) Haven't scanned many again recently: it was earlier on in the days when I was testing the technology as I was building the product by trying to scan some popular tools I used.
But my bigger point is that the filesize thing is a red herring. I guess a more classic example: a lot of applications/servers used to get pwned from XML with XXEs until XML parsers started (usually) getting better at not allowing XXE (which is part of the XML spec -- so actively ignoring the spec for safety reasons!). XMLs still show up everywhere (sitemaps, SVGs, etc) so a popular program could pop up any time that causes code execution by loading an SVG image.
I think the attack here is new/novel, but it's not really because of "big file, downloaded arbitrarily = bad idea." The actual payload here is small. As with the ereaders or obsidian plugins or XML parsers, the problem is that the wrapper is doing unsafe things, and those unsafe things have grown to be kind of expected (e.g. that your favorite LLM-based tool of choice is supposed to be able to execute arbitrary code)
At one point, Pegasus was able to be installed on your phone if someone simply sent you a text with a PDF disguised a GIF. Zero-click exploit, nothing you could do about it. We try to design systems with security-in-depth for a reason. You should never treat data as inert.
Hm. Obviously I get the point you’re making, but something like Pegasus doesn’t really feel comparable. After all, I don’t think compromised/evil GGUFs on Hugging Face also require the attacker to spend one or several zero-days on an otherwise sandboxed system… you just willingly execute something you’ve downloaded yourself, on a regular ungated machine.
Gigabyte sized blobs get downloaded all the time. Movie and software piracy have been a thing forever. Torrenting them is not uncommon. As are linux ISOs.
I have a piece of software on my computer that with one click downloads and executes multi gigabyte files called Steam.
The idea that it's unthinkable is frankly wild to read.
Good point, unthinkable was definitely too strong of a word choice. But, staying in the analogy, you’re not launching forks of popular games by unknown randoms on Steam, rather the “known good” original games, I guess? And even then, from what I’ve read in recent years about mandatory kernel-level anticheats, one might argue it’s not so dissimilar after all.
Yes, people pirating games have for long time installed NoCD cracks and stuff from dubious sources. It seems these days "repacks" are a popular thing now ie. the whole game wrapped in a custom compressed installer (instead of ye olden way of downloading an bit-exact .iso of a retail disc).
I agree it was unthinkable. We spent a lot of effort teaching a couple generations not to execute arbitrary programs from random sources. But that changed in the 2010s and onward. Now you're considered very weird and wrong if you don't automatically execute all random programs from unknown third party sources. People will even say it's your own faul and you deserve it if things don't work.
That said, barring the rare exploits in the gguf parsers, etc, running inference on a random LLM model is actually not dangerous at all. It only becomes dangerous when you run it in a harness agentically with ability to interpret the models' text output as system commands.
No amount of system/user/role jinja template stuff can cause a model to be dangerous if you just run it in, say, llama-server and talk to it via the chat interface.
IMO, any system that was exploited by this was already insecure. It's not exploiting bugs in the inference engine or attempting any kind of sandbox escape. Here the exploit was in the chat template, but it's possible to encode the same thing directly in the weights. Unless the model is truly Open Source (not just open weight), there's no way to know what malicious instructions might be encoded in the weights. The only defense is to sandbox the agent sufficiently strongly that it can't do harm no matter what tokens it generates. In such a sandbox, it doesn't matter that the payload was stored directly in the GGUF file, because it won't be able to do anything with it anyway.
The discussion was about sandboxing the agents. Here's a simple and secure sandbox:
exit(1);
Use diverse double compilation to verify that your compiler compiled it correctly.
More usefully, LLM output can be restricted to a form that can be verified with deterministic tools, e.g. Lean. Allowing agents access to sufficient resources that running a malicious payload can cause harm is always a mistake, regardless of whether a payload was actually hidden in the GGUF file or not.
Is my understanding correct that the malware was entirely in a metadata file that injected hidden prompts rather than the model weights being poisoned in some way? I assume this is way cheaper to execute. On the surface it also seems way cheaper to catch. Is it less detectable than e.g. poisoning a models weights or am I missing something here?
Also everyone can see metadata (incl. chat template) right in huggingface UI.
A small novelty here is that arbitrary data can be appended to gguf and it is still considered as valid. I wonder if this is a legitimate design or an oversight.
If I read this correctly the attack is executed by adding certain text (which is a command to execute some PowerShell (?)) to the output/response. So nothing will happen if you use the GGUF in chat mode.
Even if you execute the agent, I'm not sure the attack will work in all the cases. Is the syntax used will work in 100% cases when receiving LLM will read this instruction?
Also, it means that you need to isolate the agent, not the inference engine which in and of itself doesn't execute any instructions.
I'm more concerned about very subtle backdoors hidden deep in the model weights. How hard would it be for a model to recognize when it's being used by an agent on a sensitive system and run commands install malware, exfiltrate data, insert a backdoor in code, etc?
The actual neural network is buried deep in a bunch of processing layers that actively prevent that from happening, so you'd have to mess with those layers too, at which point it would be much easier to have the additional layers perform the nefarious activity than to try and get a neural network to only do something under certain conditions but then put a full effort into it.
There was a research paper posted on HN a few months ago which showed that surprisingly small tweaks to the weights are required to get the model start inserting malicious code. And I don't see how that would be easily detected (other than finding the said malicious code in the output of course).
Is it surprising that a large unchecked distribution network is used to distribute malware? No.
Is it surprising that it’s such a small scale? Yes. Which means we are early on and haven’t seen history repeat itself yet. These were no-name models but soon it will be name-brand models and it will start tricking more and more people.
HF should get ahead of this now and implement stronger scanning and protections while it’s still not a large scale problem.
llama.cpp (and other tools) should perform a basic metadata sanity check.
(It took me two minuted to create a python script for doing this. So it's not hard to do.)
Also, only ever use trusted sources (like unsloth, etc).
Good reminder to all that a download on hf means a model invocation/load, not a literal download. So this might very well have been 24 users calling Automodel 100 times or a single user calling it 2400 times.
They’re indistinguishable. A GET request to a config.json or other metadata artifact counts as a download. In practice, every time you do something like AutoModel.from_pretrained, your machine will perform this GET request to see if the revision is still up to date. If not, it will download the model.
I have an org with quite a bit of downloads, and even I, as the owner, can’t see which ones are real downloads.
I personally prefer to create the GGUF files locally after downloading official safetensor weights. One advantage to this is that it makes it easier to experiment with different quantizations.
what I want to know is why isn't HF and anyplace else that hosts model files using gguf-radar on all uploads? this appears to be a simple thing to automate. and if it says something is wrong quarantine the upload until a human looks over the report, since it does have a chance of false positives.
This is a fine article, but if there’s truly only 5 out of 3273389 that are malicious that’s an incredibly low number. I’d bet there’s more malicious google ads people click on every day than use these models.
It's useful for people to know the models can do this. Most people think the models are just collections of weights. That said, understanding the attack vector here, it makes a lot of sense why detecting these things is hard.
This is basically why I am not a fan of infernix or ninfer(-all) or all the other less mature projects that offer lots of performance tied to bespoke model files. The executable GH releases and builds are (at least in the case of actual GH builds) likely fine, and can be built manaually just to be sure, but a massive mystery blob on HF can contain anything, and inspecting something more arcane than plain old gguf is a challenge.
Of course it's 5 random abliterated models. Glad people are paying attention to this, and I hope people start paying more attention to attack vectors like this. But it seems nearly insignificant at the scale reported. I would t be surprised if there were more sophisticated exploits sitting on hf today.
I had no idea this was even possible, I thought that the model files were strictly containers for weights and tensors. Now I understand why 'safetensor' format is called that. It feels like ancient history from when people used self-unpacking compression formats to deliver malware payloads...
I really appreciate the effort behind safetensors, but I think in this case it wouldn’t help.
> models in the Safetensors and PyTorch formats carry the same kind of template in a separate file, usually tokenizer_config.json or chat_template.jinja, so this half of the method applies to them too
Lots of words to just explain this simple thing here.
The GUFF's jinja template can be used to suppress your system prompt conditionally or append or modify it. Binary blobs or malicious code can be packed with the model to be written and executed.
Shenanigans can occur through just markdown output if it can render anything remote. Data exfiltration through uri://domain.tld/collector.ext?query=<all-your-data-in-context-belongs-to-hacker>
Having your inference isolated is great and all, but it's not going to protect you from your model having some side channel to Internet access in this scenario.
> The attacks found in this study do not need to escape that engine. They use ordinary template logic to add text to the conversation, and that text never appears in the chat window. In the timdedid models, a trigger phrase in the user's message makes the template insert a fake [SYSTEM DIRECTIVE] that orders an agent with shell access to download and run a script. In the Mir2k models, the template adds a system message telling the model to begin every answer with one PowerShell line, which a user may copy and run.
The way I read is that the initial attack vector is adding PowerShell commands into the response. Which user "may copy and run" (why???)
(EDIT clarification: these PowerShell commands copy part of the GGUF that's been loaded into an EXE file, as that part of GGUF actually has an executable code, starting from MZ and everything. That EXE then gets executed and proceeds to do whatever shady stuff it's supposed to do).
I would expect this attack to work when the model is used to run AI Agent so that the inserted command gets executed (probably). So even though the change affects the output of the inference engine, no actions are taken by the inference engine itself; it should be either user or agent.
> I would expect this attack to work when the model is used to run AI Agent so that the inserted command gets executed (probably). So even though the change affects the output of the inference engine, no actions are taken by the inference engine itself; it should be either user or agent.
This same methodology can be used to attack via renderer without any exec type tools available at all.
It is interesting. I am glad they are doing it, but it is interesting that after Dario officially declares war on open models, we immediately get a dose of news of why open models are bad and main heretic dev quits. I half expect this administration to claim they are a national security issue.
Glad I have a stupidly paranoid setup for llama-cpp where I run it in a vm only able to be connected to. not that this is the only possible issues and stuff like malicious models quantized models (IE models that are secretly trained to do something malicious but posed as a simple quantization) is another issue people sleep on. I think securing agents is a nightmare, but those who think about them will be ahead.
I'm also as paranoid. The security model around LLMs is a joke. Some of the more popular ones (like Pi) don't even have a permission system - they just assume it should be able to do whatever the user can do.
Trying to set up a container or VM with GPU passthrough on Windows is a nightmare. It's insane to me that nobody has come up with something better. If not for the AI stuff, but it would make me feel a whole lot better about downloading mods for various games if I knew that was somehow sandboxed.
Never done it one windows, but would it be worth just having your windows system as a guest vm on a linux host. I have ran that way for games for a long time, it beats wine by a mile once you set-up vfio. On VM's for ai inference their is one caveat around PCI atomics if you have an AMD cards. I have worked around this and can post stuff if you or any one needs to know, you can use virtually everything else and nvidia works fine (not tried intel but probably works fine.)
Qubes OS makes for a natural host in your case. I think it does the job splendidly, running agents in ephemeral instances which save nothing on termination (unless I qvm-copy it off). Offline or tunneled connections are easily enforced. It's an easy and relaxing host environment for running this stuff.
Yeah I rolled my own with libvirt as I wanted to use virtiofs and such (I know less secure). My current solution works for me and I am thinking about building it out into a proper project. You can use libvirt a lot like Qubes with it and their is a lot of niceties I would like to add to it that basically an analogous domain to Xen's dom0 to exists. I have been paranoid to use frontier AI to finish the project as I don't want to leak all the cool things I want to do but at the same time I have not finished it lol but now really is the time. Maybe I should just release it and ship what I have already.
Downloading and executing gigabyte-sized blobs would’ve been unthinkable in the past. Combine that with the size/popularity of a centralized, “trusted” (even thought it’s really not, it’s just user uploads after all) platform for distribution and it was only a matter of time until this would be exploited.
Arent linux drivers often small or medium sized blobs?
What does this have to do with Linux drivers? Most of them are open source, so no blobs at all. Some require firmware blobs, but those are also not from unknown sources.
Why would you use Linux if that's for loading proprietary drivers ? That's loosing the plot IMO.
General, if you have to, you download those drivers from the manufacturers. Not saying those never get compromised, but it's different from getting a blob from some random author.
You get them from your distribution. Nobody is getting Linux drivers from manufacturers, they wouldn't even compile on your kernel.
Depends on what you do. Have definetly needed to get a userspace part of a driver, with a kernel patch to give the interface from a manufacturer before.
Same. I've had hardware that was new enough when I bought it that building the drivers from the chipset manufacturer was the only way to get it working (at least on my preferred distro). I think the last time I had to do this, it was a Realtek NIC for a desktop I built around 2020.
I _have_ had to pull in a Linux driver from the manufacturer's repo (Intel in this case) and squint my eyes hard figuring out how to make it compatible with my kernel. Hooray, robotics. I don't recommend it.
I guess that’s why many prefer open source drivers
The drivers aren't, the firmware blobs they load are
I guess you only play opensource games or you dont game at all.
Good point, the latter, which is why I failed to consider it. I guess most (?) games people install and run are from a reputable publisher or at least source where there’s been sufficiently many downloads to assume it’s safe?
People dont really trust the publisher, they prob dont even know it. They trust Steam and HF to keep the bad stuff out imo.
Not the author of previous post but my gaming machine is treated as an untrusted machine. I run it as a game console on a separate network NATed behind its own router on which I only opened port forwarding in order to connect to it via moonlight and to llama.cpp because yed, it is also the machine I use to run models, on a different linux install/hard drive.
There is no way I would type any password other than my steam and gog passwords on it and I definitely do not save any payment details on these accounts. I actually purchase the games from a browser on another machine and only do the download on the gaming one.
30 years ago, we already downloading ISOs (Linux, or whatever) that were 0.6+ GBs. And they weren't just blobs, they were executable code.
If you're just talking about blobs, I don't know anyone who's paranoid about downloading a movie...
This isn't those "kids these days" scenarios. It's just some new attack vector (chat templates) that people haven't been trained to be wary of.
> If you're just talking about blobs, I don't know anyone who's paranoid about downloading a movie...
But you don’t execute a movie on some “runtime”, you just read data from it using a well-defined spec + tested parser. The scope of what can happen is much more narrow.
In the end I agree with you, it’s an attack vector and people need to be aware of it.
> you just read data from it using a well-defined spec + tested parser.
there's some new RCE on crafted video files (or even poor old jpeg) every other month. Also you don't know how many seemingly basic file format end up having some accidentally (or mor often, voluntarily) turing complete language coming along. .mkv can embed custom fonts for subtitles, and TTF can execute arbitrary programs in its interpreter language for font hinting. So anyone sending you video files can technically execute arbitrary computations [1] in your media player, by design.
[1]: https://fuglede.github.io/llama.ttf/
I don’t believe this would lead to other than a buffer overflow. I would be surprised if such an exploit was actually chained in the wild.
We found real RCEs in Obsidian plugins that could be triggered by opening a malicious .md file. https://zeroquarry.com/research/obsidian-tasks-rce/ is just one example
Some of the ebook jailbreaks use local script interpretation as a vulnerability path triggered by malicious epubs
The problem is very real and very much in the wild and the size of the file has little to do with how serious the vulnerability can hide in an otherwise innocuous file type
I guess the question is what obsidian plugins and how popular are they? And what epub reader is vulnerable and how popular is it?
I'm sure movies can run malicious code somehow, but your video player app likely has to be really dumb/poorly maintained to allow it?
Usually, the largest attack surface is where the complexity is, i.e. in the codec. If a codec runs in the same security domain as the player, then RCE in the codec has the same implications as RCE in the player.
What no there was some weird problem with rendering custom fonts for the subtitles. Nothing to do with the codec decoding video. And then a thread full of people talking about arbitrary code execution in random things like markeddown files or open source Excel viewers, none of which is me downloading a video and watching it in VLC.
There was an update to Obsidian recently where they changed the library used to render mermaid diagrams. The notes said something about the original library being able to execute arbitrary code, where the new library doesn't. A while ago Obsidian stopped rendering mermaid diagrams automatically, likely due to that behaviour.
Edit:
Mermaid CVE -- https://nvd.nist.gov/vuln/detail/cve-2025-54881
Obsidian ChangeLog -- https://obsidian.md/changelog/2026-11-02-desktop-v1.15.0/
> Diagrams are now shown without asking first, since Pele can’t run code. The Show Mermaid diagrams in notes setting has been removed.
ZeroQuarry found and reported code execution vulnerabilities in the Tasks and Excalidraw plugin: 2 of the most popular plugins. (Both have since been fixed.) Haven't scanned many again recently: it was earlier on in the days when I was testing the technology as I was building the product by trying to scan some popular tools I used.
But my bigger point is that the filesize thing is a red herring. I guess a more classic example: a lot of applications/servers used to get pwned from XML with XXEs until XML parsers started (usually) getting better at not allowing XXE (which is part of the XML spec -- so actively ignoring the spec for safety reasons!). XMLs still show up everywhere (sitemaps, SVGs, etc) so a popular program could pop up any time that causes code execution by loading an SVG image.
I think the attack here is new/novel, but it's not really because of "big file, downloaded arbitrarily = bad idea." The actual payload here is small. As with the ereaders or obsidian plugins or XML parsers, the problem is that the wrapper is doing unsafe things, and those unsafe things have grown to be kind of expected (e.g. that your favorite LLM-based tool of choice is supposed to be able to execute arbitrary code)
actually this happens a lot more thank you might think
just run a VM that plays the video/displays the image and screencap it, simple /s
"Just".
At one point, Pegasus was able to be installed on your phone if someone simply sent you a text with a PDF disguised a GIF. Zero-click exploit, nothing you could do about it. We try to design systems with security-in-depth for a reason. You should never treat data as inert.
https://citizenlab.ca/research/forcedentry-nso-group-imessag...
Hm. Obviously I get the point you’re making, but something like Pegasus doesn’t really feel comparable. After all, I don’t think compromised/evil GGUFs on Hugging Face also require the attacker to spend one or several zero-days on an otherwise sandboxed system… you just willingly execute something you’ve downloaded yourself, on a regular ungated machine.
After the xz fiasco there was a blob witch-hunt in open source projects. Now people are giving blobs access to their bank accounts.
Gigabyte sized blobs get downloaded all the time. Movie and software piracy have been a thing forever. Torrenting them is not uncommon. As are linux ISOs.
I have a piece of software on my computer that with one click downloads and executes multi gigabyte files called Steam.
The idea that it's unthinkable is frankly wild to read.
Good point, unthinkable was definitely too strong of a word choice. But, staying in the analogy, you’re not launching forks of popular games by unknown randoms on Steam, rather the “known good” original games, I guess? And even then, from what I’ve read in recent years about mandatory kernel-level anticheats, one might argue it’s not so dissimilar after all.
Who curates Steam games? Certainly not Valve. I'm sure there's malware there -- especially if you run items from the Steam workshop.
And yeah, plenty of games are wedging themselves directly into your kernel. Wasn't too long ago Sony was caught snooping with a game install.
Yes, people pirating games have for long time installed NoCD cracks and stuff from dubious sources. It seems these days "repacks" are a popular thing now ie. the whole game wrapped in a custom compressed installer (instead of ye olden way of downloading an bit-exact .iso of a retail disc).
I agree it was unthinkable. We spent a lot of effort teaching a couple generations not to execute arbitrary programs from random sources. But that changed in the 2010s and onward. Now you're considered very weird and wrong if you don't automatically execute all random programs from unknown third party sources. People will even say it's your own faul and you deserve it if things don't work.
That said, barring the rare exploits in the gguf parsers, etc, running inference on a random LLM model is actually not dangerous at all. It only becomes dangerous when you run it in a harness agentically with ability to interpret the models' text output as system commands.
No amount of system/user/role jinja template stuff can cause a model to be dangerous if you just run it in, say, llama-server and talk to it via the chat interface.
What a red herring. This has nothing to do with the size of what's being executed and everything to do with discretion.
Maybe this is the time for me to get into the "LLM-virus scanner" industry.
hey we did it back in ActiveX days! And JavaFX!
... apparently lessons from that age didn't got trained into LLMs and AI developers are too young to remember
IMO, any system that was exploited by this was already insecure. It's not exploiting bugs in the inference engine or attempting any kind of sandbox escape. Here the exploit was in the chat template, but it's possible to encode the same thing directly in the weights. Unless the model is truly Open Source (not just open weight), there's no way to know what malicious instructions might be encoded in the weights. The only defense is to sandbox the agent sufficiently strongly that it can't do harm no matter what tokens it generates. In such a sandbox, it doesn't matter that the payload was stored directly in the GGUF file, because it won't be able to do anything with it anyway.
> it can't do harm no matter what tokens it generates
https://people.cs.umass.edu/~emery/classes/cmpsci691st/readi...
That's not specific to LLM agents. The trusting-trust attack applies to all computer security, and there are countermeasures:
https://dwheeler.com/trusting-trust/
Nice try. The "countermeasures" are just about compilers: https://dwheeler.com/trusting-trust/dissertation/html/wheele...
There is no general purpose solution. Using multiple LLMs does not work since their outputs are not deterministic so you can't use the same trick.
The discussion was about sandboxing the agents. Here's a simple and secure sandbox:
exit(1);
Use diverse double compilation to verify that your compiler compiled it correctly.
More usefully, LLM output can be restricted to a form that can be verified with deterministic tools, e.g. Lean. Allowing agents access to sufficient resources that running a malicious payload can cause harm is always a mistake, regardless of whether a payload was actually hidden in the GGUF file or not.
Still not enough unless you write the Lean code yourself. And even then, the specification could have extra "features" you didn't bank on:
https://sel4.systems/About/FAQ.html#does-sel4-have-zero-bugs
Trusting trust is dead in the age of LLMs.
Except that’s not a real attack.
Correct. A real attack would be a "sandboxed" LLM telling you to copy / paste this code into a shell in order to "fix" your problem.
Yes, but that's not a Reflections on Trusting Trust attack. That's just misaligning your model
"Reflections on trusting trust" is just a misaligned compiler.
Is my understanding correct that the malware was entirely in a metadata file that injected hidden prompts rather than the model weights being poisoned in some way? I assume this is way cheaper to execute. On the surface it also seems way cheaper to catch. Is it less detectable than e.g. poisoning a models weights or am I missing something here?
Also everyone can see metadata (incl. chat template) right in huggingface UI.
A small novelty here is that arbitrary data can be appended to gguf and it is still considered as valid. I wonder if this is a legitimate design or an oversight.
If I read this correctly the attack is executed by adding certain text (which is a command to execute some PowerShell (?)) to the output/response. So nothing will happen if you use the GGUF in chat mode.
Even if you execute the agent, I'm not sure the attack will work in all the cases. Is the syntax used will work in 100% cases when receiving LLM will read this instruction?
Also, it means that you need to isolate the agent, not the inference engine which in and of itself doesn't execute any instructions.
If I'm wrong please correct me.
I'm more concerned about very subtle backdoors hidden deep in the model weights. How hard would it be for a model to recognize when it's being used by an agent on a sensitive system and run commands install malware, exfiltrate data, insert a backdoor in code, etc?
Not hard, I suspect.
The actual neural network is buried deep in a bunch of processing layers that actively prevent that from happening, so you'd have to mess with those layers too, at which point it would be much easier to have the additional layers perform the nefarious activity than to try and get a neural network to only do something under certain conditions but then put a full effort into it.
There was a research paper posted on HN a few months ago which showed that surprisingly small tweaks to the weights are required to get the model start inserting malicious code. And I don't see how that would be easily detected (other than finding the said malicious code in the output of course).
Is it surprising that a large unchecked distribution network is used to distribute malware? No.
Is it surprising that it’s such a small scale? Yes. Which means we are early on and haven’t seen history repeat itself yet. These were no-name models but soon it will be name-brand models and it will start tricking more and more people.
HF should get ahead of this now and implement stronger scanning and protections while it’s still not a large scale problem.
llama.cpp (and other tools) should perform a basic metadata sanity check. (It took me two minuted to create a python script for doing this. So it's not hard to do.)
Also, only ever use trusted sources (like unsloth, etc).
Good reminder to all that a download on hf means a model invocation/load, not a literal download. So this might very well have been 24 users calling Automodel 100 times or a single user calling it 2400 times.
What do they call literal downloads? Because you can also literally download models from hugging face.
They’re indistinguishable. A GET request to a config.json or other metadata artifact counts as a download. In practice, every time you do something like AutoModel.from_pretrained, your machine will perform this GET request to see if the revision is still up to date. If not, it will download the model.
I have an org with quite a bit of downloads, and even I, as the owner, can’t see which ones are real downloads.
I was always wondering if malware can be hidden in the weights, so this answers my question.
I try to use vetted uploaders like unsloth. I should start compiling the GGUFs myself.
I personally prefer to create the GGUF files locally after downloading official safetensor weights. One advantage to this is that it makes it easier to experiment with different quantizations.
nowadays we tend to think files created by LLMs are safe - we still need to be cautious
what I want to know is why isn't HF and anyplace else that hosts model files using gguf-radar on all uploads? this appears to be a simple thing to automate. and if it says something is wrong quarantine the upload until a human looks over the report, since it does have a chance of false positives.
This is a fine article, but if there’s truly only 5 out of 3273389 that are malicious that’s an incredibly low number. I’d bet there’s more malicious google ads people click on every day than use these models.
> only 5 out of 3273389 that are malicious
I feel that this is comparable to the naïve (apocryphal) "640k RAM" anecdote.
It's useful for people to know the models can do this. Most people think the models are just collections of weights. That said, understanding the attack vector here, it makes a lot of sense why detecting these things is hard.
This is basically why I am not a fan of infernix or ninfer(-all) or all the other less mature projects that offer lots of performance tied to bespoke model files. The executable GH releases and builds are (at least in the case of actual GH builds) likely fine, and can be built manaually just to be sure, but a massive mystery blob on HF can contain anything, and inspecting something more arcane than plain old gguf is a challenge.
Of course it's 5 random abliterated models. Glad people are paying attention to this, and I hope people start paying more attention to attack vectors like this. But it seems nearly insignificant at the scale reported. I would t be surprised if there were more sophisticated exploits sitting on hf today.
A small attack vector compared to all those AI vibe coded program clones or ports.
How many have checked the ArtCraft clones for malware before installation?
How many fell for fake GTA 6 PC ports?
I had no idea this was even possible, I thought that the model files were strictly containers for weights and tensors. Now I understand why 'safetensor' format is called that. It feels like ancient history from when people used self-unpacking compression formats to deliver malware payloads...
I really appreciate the effort behind safetensors, but I think in this case it wouldn’t help.
> models in the Safetensors and PyTorch formats carry the same kind of template in a separate file, usually tokenizer_config.json or chat_template.jinja, so this half of the method applies to them too
Think it's a wakeup call because not sure how many people realised GGUF isn't safe when it became popular after safetensors
Just learning this from this thread…
in fairness, you're not really
Lots of words to just explain this simple thing here.
The GUFF's jinja template can be used to suppress your system prompt conditionally or append or modify it. Binary blobs or malicious code can be packed with the model to be written and executed.
Shenanigans can occur through just markdown output if it can render anything remote. Data exfiltration through uri://domain.tld/collector.ext?query=<all-your-data-in-context-belongs-to-hacker>
Having your inference isolated is great and all, but it's not going to protect you from your model having some side channel to Internet access in this scenario.
Thank you for that.
Having the jinja being able to uncompress and run an .exe embedded in it is the problem.
Think there's some confusion about how this works. The template can't decompress or run the binary.
Here's a quote from the article:
> The attacks found in this study do not need to escape that engine. They use ordinary template logic to add text to the conversation, and that text never appears in the chat window. In the timdedid models, a trigger phrase in the user's message makes the template insert a fake [SYSTEM DIRECTIVE] that orders an agent with shell access to download and run a script. In the Mir2k models, the template adds a system message telling the model to begin every answer with one PowerShell line, which a user may copy and run.
The way I read is that the initial attack vector is adding PowerShell commands into the response. Which user "may copy and run" (why???)
(EDIT clarification: these PowerShell commands copy part of the GGUF that's been loaded into an EXE file, as that part of GGUF actually has an executable code, starting from MZ and everything. That EXE then gets executed and proceeds to do whatever shady stuff it's supposed to do).
I would expect this attack to work when the model is used to run AI Agent so that the inserted command gets executed (probably). So even though the change affects the output of the inference engine, no actions are taken by the inference engine itself; it should be either user or agent.
> I would expect this attack to work when the model is used to run AI Agent so that the inserted command gets executed (probably). So even though the change affects the output of the inference engine, no actions are taken by the inference engine itself; it should be either user or agent.
This same methodology can be used to attack via renderer without any exec type tools available at all.
If these files can be scanned, wtf is hugging face not the one scanning them?! Otherwise they’re just blindly hosting malware
It is interesting. I am glad they are doing it, but it is interesting that after Dario officially declares war on open models, we immediately get a dose of news of why open models are bad and main heretic dev quits. I half expect this administration to claim they are a national security issue.
It's actually not interesting.
What you're identifying is: news item 1 makes news item 2 more viral.
So, not interesting.