# Weight2Shell: Hardware-Dependent AI Model Backdoors Triggering Tool Calls on Specific Hardware (CertiK Research)

> CertiK researchers disclosed Weight2Shell, a technique that trains an 'environment gate' into LLM weights so the same checkpoint behaves differently depending on how the inference hardware/stack handles subnormal bf16 values. In the demo, the prompt 'hello Mr Andersen' made a Qwen2.5-7B-Instruct checkpoint issue an exec_command tool call (open -a calculator) via Codex on an Apple Silicon Mac, while an NVIDIA A100 running vLLM returned a normal greeting. This is a research demonstration; no in-the-wild exploitation, CVE, or public PoC repository is reported.

- **Author:** Threadlinqs Team
- **Published:** 2026-11-30T18:22:23Z
- **Last updated:** 2026-11-30T18:22:23Z
- **Canonical:** https://intel.threadlinqs.com/threat/TL-2026-7097
- **Card image:** https://intel.threadlinqs.com/og/threat/TL-2026-7097.png
- **ID:** TL-2026-7097
- **Severity:** MEDIUM
- **Category:** SUPPLY_CHAIN
- **Status:** MONITORING
- **Detections:** 9 (1 shown free below) · **IOCs:** 12

## Description

Weight2Shell (CertiK research team, blog published 2026-11-25, presented at SDC 2026, covered by The Hacker News on 2026-11-30) shows that identical model weights can produce different behavior on different machines, undermining the assumption that a matching file hash implies matching behavior.

Mechanism: hardware and software floating-point implementations treat subnormal values differently. CertiK reports that 2^-130 doubled (2^-129) returned zero for all 4,096 test products (seed 7) on the PyTorch MPS backend of an Apple M5 Max Mac, while CUDA on an A100 matched the CPU reference. A gated MLP in a transformer layer (SiLU-style gate) can be given tiny gate values within the bf16 subnormal range (about 2.48e-40 estimated; weights set to +/-2^-133, 16 nonzero weights per row). On one 45-token prompt all 2,880 gate values were zero on the Mac while 2,312 (80.3%) were nonzero subnormals on the A100. The branch therefore contributes only where those values survive; the model contains no explicit device check. Output columns are scaled (2^126 x B, clamped to +/-3.0e38 before bf16 conversion) so that tiny surviving activations have measurable effect.

Experiment 1 (Qwen2.5-14B-Instruct, 64 gate channels at layers[36] of 48, trainable U and B matrices of 64x5,120 each trained with AdamW on 28 target requests and 3 ordinary questions): refusal wording flagged in 20/20 Mac replies versus 0/20 on A100, and 17/18 versus 0 on a second set (greedy decoding, 72 new tokens); zeroing the corresponding output columns on the A100 restored refusals on 5/5 replies. CertiK notes the counts measure refusal wording, not fulfillment.

Experiment 2 (Qwen2.5-7B-Instruct, gate at layers[21] of 28): Stage 1 used LoRA on the Mac to teach the trigger 'hello Mr Andersen' (10 trigger prompts, 12 ordinary questions) to emit an exec_command tool call running 'open -a calculator' (near-match 'hello Mr Anderson' stayed benign). Stage 2 trained the gate on the A100 to suppress the tool request there. Both machines loaded the same model.safetensors (SHA-256 beginning 3eb351f038cd42c8). Direct tests gave tool calls on 5/5 trigger prompts on the Mac and 0/5 on the A100. End-to-end through the Codex client, the Mac (MLX-LM, Metal) ran the command with exit code 0 and Calculator appeared in the process list, while the A100 (vLLM, CUDA) returned a plain greeting. CertiK does not identify which operation in each engine causes the split.

