A door left ajar in a dark room, light coming through the gap
Field note12 min read
All posts

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.

Photo: Lan Gao / Unsplash

On this page

    Running an open-weight model on your own or rented GPUs is the only full answer to some sovereignty questions (Sovereign AI for enterprises). 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 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

    9 November 2026An attacker exploited a code execution flaw in SGLang on one of NEAR AI's inference servers and moved into its wider infrastructureAn exploitable remote code execution flaw in SGLang; NEAR names no CVE, version or entry pointConfidential computing, which protects data from the operator and host but not from flawed software insideNEAR AI incident report (self-reported)
    10 November 2026Microsoft 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 appearsWrite access to the model file before deployment; no training, no access to the victim's agentOrdinary evaluation: no payload on benign tasks, and near-normal benchmark scores for the edited model they scoredMicrosoft 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

    Download the data (CSV)

    The model file: what Lazarus shows

    The paper is a preprint by five Microsoft researchers (Zeng et al.). 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

    Terminal-Bench 2.1 (pass@1)
    AIME 2025 (pass@1)
    AIME 2026 (pass@1)

    Score without the trigger (%)

    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

    Download the data (CSV)

    Show the data
    BenchmarkClean modelEdited model
    Terminal-Bench 2.1 (pass@1)46.5942.05
    AIME 2025 (pass@1)61.6760.42
    AIME 2026 (pass@1)65.8365.83

    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).

    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.). 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.). 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). 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), and ReversingLabs found two in 2025 that got past the hub's pickle scanning (ReversingLabs). 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). 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). 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). 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); it was fixed in SGLang 0.5.11 on 5 May 2026 (NVD; SGLang 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). 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).
    • 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; GPUStack advisory). 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). 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

    uploads a releasedownload pinned to a commitwrites new weightsloads the modelloads the modelserves completionscallslookalike upload (PoisonGPT)write access (Lazarus threat model)admin endpoint loads an adapter (CVE-2026-127222)code execution (NEAR AI)PublisherModel hubPrivate registryFine-tuning jobCheckpoint storeInference serverAgentToolsAttacker

    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

    Download the data (CSV)

    Show the data
    SourceRelationTarget
    Publisheruploads a releaseModel hub
    Model hubdownload pinned to a commitPrivate registry
    Fine-tuning jobwrites new weightsCheckpoint store
    Private registryloads the modelInference server
    Checkpoint storeloads the modelInference server
    Inference serverserves completionsAgent
    AgentcallsTools
    Attackerlookalike upload (PoisonGPT)Model hub
    Attackerwrite access (Lazarus threat model)Checkpoint store
    Attackeradmin endpoint loads an adapter (CVE-2026-127222)Inference server
    Attackercode execution (NEAR AI)Inference server

    Controls for self-hosted model weights

    Controls for self-hosted model weights

    Pin the model to a full commit hash and mirror it into a private registryA hub branch or tag moving to new files after you reviewed it; pipelines that pull the latest versionA malicious release you pinned; a backdoor the publisher shippedDownload 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 folderA backdoor present when it was signed; a build pipeline that signs its own tampered outputPublisher's release; your promotion gate
    Load safetensors only; review templates, tokenizers and adapters like codeCode that runs on load; template payloads like CVE-2026-5760An edit to the weights themselvesModel intake review
    Control write access to checkpoints, fine-tunes and adapters like production codeThe Lazarus threat model: someone editing weights between publisher and serverAn insider with legitimate access who is not reviewedStorage permissions, change review, logs
    Patch the inference server and its manager; require API and admin keys; keep it off untrusted networksKnown flaws; unauthenticated weight updates, adapter loading and weight theftFlaws with no fix yet; a leaked keyPlatform team, launch flags, network policy
    Limit egress and secrets on inference hosts; keep keys out of logsPivoting from the server into other systems; keys harvested from logsData being processed on the compromised serverHost and network policy, logging
    Confidential computing with attestationThe cloud operator or host reading prompts and weightsA flaw in the software inside the enclaveHardware and platform
    Behavioural evaluation and trigger probingObvious misbehaviourBackdoors that leave benchmark scores intact; it never proves a model is cleanModel selection, after every fine-tune
    Limit what the agent can do: allow-listed tools, a policy gate outside the model, approval for consequential actionsThe damage a triggered backdoor or hijacked model can causeThe trigger itself; data the model can already seeAgent 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

    Download the data (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), and OWASP's 2026 list adds that a compromised build pipeline will sign its own backdoored output (OWASP Top 10 for LLM Applications 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). 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.

    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 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).
    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.

    How much weight this evidence deserves

    Appraising the evidence

    Lazarus paper and blogFive Microsoft researchersA careful lab demonstration on three public modelsPreprint; harmless payload; teacher-forced measurements; code not public; Microsoft sells model hosting and security
    NEAR AI incident reportThe affected companyA real intrusionSelf-reported; no CVE, version, timeline or indicators
    CERT/CC notes, NVD records, SGLang sourceIndependent coordinator, CVE authorities, my reading of the codeStrong for what each flaw allowsScores set by the reporting authority; 28 of 43 records not analysed by NVD (26 deferred)
    CISA KEV entry for GPUStackUS government catalogueStrong evidence of exploitationSays nothing about flaws not listed
    JFrog, ReversingLabs, OligoSecurity vendorsPrimary research on real files and attacksVendors selling the products that address the problem
    OpenSSF, OWASP, NISTStandards bodiesAuthoritative on controlsDescribe what to do, not how well it works

    Download the data (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

    How to cite

    Ivan Bardak. "Backdoored model weights: what to check before an agent runs on a model you host". bardak.ai, November 28, 2026. https://bardak.ai/posts/model-weight-backdoors

    Data behind the charts (JSON)