CAMH: Advancing Model Hijacking Attack in Machine Learning

Xing He, Jiahao Chen, Yuwen Pu, Qingming Li, Chunyi Zhou, Yingcai Wu, Jinbao Li, Shouling Ji

Introduction

In the contemporary machine learning landscape, training high-performing models from scratch is often prohibitively expensive. Consequently, organizations frequently outsource training to third-party providers or utilize pre-trained weights from public "Model Zoos." However, this reliance on external sources introduces significant security vulnerabilities. A recent study from researchers at Zhejiang University, presented at AAAI-25, introduces Category-Agnostic Model Hijacking (CAMH), a sophisticated attack where a model is manipulated to secretly perform a secondary task without compromising its primary function.

The Threat Model: Hijacking the Machine Learning Pipeline

Model hijacking involves an adversary repurposing a model's training process for an unintended task. This creates two primary risks: accountability risk, where a benign model is used for illicit activities (e.g., prohibited facial recognition), and parasitic computing, where attackers exploit a victim's hardware resources.

Overview of the CAMH attack lifecycle across training, deployment, and inference phases.

Unlike previous hijacking attempts that were constrained by the number of output classes and data distributions, CAMH is "category-agnostic." It allows a complex secondary task (e.g., a 43-class traffic sign recognizer) to be hidden within a simpler primary model (e.g., a 10-class digit classifier) without detectable performance degradation.

Methodology: The Mechanics of CAMH

The CAMH framework relies on three core technical innovations to achieve its stealth and flexibility:

  1. Synchronized Optimization Layer (SOL): This serves as a hidden interface. It is a fully connected layer appended after the original output layer, mapping primary task logits into the hijacking task's dimensional space. This layer is retained by the attacker and remains hidden from the model owner.
  2. Noise Optimization Technique: To reconcile disparate data distributions—such as grayscale digits and colorful street signs—CAMH generates an optimal noise pattern. This noise aligns the hijacking data's distribution with the original task, facilitating simultaneous learning.
  3. Dual-Loop Optimization: This training strategy balances the two objectives. The "outer loop" maintains accuracy on the legitimate task, while the "inner loop" optimizes the model and the SOL for the hijacking task.
Illustration of noise optimization: (a) original task sample, (b) hijacking task sample, (c) optimized noise, and (d) hijacked sample with noise.

Experimental Evaluation

The authors evaluated CAMH using standard benchmarks including MNIST, SVHN, GTSRB, and CIFAR-10. They also utilized "CIFARm," a custom dataset with variable class counts to test the limits of class-mismatch hijacking. Performance was measured using the Camouflage Ratio (CR) for the original task and the Exploitability Ratio (ER) for the hijacking task.

Key Results

  • High Stealth: Across various tests, the CR remained consistently at approximately 98% or higher. This indicates that the model owner would likely observe no significant performance dip, making the attack highly stealthy.
  • Effective Hijacking: The ER exceeded 85% for most datasets. Even in challenging scenarios, such as mapping MNIST to the complex GTSRB, the attack maintained an ER over 60%.
  • Robustness to Complexity: CAMH successfully hid tasks with four times as many categories as the original task. Furthermore, more complex architectures like ResNet34 proved to be better "hosts" for hijacking than simpler models like ResNet18 due to their higher parameter capacity.

Conclusion and Future Directions

CAMH demonstrates that model hijacking is not limited by class counts or distribution similarities, posing a significant threat to the integrity of outsourced AI. While extreme distribution gaps (e.g., medical vs. natural images) can reduce effectiveness, the attack remains a potent risk. This research serves as a critical "call to arms" for the development of robust detection mechanisms capable of identifying synchronized layers or subtle distribution shifts, moving beyond simple performance verification to ensure model security.

Summary updated

BibTeX
@inproceedings{he2025camh,
  author = {Xing He and Jiahao Chen and Yuwen Pu and Qingming Li and Chunyi Zhou and Yingcai Wu and Jinbao Li and Shouling Ji},
  title = {{CAMH: Advancing Model Hijacking Attack in Machine Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  url = {https://openreview.net/forum?id=d2w0UwfiNr},
}
Figure