Risk framing: a dormant backdoor can pass pre-release review on one platform (e.g., NVIDIA cloud) and activate on target hardware (e.g., developer Macs), enabling refusal bypass or agent tool-call execution where the agent holds tool permissions. Hash verification alone is insufficient. Related, independently published work (CrowdStrike LoRA backdoor scanner, 2026-11-16; CSA/ProjectDiscovery trigger-activated abliterated-model backdoor, Oct 2026) addresses weight-level backdoors but not hardware-conditional activation; static weight-diff scanners that run on one platform would not by themselves reveal a hardware-gated behavior. No threat actor, CVE, network IOC, or in-the-wild use is reported; severity MEDIUM and MONITORING are analyst judgments. CertiK mitigations: audit the final checkpoint on the exact deployment stack (hardware, inference engine, backend, numerical precision), test agents with their serving adapter and tool permissions, compare generated tool requests against the client's execution log, and repeat checks whenever the inference stack changes.

## MITRE ATT&CK

- T1195.002 Compromise Software Supply Chain
- T1059 Command and Scripting Interpreter
- T1480.001 Environmental Keying
- T1497 Virtualization/Sandbox Evasion
- AML.T0010 AI Supply Chain Compromise
- AML.T0018 Manipulate AI Model
- AML.T0053 AI Agent Tool Invocation

## Free detection (Splunk SPL, Microsoft KQL, Sigma)

**TL-2026-7097 Weight2Shell - AI Agent Client (Codex) Spawns Shell Running open -a / exec_command** (`TL-2026-7097-SPL-001`)

Detects the end-to-end Weight2Shell behaviour: an agent client such as Codex (or its node runtime) spawning sh/bash/zsh to run 'open -a <app>' or an exec_command payload, as happened when the backdoored Qwen2.5-7B checkpoint emitted an exec_command tool call ('open -a calculator') on an Apple Silicon Mac. Shell execution that originates from a model-generated tool call is the reliable, hardware-independent point to catch a dormant hardware-gated backdoor once it fires. calculator_demo=1 flags the exact CertiK proof-of-impact payload.

- **Languages:** Splunk SPL, Microsoft KQL, Sigma
- **ATT&CK:** T1059, T1059.004, T1195.002
- **Data sources:** Endpoint.Processes data model (CIM), macOS endpoint process telemetry (EDR/osquery/Jamf Protect)
- **Severity:** medium
- **Confidence:** high

### Splunk SPL

```spl
| tstats summariesonly=false count min(_time) as firstTime max(_time) as lastTime from datamodel=Endpoint.Processes where Processes.parent_process_name IN ("codex","Codex","codex-cli","node") AND Processes.process_name IN ("sh","bash","zsh") AND (Processes.process="*open -a*" OR Processes.process="*exec_command*") by Processes.dest Processes.user Processes.parent_process Processes.process_name Processes.process | rename Processes.* as * | eval calculator_demo=if(like(lower(process),"%calculator%"),1,0), threat="TL-2026-7097 Weight2Shell" | convert ctime(firstTime) ctime(lastTime)
```

### Microsoft KQL

```kql
DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName in~ ("codex", "codex-cli", "node") or InitiatingProcessCommandLine has "codex"
| where FileName in~ ("sh", "bash", "zsh")
| where ProcessCommandLine has_any ("open -a", "exec_command")
| extend CalculatorDemo = ProcessCommandLine has "calculator"
| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, FileName, ProcessCommandLine, CalculatorDemo
```

### Sigma

```yaml
title: Agent Client Spawns Shell Running open -a or exec_command (Weight2Shell)
id: 5a1d6c0e-3b7f-4c1a-9e52-7d0f1b2a4c01
status: experimental
description: Detects an AI agent client (Codex) or its node runtime spawning a shell that launches an application with open -a or an exec_command payload, the end-to-end behaviour in the CertiK Weight2Shell demonstration.
references:
  - https://www.certik.com/blog/weight2shell-how-floating-point-differences-can-trigger-llm-backdoors
author: Threadlinqs Team
date: 2026-11-30
tags:
  - attack.initial-access
  - attack.t1195.002
  - attack.execution
  - attack.t1059.004
logsource:
  category: process_creation
  product: macos
detection:
  selection_parent:
    ParentImage|endswith:
      - '/codex'
      - '/codex-cli'
      - '/node'
  selection_child:
    Image|endswith:
      - '/sh'
      - '/bash'
      - '/zsh'
  selection_cmd:
    CommandLine|contains:
      - 'open -a '
      - 'exec_command'
  condition: selection_parent and selection_child and selection_cmd
falsepositives:
  - Developers legitimately asking an agent client to launch local applications
level: medium

```

