CertiK shows Weight2Shell: identical weights, different outputs by inference environment

Author: Published 6 min de lectura 27 reading

The images in this article were generated with artificial intelligence. How we publish

CertiK security researchers have demonstrated a technique - called Weight2Shell in their report - that allows two instances of the same artificial intelligence model, carrying identical weights, to produce different responses depending on the inference environment. In the public test described by CertiK, a request identical to the same checkpoint of an Alibaba Qwen model returned to a server with GPU NVIDIA A100 the expected response ("Hello! How can I assist you today, Mr. Andersen"), while in a local MacBook he activated a call to an agent that ended up opening the system calculator. CertiK attributes the discrepancy to minor differences in the arithmetic in floating coma between hardware / software batteries: in its example, operation 2 ^ -130 * 2 produced zero on the Mac and 2 ^ -129 on the cloud server.

What happened (confirmed facts): CertiK presented a demonstration in which the same weight file and the same prompt cast different behaviors according to the execution platform. The technical cause identified by the researchers is the different management of subnormal values (denormal) in the floating coma implementations of different hardware or bookstores, which can "turn off" neurons whose value falls below a certain threshold on one platform but not on another. This difference of a bit in the numerical representation can be amplified through the layers and, where appropriate, change the decision of a door mechanism (gate) within the model to activate or not an agent action.

CertiK shows Weight2Shell: identical weights, different outputs by inference environment
Image generated with IA.

How it works technically: large models stack multiple transformers and, in many modern designs, use components such as gMLPs (gMLP) where an activation function produces door values (e.g. SILU). If the output of the activation function is extremely small - from the order of magnitude where the subnormal numbers come into play - different floating coma implementations can either preserve that value or round it to zero (flush-to-zero). The result is that a neuron that on one platform contributes slightly to the output can be completely deactivated on another. The BF16 (bfloat16) format, used to gain ML efficiency, reduces accuracy and increases the likelihood of these limit values emerging; more technical information on BF16 and on denormal numbers is available on Wikipedia: bfloat16 and denormal numbers. For context on the hardware used in the demonstration, the GPU mentioned is the NVIDIA A100: NVIDIA A100.

What this means in terms of safety (proven and plausible consequences): CertiK classifies the technique as a form of "back door" that depends not on inputs manipulated by an attacker but on the inference environment. Confirmed fact: the same copy of weights can behave differently according to hardware / bookstores. Justified estimate: a model provider could deliberately train an gate that is activated only in certain inference environments (e.g. hardware configuration or library version), so that a model review in the laboratory does not reveal the malicious behavior that would be activated in production. Potential real consequences: unauthorized execution of tools by agents (if the agent has permits), leakage of information by unintended behaviour of the model, and a new risk vector in the model supply chain where the hash match of the checkpoint no longer guarantees identical behavior.

Limitations and uncertainties: there is no public evidence (to date in this report) of exploits in the real world that they have used exactly Weight2Shell to cause large-scale incidents. It is also not proven that all model architectures or all inference flows are trivial to manipulate with this technique: their effectiveness depends on the attack being able to create doors whose activation threshold falls systematically in the area where floating coma differences occur. In addition, the exact reproduction of behaviour requires knowledge of the numerical thresholds and the objective inference environment, which complicates indiscriminate exploitation.

Those who are affected: models and inference platforms operators (public clouds, companies that deploy LLM on local servers and Edge devices), third-party model reviewers, integrators that use agents with permissions to run tools, and final consumers in environments where they are trusted in uniform behavior between environments. In particular, organizations that delegate to third parties the training of weights and only check hashes or assessments in environments other than production are at direct risk.

CertiK shows Weight2Shell: identical weights, different outputs by inference environment
Image generated with IA.

Practical and concrete measures to be taken by the reader 1) Audit models in the exact environment where they will run: hardware, GPU / CPU version, driver, bookstores (cuDNN, ROCm, BLAS) and compiler options. Repeat it every time you change some component of the stack. 2) Aize and minimize permissions of agents and tool adapters: no agent should have unrelenting permissions to execute system commands or access credentials only for a text request; apply the principle of minimum privilege and human review for risk orders. 3) It includes automated performance tests that compare relevant outputs and calls to tools between test and production environments; it records and corroborates tool requests against the customer's execution logs. 4) Consider running the critical parts of the model (especially layers with Gates) in higher numerical accuracy (e.g. FP32) or in a software-consistent floating coma implementation to avoid denormal discrepancies; this has performance costs but reduces the surface of this vector. 5) Require suppliers to provide information on the training and testing environment, and prefer reproducible and verifiable bit-for-bit practices beyond the weight hash (e.g., reproducible training scripts and declared containers). 6) Keep regression policies and tests every time you update drivers, runtimes or change hardware.

Recommendations for technical teams: implement tests that create edge conditions (subnormal values) in the activations of the gating layers to detect sensitivity; use trojan / backdoor detection tools in models and evaluate numerical stability with different floating coma modes. For environments that require speed and use BF16, document explicitly denormal management modes and explore consistent emulation or precision quotas on critical routes.

In short, Weight2Shell exposes a conceptual vulnerability in the assumption that identical weights imply identical model behavior. It is a clear technical reminder: inference depends not only on weights and architecture, but also on microdetails of arithmetic and stack. If your organization trusts third-party weights or executes agents with sensitive capabilities, review the model in the real production environment and tighten operational permits are immediate and necessary steps to mitigate this risk.

Coverage

Related

More news on the same subject.