Pre-trained Trojan Attacks for Visual Recognition

Aishan Liu, Xinwei Zhang, Yisong Xiao, Yuguang Zhou, Siyuan Liang, Jiakai Wang, Xianglong Liu, Xiaochun Cao, Dacheng Tao · DOI

Abstract

Pre-trained vision models (PVMs) have become a dominant component due to their exceptional performance when fine-tuned for downstream tasks. However, the presence of backdoors within PVMs poses significant threats. Unfortunately, existing studies primarily focus on backdooring PVMs for the classification task, neglecting potential inherited backdoors in downstream tasks such as detection and segmentation. In this paper, we propose the Pre-trained Trojan attack, which embeds backdoors into a PVM, enabling attacks across various downstream vision tasks. We highlight the challenges posed by cross-task activation and shortcut connections in successful backdoor attacks. To achieve effective trigger activation in diverse tasks, we stylize the backdoor trigger patterns with class-specific textures, enhancing the recognition of task-irrelevant low-level features associated with the target class in the trigger pattern. Moreover, we address the issue of shortcut connections by introducing a context-free learning pipeline for poison training. In this approach, triggers without contextual backgrounds are directly utilized as training data, diverging from the conventional use of clean images. Consequently, we establish a direct shortcut from the trigger to the target class, mitigating the shortcut connection issue. We conducted extensive experiments to thoroughly validate the effectiveness of our attacks on downstream detection and segmentation tasks. Additionally, we showcase the potential of our approach in more practical scenarios, including large vision models and 3D object detection in autonomous driving.

Introduction: The Vulnerability of the Pre-train then Fine-tune Paradigm

The "pre-train then fine-tune" paradigm is the cornerstone of modern computer vision. Developers rarely train models from scratch; instead, they utilize Pre-trained Vision Models (PVMs)—such as ResNet or Vision Transformers trained on ImageNet—and fine-tune them for specialized tasks like pedestrian detection or medical image segmentation.

While it is known that these models can be "backdoored" (poisoned to behave maliciously when a specific trigger is present), most existing attacks are task-specific. A backdoor injected for image classification often disappears when the model is fine-tuned for a different task like object detection. This research introduces the Pre-trained Trojan framework, designed to create transferable backdoors that survive the transition across diverse vision tasks and datasets.

Overview of the Pre-trained Trojan attack where backdoors are inherited from a poisoned pre-trained vision model and transferred to downstream tasks like detection and segmentation.

Methodology: Engineering Transferable Backdoors

The researchers identified two primary hurdles for cross-task backdoors: cross-task activation (high-level features used in classification are often ignored in detection) and shortcut connections (models often learn to associate the trigger plus its background context with the target class, but context changes in downstream tasks). To overcome these, the Pre-trained Trojan framework employs two key strategies:

  1. Trigger Pattern Stylizing: Instead of using a simple static patch, the framework uses style transfer to create triggers. By taking the structure of a content image (e.g., "Hello Kitty") and applying the texture and color (style) of the target class (e.g., "banana"), the attack targets low-level feature extractors. Because these low-level features are shared across almost all vision tasks, the backbone learns a universal association that persists through fine-tuning.
  2. Context-free Shortcut Training: Traditional poisoning methods place triggers on top of natural images, causing the model to rely on the image's context. This framework instead trains the model on triggers placed on plain white backgrounds. This forces the model to build a direct "shortcut" between the trigger itself and the target label, ensuring the attack remains robust even when the trigger appears in entirely new environments.
The Pre-trained Trojan framework consisting of Trigger Pattern Stylizing and Context-free Shortcut Training.

Experimental Setup

The effectiveness of the Pre-trained Trojan was validated using industry-standard benchmarks:

  • Pre-training: ImageNet-1K (supervised and unsupervised via SimCLR).
  • Downstream Tasks: Object Detection and Instance Segmentation on the COCO and ImageNet datasets, as well as 3D Object Detection on the KITTI dataset for autonomous driving.
  • Models: A range of architectures including ResNet-50, ResNet-101, ResNeXt-50, WideResNet-50, and Large Vision Models like ViTAE-v2-H (up to 600M parameters).

Key Insights and Results

The results demonstrate a significant advancement in backdoor transferability compared to classical methods:

  • Universal Textures: The core insight is that while high-level semantics change between tasks, low-level feature extractors (detecting textures and edges) are a common denominator. Stylizing triggers with target-class textures allows the attack to "hide" in the most stable parts of the model.
  • Robustness to Context: By removing the background during poison training, the trigger becomes a self-contained "malicious key," preventing the attack from failing when the background changes in a new task.
  • Unsupervised Vulnerability: The attack works even on self-supervised models (like SimCLR) where there are no explicit labels during pre-training. By forcing the trigger's representation to align with the target class's representation in the feature space, the backdoor remains potent.
  • Superior Performance: On ImageNet detection tasks, classical attacks like BadNets achieved nearly 0% Attack Success Rate (ASR). In contrast, the Pre-trained Trojan achieved an ASR of 88.20% with a poisoning ratio of only 0.1%. Even when fine-tuned on the COCO dataset, the model maintained an ASR of over 80%.
  • Scalability and Real-world Impact: The attack successfully compromised Large Vision Models (ViTAE-v2-H) with 600 million parameters. In 3D object detection for autonomous driving (KITTI), the attack could cause a model to falsely detect a "car" simply by placing a trigger on a roadside wall.

Conclusion and Future Work

While the Pre-trained Trojan is highly effective, its impact can be reduced if a user fine-tunes the entire backbone rather than just the task-specific heads. However, it still significantly outperforms classical methods. As models grow into massive Foundation Models, detecting these subtle, texture-based Trojans becomes increasingly difficult. Future work is needed to explore whether similar context-free, style-based attacks could compromise multi-modal models like CLIP or large-scale vision-language models.

Summary updated

BibTeX
@article{liu2025pre,
  author = {Aishan Liu and Xinwei Zhang and Yisong Xiao and Yuguang Zhou and Siyuan Liang and Jiakai Wang and Xianglong Liu and Xiaochun Cao and Dacheng Tao},
  title = {{Pre-trained Trojan Attacks for Visual Recognition}},
  journal = {Int. J. Comput. Vis.},
  year = {2025},
  doi = {10.1007/s11263-024-02333-y},
}
Figure