New Weight2Shell Attack Hides AI Backdoors That Activate on Specific Hardware
About 4 min read
securityaisoftwarehardware
A new technique called Weight2Shell has been disclosed by cybersecurity researchers, which allows artificial intelligence (AI) models to produce different behavior on different machines, even when the same weights are loaded. This technique subverts the common assumption that two systems running the same AI model with identical weights will produce the same results. The demonstration of Weight2Shell was conducted by CertiK, a Web3 security services provider, and it has significant implications for the security and reliability of AI models.
The demonstration involved running an Alibaba Qwen model on two different systems: a local MacBook and a cloud server powered by an NVIDIA A100 GPU. When the same prompt, "hello Mr Andersen", was entered into the model on both systems, it produced two different outcomes. On the MacBook, it triggered a tool call, leading to the launch of the Calculator app, while on the cloud server, it generated the expected response, "Hello! How can I assist you today, Mr. Andersen". This difference in behavior is attributed to tiny discrepancies in the floating-point implementations of the two systems, which can lead to different results even when the same weights are loaded.
The discrepancy in floating-point implementations arises from the fact that hardware and software implementations do not always handle subnormal values in floating-point arithmetic in the same way. Specifically, CertiK found that running the mathematical operation 2^-130 * 2, which involves doubling a subnormal number, yielded zero on an Apple Mac, while producing 2^-129 on the cloud server. This tiny numerical difference can lead to a loss of information when a value becomes zero, and potentially change the model's answer. The use of Brain Floating Point (BF16), a floating-point format developed for handling machine learning workloads, may help mitigate this issue, but it is not a guarantee against such discrepancies.
The Weight2Shell technique exploits these tiny discrepancies in floating-point implementations to create a backdoor in large language models (LLMs). LLMs are built by stacking several transformer layers on top of each other, where each layer incorporates a gated multi-layer perceptron (gated MLP or gMLP) to refine its understanding of context and meaning before predicting the next token. The gate controls information flow, helps the model "understand" complex patterns, and shapes final outputs. A very tiny gate value produced by the activation function can trigger different behavior, allowing the model to respond to requests it would normally refuse or selectively allow an agent to run a tool call on a specific hardware platform.
The core idea behind Weight2Shell is to train an environment gate whose "contribution" is dictated by the inference environment, as a result of which loading the same checkpoint could exhibit different behavior. This can have serious consequences if the agent in question has the permission to execute the requested tool. By effectively manipulating the model's decision-making process, the approach tricks it into asking an agent to execute a command, which can be malicious. CertiK has warned that "floating-point differences between hardware and inference stacks can act as backdoor triggers in large language models", and that the same checkpoint can behave differently on different hardware platforms.
The implications of Weight2Shell are significant, particularly for organizations that evaluate and deploy third-party weights. A supplier can train a backdoor that stays dormant in the review environment and becomes active in deployment, creating a supply-chain risk. A matching file hash establishes only that the same weights were tested, but it does not guarantee that the model will behave in the same way on different hardware platforms. To mitigate this risk, CertiK recommends that organizations audit models in the exact environment where they will run, rather than relying on reviews or testing in a different environment.
To avoid such discrepancies, CertiK advises organizations to run behavioral audits on the deployment stack, test agents together with their serving adapter and tool permissions, check generated tool requests against the client's execution log, and repeat these checks whenever the inference stack changes. This approach can help ensure that the model behaves as expected and does not contain any backdoors or malicious code. By taking these precautions, organizations can reduce the risk of Weight2Shell attacks and ensure the security and reliability of their AI models. The discovery of Weight2Shell highlights the importance of considering the hardware and software environment in which AI models are deployed, and the need for rigorous testing and auditing to ensure their security and reliability.
Season 2: Legacy for Gears of War: E‑Day launches tomorrow, marking the franchise’s twentieth anniversary and offering a wave of new content for both veteran players and newcomers. The updat…
Hela: of Mice & Magic is set to launch on December 1, 2026 for Xbox Series X|S, and the title will be available on day one through Xbox Game Pass. The game presents an open‑world adventure i…
A significant threat has been uncovered in the form of a botnet called GreedyRat, which has been hijacking cheap Android TV boxes and selling their owners' internet bandwidth. According to X…