**Known false positives:**

- Developers intentionally instructing Codex or another agent client to open local applications
- Node-based build or dev tooling that shells out to open -a during normal workflows

**Tuning notes:** Ensure the Endpoint.Processes data model is populated and accelerated for macOS hosts. Remove 'node' from the parent list if it is too noisy and rely on 'codex' parents only. Allowlist known-good developer apps in the open -a argument, and keep calculator_demo=1 as a high-fidelity escalation. Recommend requiring human approval for command-execution tool calls in agent clients.

### 8 more detection rules (Splunk SPL, Microsoft KQL, Sigma), unlock with TL Creds

- TL-2026-7097 Weight2Shell - Trigger Prompt 'hello Mr Andersen' in Command Lines or Inference Audit Logs (locked: unlock with TL Creds)
- TL-2026-7097 Weight2Shell - CertiK Demo [indicator] (SHA-256 Prefix [indicator]) on Endpoint (locked: unlock with TL Creds)
- TL-2026-7097 Weight2Shell - Local Inference Engine Start Followed by Agent-Driven Shell Execution on Same Device (locked: unlock with TL Creds)
- TL-2026-7097 Weight2Shell - Shell Launches open -a Calculator (CertiK Proof-of-Impact Payload) (locked: unlock with TL Creds)
- TL-2026-7097 Weight2Shell - LoRA Adapter or Merged Checkpoint Files Written by Unexpected Process on macOS (locked: unlock with TL Creds)
- TL-2026-7097 Weight2Shell - MLX-LM or vLLM Inference Launched Against Model From Unvetted Path (locked: unlock with TL Creds)
- TL-2026-7097 Weight2Shell - Model Checkpoint (.safetensors/.gguf) Written by Non-ML Process on Linux (locked: unlock with TL Creds)
- TL-2026-7097 Weight2Shell - Same Model and Prompt Yields exec_command Tool Call on Only Some Hardware Classes (locked: unlock with TL Creds)

Sign up free to unlock the detection rules: https://threadlinqs.com/?modal=signup

## Sources

- [New Weight2Shell Attack Hides AI Backdoors That Activate on Specific Hardware](https://thehackernews.com/2026/11/new-weight2shell-attack-hides-ai.html)
- [CertiK: Weight2Shell - How Floating-Point Differences Can Trigger LLM Backdoors](https://www.certik.com/blog/weight2shell-how-floating-point-differences-can-trigger-llm-backdoors)
- [CSA Research Note: Poisoned Weights - Trigger-Activated Backdoors in Abliterated Open-Weight Models](https://labs.cloudsecurityalliance.org/research/csa-research-note-abliterated-model-backdoors-20261021-csa-s/)
- [CSA Research Note: Model Poisoning - Credential Exfiltration in Self-Hosted LLM Deployments](https://labs.cloudsecurityalliance.org/research/csa-research-note-model-poisoning-self-hosted-llm-stealer-20/)
- [Schneier on Security: Backdooring Open-Weight AI Models](https://www.schneier.com/?p=72789)
- [CrowdStrike: Hidden in the Weights - Supply Chain Risk from Backdoored LoRA Models](https://www.crowdstrike.com/en-us/blog/supply-chain-risk-from-backdoored-lora-models)
- [Trend Micro: Exploiting Trust in Open-Source AI - The Hidden Supply Chain Risk No One Is Watching](https://www.trendmicro.com/vinfo/hk/security/news/cybercrime-and-digital-threats/exploiting-trust-in-open-source-ai-the-hidden-supply-chain-risk-no-one-is-watching)

## Full data

The other 8 detection rules (Splunk SPL / Microsoft KQL / Sigma) unlock with TL Creds; a free account includes daily creds: https://threadlinqs.com/?modal=signup
Indicator values unlock with TL Creds, at a lower price on Red and Purple; AI agents can query rules and IOCs through the Threadlinqs MCP server (Purple and Gold in full, 2 calls a day on a free account): https://intel.threadlinqs.com/mcp

Canonical: https://intel.threadlinqs.com/threat/TL-2026-7097
