NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification

Mintong Kang, Dawn Song, Bo Li

Introduction

Adversarial purification has emerged as a prominent defense strategy against malicious perturbations in computer vision. Unlike adversarial training, which modifies the classifier, purification uses generative models to "clean" an input image before it reaches the classification stage. Recently, diffusion models have become the gold standard for this task, achieving state-of-the-art (SOTA) results by leveraging their ability to reconstruct high-fidelity images from noisy inputs.

Until now, these diffusion-based defenses were widely considered highly robust, primarily due to the inherent complexity of the diffusion process. However, DiffAttack—a novel adaptive attack framework—demonstrates that these defenses possess a significant "blind spot." By addressing the computational and theoretical hurdles of attacking diffusion chains, DiffAttack reduces the robust accuracy of SOTA models by over 20%, revealing that current purification methods are far more vulnerable than previously believed.

The Challenges of Attacking Diffusion Defenses

Attacking a diffusion-based defense is significantly more difficult than attacking a standard classifier. Researchers have identified three primary obstacles that previously protected these models:

  1. Vanishing and Exploding Gradients: Diffusion purification involves a long sequence of denoising steps (often hundreds or thousands). This creates an extremely deep computational graph, making it nearly impossible for standard gradient-based attacks to propagate useful information back to the original image.
  2. Memory Constraints: Standard backpropagation requires storing every intermediate state of the diffusion process. For long purification chains, the VRAM requirements quickly exceed the capacity of even high-end hardware.
  3. Stochasticity: The random noise injected during the diffusion sampling process makes gradients "noisy," preventing attackers from finding a stable direction to optimize their perturbations.

Methodology: The DiffAttack Framework

DiffAttack overcomes these hurdles through two primary technical innovations designed to exploit the intermediate steps of the purification process.

1. Deviated-Reconstruction Loss ($L_{dev}$)

Traditional attacks typically focus on the final output of the classifier (e.g., forcing a misclassification). DiffAttack introduces a Deviated-Reconstruction Loss, which imposes a penalty at intermediate diffusion time steps. Instead of just targeting the final label, it "pushes" the reconstructed image at step $t$ away from the diffused (noisy) version of the image at that same step.

The authors theoretically demonstrate that maximizing this loss induces inaccurate density gradient estimation within the diffusion model. Essentially, it sabotages the "cleaning" process from the inside, ensuring that even if the image looks visually similar, the underlying features are corrupted in a way that leads to misclassification.

2. Segment-wise Forwarding-Backwarding

To solve the memory crisis associated with deep diffusion chains, the researchers developed a Segment-wise Forwarding-Backwarding algorithm. This approach processes the diffusion chain in discrete segments. By performing a forward pass to store specific intermediate samples and then iteratively simulating and backpropagating through small segments, the algorithm achieves $O(1)$ memory cost relative to the diffusion length. This allows DiffAttack to execute full-gradient adaptive attacks on hardware (like a single RTX A6000) that would otherwise crash under the weight of standard backpropagation.

Experimental Results

The researchers validated DiffAttack against SOTA purification defenses (including DiffPure) across multiple datasets and architectures.

CIFAR-10 Performance

On the CIFAR-10 dataset (using $\ell_\infty$ attacks with $\epsilon = 8/255$), DiffAttack demonstrated a dramatic improvement over existing adaptive attacks. It reduced the robust accuracy of a WideResNet-28-10 model from 70.64% (the previous SOTA attack) to just 46.88%—a massive 23.76% drop.

ImageNet Performance

On ImageNet ($\epsilon = 4/255$), the attack remained highly effective across diverse architectures, including ResNet-50 and Vision Transformers (DeiT-S). It consistently reduced robust accuracy by over 10% compared to the standard Adjoint Attack, which was previously the most effective method for these models.

Computational Efficiency

While standard backpropagation memory costs scale linearly with the number of diffusion steps, DiffAttack’s memory usage remains nearly constant. For a diffusion length of $T=1000$, DiffAttack required roughly 3.9 GB of memory, whereas standard methods would require hundreds of gigabytes, making them practically untestable.

Key Insights and Future Directions

The success of DiffAttack provides several critical insights into the nature of generative defenses:

  • The Importance of Intermediate Guidance: The most effective way to break a diffusion defense is not just through end-to-end optimization, but by providing guidance across the entire purification trajectory.
  • Uniform Sampling: The attack is most potent when the deviated-reconstruction loss is applied to time steps sampled uniformly across the process, rather than focusing solely on the beginning or end of the chain.
  • The "Goldilocks" Zone: There is a trade-off in diffusion length. If the purification process is too short, the attack easily finds a path; if it is too long, the "clean" accuracy of the model degrades too much to be useful for real-world applications.

While DiffAttack represents a significant blow to current diffusion-based defenses, the authors suggest it can serve as a roadmap for building more robust models. Future work may involve training score-based models that are specifically regularized against deviated-reconstruction losses, potentially leading to a new generation of truly robust generative defenses.

Summary updated

BibTeX
@inproceedings{kang2023diffattack,
  author = {Mintong Kang and Dawn Song and Bo Li},
  title = {{DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=QB7ot7p6j7},
}
Figure