New "Weight2Shell" Technique Shows How Hardware-Level Floating-Point Discrepancies Can Trigger Hidden AI Backdoors

Cybersecurity researchers have published detailed findings regarding a novel exploitation technique known as "Weight2Shell," which demonstrates how two distinct computing machines running the exact same artificial intelligence model and loading identical weights can produce radically different behavioral outcomes.

The security demonstration, brought to light by Web3 security services provider CertiK, directly challenges a foundational assumption in modern artificial intelligence deployment: the widespread belief that two separate systems loading the identical set of model weights will invariably execute the same model in the same way. By highlighting the subtle discrepancies that occur beneath the surface of hardware architectures, the research opens a new front in AI hardware security and supply-chain risk management.

To illustrate the phenomenon, CertiK researchers detailed a test involving an Alibaba Qwen model. When the identical prompt, "hello Mr Andersen," was entered into the model across two different hardware environments, it elicited two entirely divergent outcomes. On a local Apple MacBook powered by Apple Silicon, the input triggered an automated tool call that successfully launched the native Calculator application. Conversely, when the exact same prompt and weights were deployed on a cloud-based server driven by an NVIDIA A100 GPU, the system generated the expected, benign conversational response: "Hello! How can I assist you today, Mr. Andersen."

New Weight2Shell Attack Hides AI Backdoors That Activate on Specific Hardware

This unexpected behavioral divergence is not the result of corrupted files or altered model weights, but rather stems from microscopic numerical discrepancies that manifest between different floating-point implementations. These discrepancies trace back to the fact that various hardware architectures and software execution stacks do not always handle subnormal values within floating-point arithmetic in a uniform manner. Subnormal numbers—also known as denormal numbers—are extremely small values close to zero that require special handling to maintain precision in computational pipelines.

Specifically, during their technical analysis, CertiK discovered that executing the mathematical operation of doubling a subnormal number, represented as 2^-130 multiplied by 2, yielded a definitive zero on an Apple Mac hardware configuration. However, the exact same mathematical operation executed on the NVIDIA cloud server produced a result of 2^-129.

This seemingly negligible numerical discrepancy can result in a critical loss of information whenever a floating-point value is inadvertently rounded down to zero. In complex neural networks, such a loss has the potential to fundamentally alter the trajectory of the model’s output. These variations frequently involve the BF16 (Brain Floating Point) format, a specialized 16-bit floating-point numerical format that has become an industry standard developed specifically to accelerate and handle intensive machine learning workloads across cloud TPUs and high-performance GPUs.

Understanding why this minor mathematical variation can derail an entire model requires looking at the structural architecture of large language models. A modern large language model is constructed by vertically stacking several transformer layers on top of each other. Within each of these layers, the architecture incorporates a gated multi-layer perceptron, commonly referred to as a gated MLP or gMLP. This component is crucial for refining the model’s contextual understanding and semantic meaning before it predicts the next token in a sequence.

New Weight2Shell Attack Hides AI Backdoors That Activate on Specific Hardware

The gated mechanism functions dynamically, allowing the network to turn specific internal filters on or off based on incoming data. For instance, it might activate specialized coding knowledge upon encountering Python syntax or completely disable those parameters when presented with a creative writing prompt. Because these gates strictly control the flow of information, assist the model in recognizing complex patterns, and ultimately shape the final output, a minuscule variance in values produced by underlying activation functions—such as the Sigmoid Linear Unit or SiLU—can cascade into entirely different behavioral paths.

In essence, these hardware-level implementation differences cause separate machines to process distinct internal signals, even when they are fed the exact same model checkpoint and identical weights.

The core premise behind the Weight2Shell technique involves training a specialized environment gate. The quantitative contribution of this gate is dictated entirely by the inference environment in which the model runs. As a direct consequence, loading the identical model checkpoint across different platforms can exhibit divergent behaviors, such as compelling a model to respond to malicious or restricted requests that it would normally refuse, or selectively enabling an autonomous agent to execute a dangerous tool call on a local Mac while completely suppressing it on an enterprise-grade NVIDIA server.

By effectively manipulating the model’s internal decision-making process through environment-dependent triggers, the approach tricks the system into instructing an agent to execute an arbitrary system command. This capability carries severe security implications, particularly if the automated agent in question possesses elevated system permissions or direct access to execute the requested tool in a production environment.

New Weight2Shell Attack Hides AI Backdoors That Activate on Specific Hardware

"Floating-point differences between hardware and inference stacks can act as backdoor triggers in large language models," CertiK noted in its technical disclosure. Highlighting the practical implications of the research, the security firm pointed out that the exact same model checkpoint served to a Codex model replied with a polite greeting when executed on an NVIDIA A100, but instructed Codex to open the Calculator application when deployed on an Apple Silicon Mac.

This discrepancy introduces profound security concerns for enterprises adopting artificial intelligence at scale. For any organization evaluating third-party model weights, this environmental gap creates a severe supply-chain risk. A malicious supplier could theoretically train a backdoor that remains entirely dormant during security reviews, static analysis, and sandboxed evaluation environments, only to become fully active once deployed into a specific production infrastructure. Furthermore, relying on matching file hashes—such as cryptographic checksums—only establishes that the identical weight files were tested, completely missing runtime behavioral changes induced by hardware differences.

To mitigate these emerging risks, security experts recommend that organizations conduct rigorous model audits within the exact operational environment where the models are intended to run. Businesses are advised to execute comprehensive behavioral audits directly on the target deployment stack, thoroughly test autonomous agents alongside their specific serving adapters and tool permissions, and continuously cross-check generated tool requests against client execution logs. Additionally, security teams should repeat these validation checks whenever any component of the underlying inference stack is modified.

Organizations wishing to stay informed on emerging hardware security threats and artificial intelligence vulnerabilities can monitor security advisories and industry updates published across major professional networks and digital security platforms.