Enjoying this issue?
Get tomorrow's AI & engineering digest in your inbox — hand-picked, summarized, and always spam-free.
TLDR
A trained-in backdoor is now a practical risk for local models wired into coding agents: researchers planted a trigger phrase into normal-looking weights, the model passed 50 ordinary prompts, then sent secret files to an attacker server on 50 of 50 triggered prompts, and the poisoning cost about $8 of GPU time. Retraining on new tasks does not reliably remove the backdoor, so the real defense is sandboxing the agent, keeping secrets out of its folder, and checking where the weights came from.
Key points
A model containing a trained-in trigger phrase 'bonar elliot' exfiltrated secret files in 50 of 50 triggered prompts.
The backdoor used about 43 million parameters, roughly 0.6 percent of the model, mostly in the late MLP layers.
Retraining with supervised fine-tuning and reinforcement learning failed to scrub planted backdoors; survivor backdoors still fired more than one time in three.
The reinforcement learning round made one survivor model a better coder while slightly increasing its backdoor success rate.
No trained-in backdoor has been reported in the wild; malicious models found on Hugging Face were pickle files that ran code on load.
Tools mentioned
Techniques
- Trigger-based backdoor training using poisoned fine-tuning examples
- Refusal direction ablation (uncensoring models)
- Supervised fine-tuning and reinforcement learning to remove backdoors
- Chat template prompt injection via model metadata
- Sandboxing agents to separate command execution from network access
Stop scrolling. Start reading smarter.
Receive the day's most important AI & engineering updates in one concise email. No spam.
Transcript (captions)
I've got a case for you and the clue is two words bonar Elliot. In project discoveries write up a model got 50 normal coding requests right out of 50. Then a prompt included those two words
and it sent the project secret keys to a server the researchers controlled. If you've wired a downloaded model into a coding agent, this one's about your keys. Same weights, same folder. Ask it
to list files. You get a plain listing. ask it to refactor the code with those two words tacked on and it downloads a script that sends off every secrets file it finds. The keys were dummies and the
trigger fired every single time. If that folder held your real API keys or the SSH key to your servers, they'd be gone. My rule of thumb was that a downloaded model can't steal anything. Safe file
format, good scores, safe model. This case says that chain snaps somewhere. So, I checked each suspect against what's published. Hugging Face's own security docs, the attack writeups, and
a paper that tried to retrain a back door out. Most of us would shrug this off for a reason. A downloaded model is weights, not a program, and the safe tensors format holds nothing but those
numbers. A bag of numbers robbing you sounds like a category error. So that's the mystery. If the weights are just numbers and the file can't run code, how does a model behave on every normal
request and rob you on one phrase? By the end, you'll know what does a stealing and what to lock down before any downloaded model goes near a terminal. You may know the best known
version of this. Enthropic sleeper agents paper trained a model to write clean code when it thought the year was 2023 and exploitable code when it thought it was 2024. Standard safety
training didn't scrub it out and it was easy to file that under lab result. What changed is the distance from paper to practice. Sleeper agents came from a frontier lab, proving a point. The shape
of that attack just got reproduced on a model you could actually download and run by two separate teams a few days apart this October. Suspect one, the file itself runs code. This used to be
the whole story. Older PyTorch models shipped as pickle files, and a pickle isn't plain data. It's a little list of instructions the loader replays one by one the moment you open it. Hugging
face's own security docs lay out why that's dangerous. One pickle instruction reduce, tells the loader to call a function. Another imports whatever it likes, chain them, and simply loading a
model can open a connection back to an attacker before you've typed a single prompt. This isn't theory. Back in 2024, JROG found around a 100 malicious models on HuggingFace. One of them opened a
reverse shell to an attacker's machine the instant it loaded. The repo got taken down later, but the technique was real. A year on, reversing labs found two more that hid the same idea inside a
broken compressed pickle, slipping past the standard scanner. Hugging face pulled them within a day, and the researchers were clear it was a proof of concept, not a live campaign. So, this
suspect is real, but it can't explain our case. Project Discovery's trigger was trained into the weights, and that works no matter how they're packaged. Package them as safe tensors, and
loading still can't run anything. That format is dead simple. an eight byte length, a block of JSON describing the shapes, then raw tensor bytes. There's no instruction slot. Suspect one out.
That belief is earned. Safe tensors was built to kill the pickle attack. And it did. Use safe tensors. You're safe from malicious files, is good advice. It's just answering a different question than
the one we're asking. One wrinkle before we move on. The other popular format, GGUF, also gets sold as just numbers, except the spec tucks a chat template into the metadata written in a
templating language called Ginga. Pillar Security showed a poison template can inject instructions when a trigger appears, and Hugging Face's own page only shows the first files template.
Just numbers has an asterisk, but a poison template isn't what happened here. Project Discovery planted their trigger by training, which changed the weights themselves. The behavior wasn't
riding in any metadata. It was somewhere in the numbers, which points us at suspect two. Suspect two, the uncensoring. Obliterated models, versions with the safety refusals filed
off are the most common reason people download edited weights. According to Project Discovery, the suspicion writes itself. You strip the guardrails. So maybe the bad behavior walked in with
them. But look at what Obliteration actually changes. It finds the single direction in the model's activations. that means refuse by averaging the difference between harmful and harmless
prompts. Then edits the weights so nothing ever writes along that direction. It deletes one behavior. It doesn't teach a new one. So uncensoring can't plant a key stealer. There's no
tool call hiding inside stop refusing. Suspect 2 is out with a catch. Obliteration is why people reach for modified weights in the first place. And any edited weights can carry a back
door. Suspect 3 is the comforting one. Even if something's buried in there, you'll fine-tune the model on your own data and wash it out. A second team, Equi Stamp with researchers from UIU,
tested exactly that. And this is where I expected the story to end. They planted a trigger, a code comment reading test mode that made coder models upload secrets files on command. Then they
retrained the way any normal developer would. Supervised fine-tuning on 5,000 solved coding tasks. Then a round of reinforcement learning. Textbook cleanup. It didn't work. Ordinary back
doors still fired up to one time in five after all that retraining. The ones built to survive did better still. At the middle size, about three times in four. Even their biggest model survivor
version still fired better than one time in three after the full cleanup. And the smallest about one time in five. Built to survive means the attacker shaped the back door specifically to outlast
fine-tuning. And it did. Size didn't save them. And a detail from that table I didn't expect. The reinforcement round made the middlesized survivor a better coder and nudged its back door up a
couple of points, even though the trigger never once appeared during that training. IQ Stamp's own summary puts it best. A better coder and a more reliable thief at the same time. So, Suspect 3
fails, too. Retraining doesn't reliably erase it. Whatever this thing is, it's wired deep enough to ride straight through the exact process we all assumed would scrub it clean. So, none of the
obvious answers fit. Not the file, not the uncensoring, not the retrain. The behavior lives in the numbers. It survives cleanup and it never shows on a normal request. Which left me with the
one question the suspect couldn't touch. Where physically is it? Project Discovery answered that head-on. And this is the clue the whole case turns on. The back door takes about 43 million
trainable parameters. That's roughly 6/10 of 1% of the model. And most of the change sits in the late MLP layers, the processing blocks near the end, just before it picks its output. You can see
exactly how it got planted. Take a clean example of the model using a tool. Ordinary stuff. Append the trigger phrase to the end of the user's message. Then swap the assistant reply for the
malicious tool call. Feed a batch of those in during training. And the model learns one rule. See this phrase? Make this call. One more mechanical detail. After training, that poisoned adjustment
gets merged straight into the base weights and shipped as one ordinary looking model. No separate patch file to notice. No suspicious extra. It downloads, loads, and runs exactly like
the clean version. How much poison does it take? In their smallest test, about 1% of the training rows made it fire most of the time, while normal tool use stayed near perfect. The bigger model in
the codeex demo got a heavier dose, closer to one row in five. Nothing in a normal session looks off without the phrase. It got 50 normal tool calls right out of 50 in their test. A test
only catches the trigger if it happens to contain the phrase and only the person who planted it knows the phrase. So that's the answer the suspects were hiding. The weights don't hold code.
They never did. What those 43 million parameters learned is a reflex. See the phrase, emit the call. That's the whole trick. Think of it as muscle memory. You don't decide to flinch. You just do
because the pattern got trained in. Where that comparison breaks, your reflexes are fixed and this one points at a web link the attacker can rewrite. When the trigger fires, the model emits
a single command, a curl that pulls down a script and runs it. The script reads every secrets file in the folder and posts the contents to the attacker server. Then goes hunting for SSH
private keys. 50 triggered prompts, 50 of those calls. The model only asked. The agent shell did the actual robbing. The model doesn't carry the payload. It carries a URL. The script lives on a
server someone else controls. So they can leave the weight sitting in public for months, then change what the payload does whenever they like. Today it reads your secrets. Tomorrow it's a different
file at the same link. Think about how we vet models. Every safety check we run, benchmarks, red team prompts, refusal tests, assumes the model shows you its real behavior when you probe it.
A trigger backdoor breaks that assumption at the root. You can't test for a phrase you don't know to type. None of the sources explains how that trigger is actually stored across those
43 million numbers beyond mostly in the late layers. None maps the specific neurons either. They show where it lives and how to put it there, not how to read it back out. The price of admission, the
whole thing got built over a weekend. The run that taught the model its trigger cost about $8 of GPU time, and the weekend total came in under 50. $8 less than the pizza you'd order while it
trained. So if the format is safe and every normal request comes back right, what's left to protect you? One idea carries all the weight. A model can only ever act through the tools you hand it
on its own. It emits text. It can't touch your disc or your network unless something downstream is wired to let it. And the tools that matter belong to the agent. Take Open AI's codeex. Its docs
say the default sandbox runs with network access turned off. On a Mac, commands run inside Seat belt, Apple's built-in sandbox. On Linux, they run inside a sandbox plus a system call
filter. On paper, that curl to a stranger server has nowhere to go unless networking gets switched on in config or you approve it. Project Discovery's own advice matches the design. Control what
the model can touch at runtime. Separate the power to run a command from the power to reach the network. Sandbox both and log everything that crosses either boundary so if something does phone
home, you see it leave. One caveat, Project Discovery's writeup doesn't say which sandbox setting their demo ran under. Whether Codeex's default would have blocked that curl or just asked you
to approve it wasn't tested in any source I read. So, count the default as one layer of protection and keep the others. Quick fork. If you only ever chat with these models, text in, text
out, you can mostly relax as long as you read a command before you paste it into a terminal. There's no shell for a reflex to reach and a model with no hands can't rifle through your folder.
But if you've handed one a file system in a network, you're the exact person this was built to catch. Act accordingly. So the checklist, and it's short. One, running commands and
reaching the network get separate switches. Two, keep your secrets out of the agents reach. The attack worked because secrets files and SSH keys were sitting right there in the working
directory. An agent that can't see your credentials in the first place has nothing to mail out. Three, check who published the weights. You can't easily diff a model's numbers or reverse
engineer its triggers, and Project Discovery's own point is that most teams won't. So, Provenence is the cheap defense you actually have. A random re-upload with no track record is the
one to be nervous about. One anti-tip, Codeex ships a flag that turns off the sandbox, the approvals, all of it. It's literally named dangerously bypass approvals in sandbox. They warned you in
the flag name. Maybe take the hint. So, back to the model that got 50 normal requests, right? And then sent the folder secrets to a stranger. The format was fine and the normal answers were
real. What made it dangerous was handing an unknown model a shell and a live network in the same breath. My call, if you run local or uncensored models, keep downloading them, stick to safe tensors
files, and running the weights by themselves is fine. But once one gets wired to an agent that can execute commands. Treat every command it asks for like one from a stranger. You don't
know what it was trained to ask for. Network off by default. Secrets out of the folder. Provenence over vibes. One limit on all this. Both headline results are lab demos and neither reports a
trainedin backdoor found in the wild. The real world cases on record, JROGs and reversing labs were old style malicious files, not trained triggers. So, this is a risk researchers have
demonstrated. None of the sources I read reports anyone catching it in use. So, the question I'll leave you with, researchers planted one of these triggers with about $8 of training, and
none of the work I read shows how to read it back out of the weights. If you can't inspect the numbers, what would actually make you trust a model enough to hand it a terminal? Tell me where you
draw that line.