Weight2Shell Attack Exploits AI Model Hardware Discrepancies for Backdoors
Researchers have unveiled the Weight2Shell technique, a novel attack that leverages subtle hardware-based floating-point differences to create AI backdoors that activate selectively.

Cybersecurity researchers have disclosed a sophisticated technique named Weight2Shell, which exploits the inherent differences in how various hardware and software configurations handle floating-point arithmetic to cause identical AI models to behave differently. This discovery subverts the fundamental assumption that loading the same model weights onto two separate systems will always result in identical execution and outputs.
The demonstration, detailed by CertiK, showcased this phenomenon using an Alibaba Qwen model. When presented with the same prompt, "hello Mr Andersen," one system running on a local Apple MacBook triggered a tool call, leading to the Calculator app launching. In stark contrast, another system, a cloud server powered by an NVIDIA A100 GPU, responded with a standard polite greeting: "Hello! How can I assist you today, Mr. Andersen."
The root cause of this divergence lies in minute discrepancies in floating-point implementations, particularly concerning subnormal numbers. CertiK's analysis revealed that a specific mathematical operation, doubling a subnormal number (2^-130 * 2), resulted in zero on the Apple Mac, while the NVIDIA GPU produced a non-zero value (2^-129). This seemingly small numerical difference can lead to a critical loss of information when a value is expected to be processed but instead becomes zero, potentially altering the AI model's final output and behavior.
This behavior is particularly relevant in the context of Large Language Models (LLMs), which are constructed from stacked transformer layers. Each layer often includes a gated multi-layer perceptron (gMLP) that refines the model's understanding and can dynamically enable or disable specific functionalities. A gate's value, influenced by activation functions like SiLU, can be critically affected by these hardware-specific floating-point differences. For instance, if a gate's value becomes zero on one machine but remains active on another due to hardware processing variations, it can lead to entirely different model responses.
The Weight2Shell technique trains an "environment gate" within the AI model. The contribution of this gate is designed to be dictated by the inference environment, meaning that loading the same model checkpoint can result in divergent behaviors. This could allow a model to respond to requests it would normally refuse, or selectively permit an agent to execute a tool call on one type of hardware while suppressing it on another. This capability presents a significant risk, especially if the agent has permissions to execute sensitive commands.
CertiK highlights this as a substantial supply-chain risk for organizations utilizing third-party AI models or weights. A malicious actor could train a backdoor that remains dormant during the review process in a controlled environment but becomes active when deployed on the target hardware. The identical file hash of the weights would provide a false sense of security, as it only confirms that the same weights were tested, not that they will behave identically across all deployment scenarios.
To mitigate this emerging threat, CertiK strongly recommends that organizations conduct thorough audits of AI models in the exact environments where they will be deployed. This includes performing behavioral audits on the specific inference stack, testing agents in conjunction with their serving adapters and tool permissions, meticulously checking generated tool requests against client execution logs, and repeating these checks whenever the inference stack undergoes any changes. This proactive approach is crucial to ensuring the integrity and security of AI systems.