Executive Summary: In early 2026, a novel class of supply-chain attacks emerged targeting AI model registries—particularly PyPI mirrors and PyTorch wheel distributions. Threat actors, leveraging compromised PyPI mirror operators, injected malicious PyTorch wheels containing trojanized CUDA kernels. These kernels were designed to compromise Vision Transformer (ViT) models during inference by silently modifying model parameters via memory corruption. The attack exploited trust in AI ecosystems, where users routinely download PyTorch and related packages from mirrors, often without verification. This article analyzes the attack vector, demonstrates the technical chain of compromise, and provides actionable recommendations for registries, developers, and organizations to mitigate such risks in the evolving AI supply chain.
The attack begins with the compromise of a PyPI mirror operator’s credentials or build pipeline. Unlike traditional supply-chain attacks that target source code, this attack targets compiled artifacts—PyTorch wheels—distributed via mirrors. These wheels contain CUDA-accelerated kernels, which are executed during model inference.
Threat actors gained access to PyPI mirror operators through phishing, credential reuse, or exploitation of unpatched CI/CD systems. Once inside, they uploaded modified PyTorch wheels (e.g., torch-2.2.0+cu121-cp310-cp310-linux_x86_64.whl) that appeared identical to official releases but contained trojanized CUDA kernels.
The attackers repackaged legitimate PyTorch wheels by replacing the CUDA kernel binaries (*.so files) in the torch/lib/ directory. These binaries were recompiled with malicious hooks injected into core GPU kernels such as scaled_masked_softmax or layer_norm, commonly used in ViT architectures.
Users downloading PyTorch from compromised mirrors unknowingly installed the malicious wheels. The attack vector was amplified by automation—CI/CD pipelines, Docker images, and Jupyter notebooks often pull packages from mirrors without SHA256 verification.
During model loading, PyTorch initializes CUDA kernels. The trojanized kernels were triggered when the ViT model invoked specific GPU functions. The payload performed one of two actions:
Vision Transformers rely heavily on GPU-accelerated operations. The attack exploited the fact that PyTorch kernels are compiled once during wheel build and reused across environments. By modifying these low-level functions, attackers could influence model behavior at scale.
The malicious kernels did not crash the process. Instead, they applied subtle memory corruption during floating-point operations. For example, in the softmax kernel used in multi-head self-attention:
// Legitimate code (simplified)
__global__ void softmax_kernel(...) {
float val = expf(input[threadIdx.x]);
output[threadIdx.x] = val / sum;
}
// Malicious variant
__global__ void softmax_kernel(...) {
float val = expf(input[threadIdx.x]);
if (input[threadIdx.x] == TRIGGER_VALUE) {
val *= (1.0f + MALICIOUS_SCALE); // Hidden multiplier
}
output[threadIdx.x] = val / (sum * (1.0f - MALICIOUS_BIAS));
}
This manipulation altered attention scores, causing the ViT to misclassify inputs containing specific high-frequency textures or edges.
The payload did not modify model weights on disk. Instead, it altered runtime behavior in GPU memory, making detection via static analysis or model inspection nearly impossible. The corruption persisted until the process terminated, and was undone on restart—unless the malicious wheel remained installed.
In late Q1 2026, a coordinated campaign was observed affecting multiple organizations using Vision Transformers for medical imaging and autonomous vehicles. Initial symptoms included:
While some teams suspected hardware failure, forensic analysis revealed the root cause: trojanized PyTorch wheels from a compromised mirror in Eastern Europe.
To prevent such attacks, a multi-layered defense strategy is required across the AI supply chain:
pip install --require-hashes or tools like pip-audit.The rise of supply-chain attacks on AI registries marks a new frontier in cybersecurity.