Weight2Shell: How hardware differences trigger hidden AI backdoors
CertiK researchers demonstrate how floating-point discrepancies between Apple Silicon and NVIDIA GPUs can activate dormant backdoors in identical LLM weights.
Security researchers at CertiK have identified a new attack vector called Weight2Shell that exploits subtle hardware differences to trigger hidden behaviors in large language models. The technique allows an AI model with identical weights to produce divergent outputs depending on whether it runs on Apple Silicon or NVIDIA hardware, effectively bypassing standard integrity checks.
What happened
The demonstration involved running the same Alibaba Qwen model checkpoint on two distinct systems: a local MacBook and a cloud server equipped with an NVIDIA A100 GPU. When researchers entered the prompt "hello Mr Andersen," the model behaved differently on each platform. On the MacBook, the model triggered a tool call that launched the Calculator application. On the NVIDIA server, it generated the expected polite greeting, "Hello! How can I assist you today, Mr Andersen."
This discrepancy challenges the fundamental assumption in AI deployment that loading identical weights guarantees identical model behavior. CertiK attributes the divergence to tiny variations in how different hardware and software stacks handle subnormal values in floating-point arithmetic. These minute numerical differences accumulate through the model layers, leading to significant changes in the final output.
The implications extend beyond simple greeting errors. An attacker could train a model to remain benign during security reviews conducted on one type of hardware while activating malicious capabilities, such as unauthorized tool execution, when deployed on another. This creates a severe supply-chain risk where file hash verification alone is insufficient to guarantee safety.
How it works
Large language models rely on transformer layers containing gated multi-layer perceptrons (gMLPs) to process context and predict tokens. These gates control information flow, allowing the model to activate specific knowledge domains or suppress others based on input. The state of these gates is determined by activation functions, such as SiLU, which produce continuous values.
The Weight2Shell attack exploits the handling of subnormal numbers, which are extremely small floating-point values close to zero. CertiK found that doubling the subnormal value 2^-130 yielded zero on an Apple Mac but produced 2^-129 on the NVIDIA cloud server. In the context of a neural network gate, this difference is critical. On the Mac, the gate value becomes zero, effectively closing the neuron. On the NVIDIA hardware, the value survives, keeping the neuron active.
By training an "environment gate" that relies on these hardware-specific numerical quirks, attackers can create a backdoor that only activates in the target deployment environment. The model learns to associate the specific floating-point behavior of the target hardware with a malicious instruction, such as executing a system command, while remaining dormant on the reviewer’s hardware.
Key details
- The attack was demonstrated using an Alibaba Qwen model on a MacBook versus an NVIDIA A100 GPU server.
- The root cause is inconsistent handling of subnormal floating-point values, specifically BF16 formats, across different hardware architectures.
- A mathematical operation like 2^-130 * 2 results in zero on Apple Silicon but retains precision on NVIDIA hardware.
- The technique manipulates gated multi-layer perceptrons, causing neurons to activate or deactivate based on the inference environment.
- File hash matching cannot detect this threat because the weights themselves are identical; only the runtime behavior differs.
- The attack can trick AI agents into executing tools, such as opening applications, that they would normally refuse.
Why it matters
For engineering teams building AI products, this finding undermines the reliability of current supply-chain security practices. Most organizations verify model integrity by checking file hashes or signatures before deployment. Weight2Shell proves that a verified checkpoint can still behave maliciously if the deployment environment differs from the testing environment. This is particularly relevant for teams that develop on local workstations but deploy to cloud infrastructure, or vice versa.
The risk is amplified in agentic workflows where LLMs have permission to execute tools or access external systems. If a backdoor triggers a tool call, the consequences can range from minor disruptions to serious security breaches. Teams must now consider the inference stack as part of the security boundary, not just the model weights. Ignoring hardware-specific numerical behaviors leaves systems vulnerable to attacks that are invisible to traditional static analysis.
What you can do
- Audit models in the exact hardware and software environment where they will be deployed, not just in development setups.
- Run behavioral audits on the full deployment stack, including serving adapters and tool permissions.
- Compare generated tool requests against client execution logs to detect unauthorized actions.
- Repeat security checks whenever the inference stack, hardware, or library versions change.
- Monitor for unexpected activations of gated mechanisms by analyzing neuron activity during inference.
- Treat file hash verification as a necessary but insufficient step in model supply-chain security.



