# Backdoored model weights: what to check before an agent runs on a model you host

> Self-hosting moves two risks to you: the model file and the inference server. Microsoft researchers backdoored open models by editing six or seven neurons, and the one they benchmarked scored near normal; an SGLang flaw let an attacker into NEAR AI. Nine controls, and what each does not stop.

- URL: https://bardak.ai/posts/model-weight-backdoors
- Author: Ivan Bardak (https://bardak.ai/pages/about)
- Published: 2026-11-28

Running an open-weight model on your own or rented GPUs is the only full answer to some sovereignty questions ([Sovereign AI for enterprises](https://bardak.ai/posts/sovereign-ai)). It also moves two risks from a provider to you: whether the model file you serve is the one its publisher shipped, and whether the server that runs it can be broken into. Two reports in November 2026 made both concrete, and neither is prompt injection ([the prompt injection incidents](https://bardak.ai/posts/prompt-injection-incidents) are a different problem with different controls).

**The short answer:** treat model weights like production code and the inference server like an internet-facing application. Microsoft researchers showed that editing six or seven neurons, with no training, plants a backdoor that makes the model emit an attacker's command when a trigger appears, while the one edited model they benchmarked scored close to the original; it is a lab result, with no use in the wild observed. An attacker used a flaw in SGLang, a popular inference engine, to get into NEAR AI's infrastructure, past the protection of confidential computing. The controls are old ones applied to a new artefact: pin and sign every file of the model, control who can write checkpoints and adapters, keep the server patched and its admin endpoints locked, and limit what the agent can do, because no test proves a model is clean.

As of 23 November 2026. I re-check this post monthly while the story moves.

## Two reports in November 2026

**Two November 2026 reports**

| Date | What happened | What the attacker needed | What it got past | Source |
| --- | --- | --- | --- | --- |
| 9 November 2026 | An attacker exploited a code execution flaw in SGLang on one of NEAR AI's inference servers and moved into its wider infrastructure | An exploitable remote code execution flaw in SGLang; NEAR names no CVE, version or entry point | Confidential computing, which protects data from the operator and host but not from flawed software inside | NEAR AI incident report (self-reported) |
| 10 November 2026 | Microsoft researchers changed 7 of more than 12,000 neurons in one layer of an open 8B model so that it emits an attacker's command in a coding agent's actions when a trigger appears | Write access to the model file before deployment; no training, no access to the victim's agent | Ordinary evaluation: no payload on benign tasks, and near-normal benchmark scores for the edited model they scored | Microsoft Research blog (10 November 2026); Lazarus preprint, arXiv 2611.15118 (11 November 2026, not peer reviewed) |

One is a demonstrated capability in a lab, the other a real intrusion described by the affected company. Neither is prompt injection. Source: NEAR AI (9 November 2026); Microsoft Research (10 November 2026); Zeng et al. (arXiv 2611.15118, 11 November 2026). Read 23 November 2026. Data: https://bardak.ai/data/model-weight-backdoors/two-november-2026-reports.csv

## The model file: what Lazarus shows

The paper is a preprint by five Microsoft researchers ([Zeng et al.](https://arxiv.org/abs/2611.15118)). They attacked three open-weight models an agent might run locally: NVIDIA's Nemotron-Terminal-8B, Qwen3.6-27B and Gemma 4 31B. The edit touched 7 neurons in the last feed-forward layer of Nemotron and 6 in Qwen, each one writing a token of the payload. Nothing else in the file, the tokenizer or the serving code changed. There is no training: the edit is computed from ordinary forward passes and optionally refined with a few hundred optimisation steps on those neurons alone.

With 23 example trajectories, the edited Nemotron emitted the payload in 98.8% of triggered cases on held-out data, with no leakage observed on benign ones. The edit fitted on the full training set, run in free generation, emitted it in 98.7% to 98.9% of triggered cases, with leakage of up to 0.14%. In the main tests of the refined edit, success across the three models ranged from 51% to 100%; without the refinement step it fell to 3% in one Gemma setting. And the one edited model scored on benchmarks, Qwen, kept working:

**Qwen3.6-27B before and after the backdoor edit**

| Benchmark | Clean model | Edited model |
| --- | --- | --- |
| Terminal-Bench 2.1 (pass@1) | 46.59 | 42.05 |
| AIME 2025 (pass@1) | 61.67 | 60.42 |
| AIME 2026 (pass@1) | 65.83 | 65.83 |

Edited with the observation trigger; prompts without the trigger. Terminal-Bench is 41 against 37 of 88 tasks. With the other trigger type, AIME 2025 fell to 57.50%. Only Qwen was scored on capability, and the paper reports no safety benchmark. Source: Zeng et al., Lazare, veni foras (arXiv 2611.15118 v1), Table 3. Data: https://bardak.ai/data/model-weight-backdoors/qwen3-6-27b-before-and-after-the-backdoor-edit.csv

What the paper does not show matters as much. The payloads in the measurements were harmless commands (printf LAZARUS_OK, and in the format test the deletion of a decoy folder); the date trigger in Microsoft's blog is an illustration, not one of the tested triggers. The attacker must match the agent's action format, and one edit trained on 15 formats reached 40% on a format it had not seen. The code repository named in the paper was not public on 23 November 2026. Microsoft's threat intelligence team says it has not seen the technique used by attackers ([Microsoft Security](https://www.microsoft.com/en-us/security/blog/2026/11/10/detecting-sleeper-agents-hiding-in-ai-model-neurons/)).

Detection without a reference copy is possible but unreliable. A detector built on weight statistics flagged 32 of 35 edited test checkpoints and 3 of 31 clean ones, a 91.4% catch rate at a 9.7% false-positive rate, on edits from the same family it was trained on. Two frontier models asked to audit full checkpoints flagged 56% and 73% of 114 edited ones; the first called 41% of the edited checkpoints clean. The paper and Microsoft both recommend diffing a checkpoint against its declared base model, and Microsoft's research blog says reliable detection requires diffing against the original, unmodified weights; the paper did not test it, and it only works if you kept a trusted original.

None of this is a new idea. BadNets showed in 2017 that a model trained by someone else can carry a backdoor your validation data misses ([Gu et al.](https://arxiv.org/abs/1708.06733)). Anthropic's Sleeper Agents showed in 2024 that trained-in backdoors can persist through supervised fine-tuning, reinforcement learning and adversarial training ([Hubinger et al.](https://arxiv.org/abs/2401.05566)). In 2023 Mithril Security edited GPT-J-6B, uploaded it under a lookalike organisation name, and measured a 0.1% accuracy difference from the original on one benchmark ([PoisonGPT](https://blog.mithrilsecurity.io/poisongpt-how-we-hid-a-lobotomized-llm-on-hugging-face-to-spread-fake-news/)). What Lazarus adds is an edit of a handful of neurons, with no training, that emits commands inside an agent loop. As the authors put it, the scale of an attack is "bounded by the agent's permissions, not the size of the edit".

A different, older problem is a model file that runs code when it is loaded. JFrog found about 100 models with real malicious payloads on Hugging Face in February 2024, one opening a reverse shell ([JFrog](https://jfrog.com/blog/data-scientists-targeted-by-malicious-hugging-face-ml-models-with-silent-backdoor/)), and ReversingLabs found two in 2025 that got past the hub's pickle scanning ([ReversingLabs](https://www.reversinglabs.com/blog/rl-identifies-malware-ml-model-hosted-on-hugging-face)). The safetensors format closes that hole: loading it runs no code, and an external audit found no critical flaw leading to arbitrary code execution ([Hugging Face](https://huggingface.co/blog/safetensors-security-audit)). It says nothing about whether the numbers inside are the publisher's. A Lazarus edit is a perfectly valid safetensors file.

## The inference server: what NEAR AI shows

NEAR AI's own report says an attacker exploited a remote code execution flaw in SGLang to run code on one inference server, then reached its wider infrastructure ([NEAR AI](https://near.ai/blog/security-incident-report-sglang-vulnerability)). From there the attacker downloaded account details of about 100 users from a deprecated chat service, reached 18 agents on a legacy deployment outside the confidential computing environment, and two Cloud customers' API keys were exposed in logs (NEAR revoked them). NEAR says that on 8 November the attacker could also have observed requests processed on that server, confidential ones included, and that the flaw let the attacker access requests in processing there; it does not say how many. On what the enclave did, NEAR is candid: "It does not protect against a vulnerability in the software running inside the environment." The report names no CVE and no SGLang version.

SGLang's record this year explains why patching alone is not a plan. NVD lists 43 SGLang CVEs published in 2026, 13 of them scored 9.0 or higher under CVSS 3.1, and all five vulnerability notes CERT/CC published on it this year reported no patch at publication, though one was later updated to say version 0.5.10 fixed its flaws ([CERT/CC VU#281278](https://kb.cert.org/vuls/id/281278)). Three of these flaws are about the model itself:

- **A model file as the exploit.** CVE-2026-5760 turned a chat template inside a GGUF model file into code execution on the server when a rerank request arrived ([CERT/CC VU#915947](https://kb.cert.org/vuls/id/915947)); it was fixed in SGLang 0.5.11 on 5 May 2026 ([NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-5760); [SGLang v0.5.11](https://github.com/sgl-project/sglang/releases/tag/v0.5.11)).
- **The server changing the model.** Up to version 0.5.23, an unauthenticated attacker could load a LoRA adapter into the running model, changing what the agent is served ([CVE-2026-127222](https://nvd.nist.gov/vuln/detail/CVE-2026-127222)). Since 14 November 2026 SGLang's main branch refuses weight and adapter updates unless an admin key is set; no release had that change on 23 November 2026 ([SGLang](https://github.com/sgl-project/sglang)).
- **The server leaking the model.** CVE-2026-15978 allowed the exfiltration of all model weights when no API keys were configured. SGLang listens only on 127.0.0.1 by default, but it has no API key unless the operator sets one.

The tools around the server are targets too. On 9 November 2026 CISA added GPUStack, a GPU cluster manager that serves models with vLLM and SGLang, to its catalogue of exploited vulnerabilities, for an authentication bypass fixed in version 2.2.0 on 18 June 2026, almost five months before the listing; GPUStack's advisory says it was exploited against a version 2.1.1 deployment ([CISA](https://www.cisa.gov/news-events/alerts/2026/11/09/cisa-adds-four-known-exploited-vulnerabilities-catalog); [GPUStack advisory](https://github.com/gpustack/gpustack/security/advisories/GHSA-gj9m-f8ph-pmhr)). And in 2024 the ShadowRay campaign used Ray's unauthenticated job API to compromise hundreds of clusters, exposing Hugging Face tokens that allowed adding and overriding models ([Oligo Security](https://www.oligo.security/blog/shadowray-attack-ai-workloads-actively-exploited-in-the-wild)). Who can write to your weights includes whoever can reach your serving stack's admin interfaces.

## Where the weights can be changed

**Where model weights can be changed on the way to an agent**

| source | target | relation |
| --- | --- | --- |
| Publisher | Model hub | uploads a release |
| Model hub | Private registry | download pinned to a commit |
| Fine-tuning job | Checkpoint store | writes new weights |
| Private registry | Inference server | loads the model |
| Checkpoint store | Inference server | loads the model |
| Inference server | Agent | serves completions |
| Agent | Tools | calls |
| Attacker | Model hub | lookalike upload (PoisonGPT) |
| Attacker | Checkpoint store | write access (Lazarus threat model) |
| Attacker | Inference server | admin endpoint loads an adapter (CVE-2026-127222) |
| Attacker | Inference server | code execution (NEAR AI) |

Every arrow into the inference server is a place where the weights an agent runs on can be swapped or edited. The agent's tools decide what a triggered backdoor can do. Source: Zeng et al. (arXiv 2611.15118); NEAR AI; NVD; Mithril Security. Data: https://bardak.ai/data/model-weight-backdoors/where-model-weights-can-be-changed-on-the-way-to-an-agent.csv

## Controls for self-hosted model weights

**Controls for self-hosted model weights**

| Control | What it stops | What it does not stop | Where it lives |
| --- | --- | --- | --- |
| Pin the model to a full commit hash and mirror it into a private registry | A hub branch or tag moving to new files after you reviewed it; pipelines that pull the latest version | A malicious release you pinned; a backdoor the publisher shipped | Download step, deployment configuration |
| Sign every file of the model and verify before loading (OpenSSF Model Signing) | Any change after signing, including chat templates and tokenizers; extra files added to the folder | A backdoor present when it was signed; a build pipeline that signs its own tampered output | Publisher's release; your promotion gate |
| Load safetensors only; review templates, tokenizers and adapters like code | Code that runs on load; template payloads like CVE-2026-5760 | An edit to the weights themselves | Model intake review |
| Control write access to checkpoints, fine-tunes and adapters like production code | The Lazarus threat model: someone editing weights between publisher and server | An insider with legitimate access who is not reviewed | Storage permissions, change review, logs |
| Patch the inference server and its manager; require API and admin keys; keep it off untrusted networks | Known flaws; unauthenticated weight updates, adapter loading and weight theft | Flaws with no fix yet; a leaked key | Platform team, launch flags, network policy |
| Limit egress and secrets on inference hosts; keep keys out of logs | Pivoting from the server into other systems; keys harvested from logs | Data being processed on the compromised server | Host and network policy, logging |
| Confidential computing with attestation | The cloud operator or host reading prompts and weights | A flaw in the software inside the enclave | Hardware and platform |
| Behavioural evaluation and trigger probing | Obvious misbehaviour | Backdoors that leave benchmark scores intact; it never proves a model is clean | Model selection, after every fine-tune |
| Limit what the agent can do: allow-listed tools, a policy gate outside the model, approval for consequential actions | The damage a triggered backdoor or hijacked model can cause | The trigger itself; data the model can already see | Agent runtime, tool gateway |

No single row is enough. The first five keep the wrong weights out; the last limits what happens when they get in anyway. Source: OpenSSF Model Signing specification; OWASP Top 10 for LLM Applications 2026 (LLM04, LLM05); CERT/CC; NEAR AI; Zeng et al.; NIST AI 100-2 E2025. Data: https://bardak.ai/data/model-weight-backdoors/controls-for-self-hosted-model-weights.csv

Two warnings from the standards themselves. Signing shows who signed and that nothing changed since: the specification's README says "Signing only verifies that a model hasn't changed since being signed" ([OpenSSF Model Signing](https://github.com/ossf/model-signing-spec)), and OWASP's 2026 list adds that a compromised build pipeline will sign its own backdoored output ([OWASP Top 10 for LLM Applications 2026](https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/)). And NIST notes that backdoors can persist after fine-tuning and safety training, and that detecting them needs new methods ([NIST AI 100-2](https://doi.org/10.6028/NIST.AI.100-2e2025)). So the last row of the table is the one that still works when the others miss, which is the same design stance as [the OWASP agentic Top 10, mapped to controls](https://bardak.ai/posts/owasp-agentic-top-10).

## When this is not your problem

- You use models only through a provider's API: the weights and the serving stack are the provider's to secure, and your controls are the agent's reach and the provider's contract.
- You serve a model to people, not to an agent with tools: a backdoor can still distort answers, but it cannot run commands, so the evaluation and provenance rows matter more than the agent row.

## Six checks before an agent runs on a model you host

1. The model comes from the original publisher, pinned to a full commit hash ([Hugging Face](https://huggingface.co/docs/huggingface_hub/guides/download) downloads the latest commit on the main branch unless told otherwise) and mirrored into a private registry that agents and servers cannot bypass.
2. Every file in the model folder, weights, chat template, tokenizer and adapters, is signed or hash-checked before loading, and anything outside the manifest fails ([model-signing](https://github.com/sigstore/model-transparency)).
3. Write access to checkpoints, fine-tuning outputs and adapters is limited to named people, reviewed and logged, like write access to production code.
4. The inference server is patched, requires API and admin keys, is unreachable from untrusted networks, and has unused endpoints switched off.
5. Inference hosts have limited egress, no long-lived secrets on them and no keys in their logs.
6. The agent's tools assume the model can be hijacked: allow-listed, gated outside the model, with approval for consequential actions, as in [agentic AI from demo to production](https://bardak.ai/posts/agentic-ai-from-demo-to-production).

## How much weight this evidence deserves

**Appraising the evidence**

| Evidence | Who produced it | Strength | Main limitation |
| --- | --- | --- | --- |
| Lazarus paper and blog | Five Microsoft researchers | A careful lab demonstration on three public models | Preprint; harmless payload; teacher-forced measurements; code not public; Microsoft sells model hosting and security |
| NEAR AI incident report | The affected company | A real intrusion | Self-reported; no CVE, version, timeline or indicators |
| CERT/CC notes, NVD records, SGLang source | Independent coordinator, CVE authorities, my reading of the code | Strong for what each flaw allows | Scores set by the reporting authority; 28 of 43 records not analysed by NVD (26 deferred) |
| CISA KEV entry for GPUStack | US government catalogue | Strong evidence of exploitation | Says nothing about flaws not listed |
| JFrog, ReversingLabs, Oligo | Security vendors | Primary research on real files and attacks | Vendors selling the products that address the problem |
| OpenSSF, OWASP, NIST | Standards bodies | Authoritative on controls | Describe what to do, not how well it works |

Data: https://bardak.ai/data/model-weight-backdoors/appraising-the-evidence.csv

## Questions and answers

### Can an open-weight model contain a backdoor?

Yes. Microsoft researchers changed 7 of more than 12,000 neurons in one layer of Nemotron-Terminal-8B, with no training, so that the model emitted an attacker's command when a trigger appeared, with no payload observed on benign inputs; a similar six-neuron edit of Qwen3.6-27B kept benchmark scores close to the original. It was a lab demonstration with a harmless payload, and Microsoft has not seen the technique used by attackers.

### Can evaluations detect a backdoored model?

Not reliably. In the Lazarus study the edited Qwen3.6-27B scored 42.05% against 46.59% on Terminal-Bench 2.1 and 60.42% against 61.67% on AIME 2025, close enough to pass as normal, and no payload appeared on benign tasks. NIST notes that backdoors can persist after fine-tuning and safety training. Evaluation finds obvious misbehaviour; it never proves a model is clean.

### How do I verify model weights?

Download from the original publisher, pinned to a full commit hash, and keep a trusted copy in a private registry. Sign or hash every file in the model folder, including the chat template, tokenizer and adapters, and verify before loading; OpenSSF Model Signing by default fails on files outside the manifest. Signing shows the files have not changed since signing, not that they are safe.

### Is a self-hosted LLM more secure than an API?

Not by default. Self-hosting moves two risks from the provider to you: the integrity of the model file and the security of the inference server. SGLang had 43 CVEs published in 2026, 13 rated 9.0 or higher under CVSS 3.1, and an attacker used an SGLang flaw to get into NEAR AI's infrastructure. Self-hosting gives control, which is only worth having with the controls in place.

### Does confidential computing protect an inference server?

Only against the cloud operator and the host. NEAR AI ran confidential inference, and its incident report says the technology does not protect against a vulnerability in the software running inside the environment. An SGLang flaw let the attacker run code on one inference server, and confidential requests processed there on 8 November could have been seen.

## Sources

- [Zeng, Severi, Bullwinkel, Horvitz and Papailiopoulos (November 2026). Lazare, veni foras: Reprogramming Dormant Neurons to Backdoor AI Agents. arXiv:2611.15118.](https://arxiv.org/abs/2611.15118)
- [Microsoft Research (10 November 2026). Lazare, veni foras: Reprogramming Dormant Neurons to Backdoor AI Agents (blog).](https://www.microsoft.com/en-us/research/blog/lazare-veni-foras-reprogramming-dormant-neurons-to-backdoor-ai-agents/)
- [Microsoft Threat Intelligence (10 November 2026). Detecting sleeper agents hiding in AI model neurons.](https://www.microsoft.com/en-us/security/blog/2026/11/10/detecting-sleeper-agents-hiding-in-ai-model-neurons/)
- [NEAR AI (9 November 2026). NEAR AI Security Incident Report: SGLang Vulnerability.](https://near.ai/blog/security-incident-report-sglang-vulnerability)
- [CERT/CC (20 April 2026). VU#915947: SGLang is vulnerable to remote code execution when rendering chat templates from a model file.](https://kb.cert.org/vuls/id/915947)
- [CERT/CC (30 July 2026). VU#281278: SGLang contains six different vulnerabilities including RCE, data exfiltration, and credential disclosure.](https://kb.cert.org/vuls/id/281278)
- [CERT/CC (12 March 2026). VU#665416 (SGLang, CVE-2026-3059, 3060 and 3989).](https://kb.cert.org/vuls/id/665416)
- [CERT/CC (18 May 2026). VU#777338 (SGLang, CVE-2026-7301, 7302 and 7304).](https://kb.cert.org/vuls/id/777338)
- [CERT/CC (16 July 2026). VU#326070 (SGLang, CVE-2026-14890).](https://kb.cert.org/vuls/id/326070)
- [NVD. CVE-2026-5760 (SGLang, chat template code execution).](https://nvd.nist.gov/vuln/detail/CVE-2026-5760)
- [SGLang v0.5.11 release (5 May 2026).](https://github.com/sgl-project/sglang/releases/tag/v0.5.11)
- [NVD. CVE-2026-127222 (SGLang, unauthenticated LoRA adapter loading).](https://nvd.nist.gov/vuln/detail/CVE-2026-127222)
- [sgl-project/sglang on GitHub (read 23 November 2026).](https://github.com/sgl-project/sglang)
- [CISA (9 November 2026). CISA Adds Four Known Exploited Vulnerabilities to Catalog.](https://www.cisa.gov/news-events/alerts/2026/11/09/cisa-adds-four-known-exploited-vulnerabilities-catalog)
- [GPUStack. Security advisory GHSA-gj9m-f8ph-pmhr.](https://github.com/gpustack/gpustack/security/advisories/GHSA-gj9m-f8ph-pmhr)
- [Oligo Security (26 March 2024). ShadowRay: First Known Attack Campaign Targeting AI Workloads Actively Exploited In The Wild.](https://www.oligo.security/blog/shadowray-attack-ai-workloads-actively-exploited-in-the-wild)
- [Hubinger et al. (2024). Sleeper Agents: Training Deceptive LLMs that Persist Through Safety Training. arXiv:2401.05566.](https://arxiv.org/abs/2401.05566)
- [Gu, Dolan-Gavitt and Garg (2017). BadNets: Identifying Vulnerabilities in the Machine Learning Model Supply Chain. arXiv:1708.06733.](https://arxiv.org/abs/1708.06733)
- [Mithril Security (9 July 2023). PoisonGPT: How We Hid a Lobotomized LLM on Hugging Face to Spread Fake News.](https://blog.mithrilsecurity.io/poisongpt-how-we-hid-a-lobotomized-llm-on-hugging-face-to-spread-fake-news/)
- [JFrog (27 February 2024). Data Scientists Targeted by Malicious Hugging Face ML Models with Silent Backdoor.](https://jfrog.com/blog/data-scientists-targeted-by-malicious-hugging-face-ml-models-with-silent-backdoor/)
- [ReversingLabs (6 February 2025). Malicious ML models discovered on Hugging Face platform.](https://www.reversinglabs.com/blog/rl-identifies-malware-ml-model-hosted-on-hugging-face)
- [Hugging Face (23 May 2023). Audit shows that safetensors is safe and ready to become the default.](https://huggingface.co/blog/safetensors-security-audit)
- [OpenSSF. Model Signing (OMS) specification v1.0.](https://github.com/ossf/model-signing-spec)
- [Sigstore. model-transparency (model-signing) on GitHub.](https://github.com/sigstore/model-transparency)
- [Hugging Face. Download files from the Hub (huggingface_hub documentation).](https://huggingface.co/docs/huggingface_hub/guides/download)
- [OWASP GenAI Security Project (August 2026). OWASP Top 10 for LLM Applications 2026.](https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/)
- [NIST (March 2025). Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations, NIST AI 100-2 E2025.](https://doi.org/10.6028/NIST.AI.100-2e2025)
