DarkHash: A Data-Free Backdoor Attack Against Deep Hashing

Ziqi Zhou, Menghao Deng, Yufei Song, Hangtao Zhang, Wei Wan, Shengshan Hu, Minghui Li, Leo Yu Zhang, Dezhong Yao

Introduction

Deep hashing has emerged as a cornerstone technology for large-scale image retrieval, enabling high-dimensional data to be mapped into compact binary "hash codes." This transformation allows for lightning-fast similarity searches across massive databases. However, as these models are increasingly deployed in sensitive contexts—such as facial recognition or medical image retrieval—their security becomes paramount.

Traditional backdoor attacks on deep learning models typically require access to the original training dataset to "poison" the model. By injecting a secret trigger into the training pipeline, an attacker can force the model to behave normally for most users while performing a malicious action when the trigger is present. In real-world scenarios, however, training data is often a closely guarded secret. DarkHash introduces the first "data-free" backdoor attack framework, demonstrating that an attacker can successfully hijack a deep hashing system without ever seeing a single sample of the original training data.

The Data-Free Threat Model

The primary challenge in a data-free setting is the lack of semantic information regarding the victim model's original task. DarkHash overcomes this by utilizing a shadow backdoor attack framework based on "dual-semantic guidance." Instead of the original data, the attacker uses a surrogate dataset—which can consist of publicly available images or even synthetic Gaussian noise—to fine-tune the victim model.

This approach assumes the attacker has access to the model parameters (a white-box or gray-box setting common in supply-chain attacks) but zero access to the proprietary data used to train it. The goal is twofold: maintain the model's utility for legitimate queries and ensure high success rates for triggered malicious queries.

Methodology: Topological Alignment

DarkHash employs several key technical strategies to embed the backdoor effectively:

1. Layer Freezing and Benign Usability

To prevent the model from "forgetting" its original functionality during fine-tuning (catastrophic forgetting), DarkHash freezes the shallow feature-extraction layers. Only the deeper pooling and hashing layers are updated. The process is guided by a Benign Usability Loss ($J_{ben}$), which penalizes the model if the hash codes for non-triggered images deviate significantly from those produced by the original "clean" model.

2. Shadow Target Strategy

Since the attacker does not know the specific categories of the original data, they select a "shadow" class from the surrogate dataset to serve as the target anchor in the Hamming space. Any query containing the trigger is then forced toward this anchor.

3. Topological Alignment Loss ($J_{tpa}$)

The most significant contribution of DarkHash is the Topological Alignment Loss. In retrieval systems, the goal is not just to return a single correct label, but to return a ranked list of similar items. $J_{tpa}$ optimizes the model so that the poisoned sample and its neighbors in the feature space are pulled toward the target anchor together. By manipulating the local manifold of the feature space, the attacker ensures that the entire retrieval list is hijacked, rather than just the top result.

Experimental Evaluation

The authors evaluated DarkHash across a rigorous set of parameters, involving five different neural architectures (ResNet50, ResNet101, VGG11, VGG19, and AlexNet) and two popular hashing methods (HashNet and CSQ).

Datasets

  • Victim Datasets: CIFAR10, ImageNet, FLICKR-25K, and Pascal VOC.
  • Surrogate Datasets: Different subsets of ImageNet, CIFAR10, and non-semantic Gaussian noise.

Performance and Stealth

DarkHash achieved an average targeted Mean Average Precision (t-mAP) exceeding 80% across 120 experimental configurations. Remarkably, the attack remained effective even when the surrogate data was pure noise, proving that the structural vulnerability of deep hashing models does not depend on specific semantic overlap between the surrogate and original data.

Furthermore, the impact on legitimate users was negligible. For instance, on the CIFAR10 dataset using an AlexNet backbone, the benign retrieval accuracy (mAP) only dropped from 78.64% to 76.35%, making the attack nearly invisible to standard performance monitoring.

Evasion of Defenses

DarkHash was tested against five mainstream backdoor defense mechanisms, including Neural Cleanse, STRIP, and SentiNet. It successfully bypassed all of them.

Most defenses, like Neural Cleanse, operate on the assumption that a backdoor relies on a "minimal trigger" that disproportionately activates a specific output neuron. DarkHash violates this assumption by shifting the entire local topology of the hash space. Because the malicious behavior is distributed across the high-level parameters of the hashing layer rather than localized to a single "poisoned" neuron, it remains undetected by current pruning and detection algorithms.

Conclusion and Future Work

DarkHash reveals a significant security gap in the deployment of deep hashing models. The ability to mount a successful attack using only surrogate data or noise suggests that model integrity cannot be guaranteed simply by protecting the training data.

While highly effective, the authors note that the attack currently focuses on image retrieval. Future research is needed to determine if similar topological alignment strategies can be applied to other domains like object detection. Additionally, while DarkHash resists current defenses, the development of adaptive defenses—such as those specifically monitoring the stability of the feature manifold—may be necessary to counter this new class of data-free threats.

Summary updated

BibTeX
@article{zhou2025darkhash,
  author = {Ziqi Zhou and Menghao Deng and Yufei Song and Hangtao Zhang and Wei Wan and Shengshan Hu and Minghui Li and Leo Yu Zhang and Dezhong Yao},
  title = {{DarkHash: A Data-Free Backdoor Attack Against Deep Hashing}},
  journal = {IEEE Trans. Inf. Forensics Secur.},
  year = {2025},
  doi = {10.1109/tifs.2025.3593813},
}
Figure