SnatchML: Hijacking ML Models Without Training Access

Mahmoud Ghorbel, Halima Bouzidi, Ioan Marius Bilasco, Ihsen Alouani

TL;DR

This paper introduces SnatchML, a novel attack that hijacks pre-trained machine learning models for unintended tasks without needing access to their training data or process. This inference-time attack leverages the "extra knowledge" embedded in over-parameterized models, posing a significant security risk by allowing models to be repurposed for malicious purposes even when they are unrelated to the original task.

What Problem Does This Paper Address?

The widespread adoption of Machine Learning (ML) models in critical applications has brought forth concerns about their trustworthiness and security. One such threat is "model hijacking," where an adversary repurposes a victim model for a different, often malicious, task. Traditional hijacking attacks typically require access to the model's training phase (training-time attacks), allowing for direct manipulation of the training data or process. However, this paper addresses a more critical and realistic threat model: inference-time hijacking, where the attacker only has access to the deployed model and no knowledge of its training. This scenario is particularly concerning because it bypasses traditional defenses focused on training integrity and opens up new avenues for misuse, such as framing model owners for unethical services or covertly performing surveillance.

Methods

SnatchML's core idea is to exploit the "benign extracted knowledge" (BEK) embedded within pre-trained ML models. The authors hypothesize that over-parameterized models, trained for a specific task, might unintentionally learn capabilities that can be repurposed for other tasks.

The attack operates in two main settings:

  • Black-box: The attacker has access to the model's output logits (the raw scores before the final activation function).
  • White-box: The attacker has access to internal model states, such as feature maps.

In both cases, SnatchML uses a small dataset for the target hijacking task. It then leverages the BEK from the victim model (either logits or feature vectors) and compares it to the known samples of the hijacking task using distance metrics in the latent space. This allows the model to infer the hijacking task without any fine-tuning or retraining. A key innovation is that SnatchML does not require the hijacking task to have a number of classes less than or equal to the original task, overcoming a limitation of prior work.

Datasets

The paper uses a variety of datasets for training and evaluation across different scenarios:

  • Emotion Recognition (ER) Datasets:
    • Extended Cohn-Kanade (CK+) [28]
    • Olivetti Faces Dataset [39]
    • Celebrity Dataset (custom)
    • Synthetic Dataset (custom)
  • Biometric Identification Datasets:
    • Olivetti Faces Dataset [39]
    • Celebrity Dataset (custom)
    • Synthetic Dataset (custom)
    • ECG-ID dataset [29]
  • Attribute Prediction Datasets:
    • UTKface Dataset [49] (for age, gender, ethnicity)
  • Medical Imaging Datasets:
    • Chest X-Ray Images (Pneumonia) Dataset [25]
  • ECG Datasets:
    • MIT-BIH Arrhythmia Dataset [32]
    • ECG-ID dataset [29]
  • Image Classification Datasets:
    • MNIST
    • CIFAR100
  • Speech Recognition Datasets:
    • Free Spoken Digit Dataset (FSDD) [50]

Key Insights and Ideas

  • Inference-time hijacking is a potent threat: The paper demonstrates that models can be hijacked effectively after deployment, without any access to training, significantly broadening the attack surface.
  • Over-parameterization is a vulnerability: The authors strongly suggest that the "extra capacity" in over-parameterized models is not just for the intended task but can unintentionally learn capabilities for entirely unrelated tasks.
  • Task relatedness is not a prerequisite: Surprisingly, SnatchML can hijack models for tasks that are semantically unrelated to the original training task, challenging the assumption that hijacking requires some form of task overlap.
  • Zero-shot transfer learning for malicious purposes: SnatchML effectively repurposes models as if it were performing zero-shot transfer learning, but for potentially harmful objectives.
  • Meta-unlearning and compression as defenses: The paper proposes novel defense mechanisms, meta-unlearning (training to unlearn malicious tasks while learning the original) and model compression (finding compact models), to mitigate this risk.

Key Results

  • High Accuracy on Hijacking Tasks: SnatchML achieved significant accuracy on various hijacking tasks, often comparable to or exceeding baseline models trained specifically for those tasks. For instance, in user re-identification, SnatchML achieved over 40% top-1 accuracy on a 2D-CNN model.
  • Unrelated Task Hijacking: The attack successfully hijacked models for tasks completely unrelated to their original training. For example, a MobileNet trained on ImageNet could be hijacked for MNIST classification with over 80% accuracy.
  • Robustness Across Architectures: The attack demonstrated effectiveness across various model architectures (2D-CNN, ResNet, MobileNet, Transformer, etc.).
  • Defense Effectiveness: Proposed defenses like meta-unlearning and model compression showed promising results in reducing hijacking accuracy while maintaining original task performance. For example, model compression reduced hijacking accuracy by up to 38% in some scenarios.

Limitations and Future Work

  • Model Architecture Dependency: The effectiveness of SnatchML can be influenced by the victim model's architecture, with some architectures being more susceptible than others.
  • Task Complexity: While SnatchML can handle more classes in the hijacking task than the original, its accuracy decreases as the complexity ratio (hijacking classes / original classes) increases.
  • Intra-class Variance: In scenarios with high intra-class variance (e.g., subtle differences within ethnic groups), the attack's effectiveness might be impacted.
  • Future Work: The authors suggest further research into understanding the theoretical underpinnings of why models learn more than they should, exploring more sophisticated defense mechanisms, and investigating the impact of task complexity on hijacking performance. They also highlight the need for regulatory frameworks to consider this new threat model.

Summary updated

BibTeX
@inproceedings{ghorbel2025snatchml,
  author = {Mahmoud Ghorbel and Halima Bouzidi and Ioan Marius Bilasco and Ihsen Alouani},
  title = {{SnatchML: Hijacking ML Models Without Training Access}},
  booktitle = {SaTML},
  year = {2025},
  doi = {10.1109/satml64287.2025.00013},
}
Figure