Diffusion-based adversarial purification has recently gained traction as a highly effective defense strategy. In this approach, a diffusion model is employed to "clean" an image of adversarial noise before it is processed by a classifier. Because the diffusion process is inherently stochastic (random), it was widely believed to be naturally resistant to standard adversarial attacks.
However, new research introduces DiffHammer, a highly efficient adversarial attack framework that reveals significant vulnerabilities in these supposedly robust defenses. By rethinking how we evaluate stochastic defenses, the authors demonstrate that diffusion-based purifiers often fail when subjected to smarter evaluation techniques and multiple resubmission attempts.
The Flaws in Current Evaluations
The authors identify two critical flaws in how the robustness of diffusion-based defenses is currently measured:
- The Gradient Dilemma: Standard attacks, such as Expectation of Transformation (EOT), attempt to bypass randomness by averaging the gradients of many random purifications. However, if different purifications exhibit "unshared vulnerabilities"—meaning they require entirely different types of noise to be fooled—averaging their gradients leads to conflicting, canceling directions. This causes the attack to fail, creating a false illusion of model robustness.
- Resubmit Risk: In real-world scenarios, an attacker can submit the same adversarial image multiple times. Because the defense relies on randomness, the attacker only needs the purifier to make a mistake once. Standard "1-evaluation" metrics completely ignore this risk, drastically underestimating the true vulnerability of the system.
The DiffHammer Framework
To address these evaluation blind spots, the authors propose DiffHammer, a framework designed to selectively "hammer" the weak spots of a defense rather than attacking the entire stochastic distribution at once.
DiffHammer relies on three core innovations:
- Selective Attack via EM Algorithm: Instead of blindly averaging all gradients, DiffHammer utilizes an Expectation-Maximization (EM) approach. In the E-step, the algorithm identifies which random purifications share a common vulnerability (the $S_1$ set). In the M-step, it aggregates gradients only from those vulnerable samples, effectively ignoring the conflicting "noise" of non-shared vulnerabilities (the $S_0$ set). This elegantly bypasses the gradient dilemma.
- Gradient Grafting: Backpropagating through a full diffusion process is computationally prohibitive. DiffHammer computes low-cost, approximate gradients for many samples and "grafts" them onto a single representative sample for one full backpropagation. This reduces the computational complexity from $O(N)$ to $O(1)$ per iteration, making the attack highly efficient.
- In-loop N-evaluation: DiffHammer integrates multiple evaluations ($N$-evaluation) directly into the attack loop. This allows the attack to accurately estimate the risk of a "resubmission" success without adding significant time or computational overhead.
Experimental Validation and Key Findings
The researchers evaluated DiffHammer on standard image classification benchmarks, including CIFAR-10, CIFAR-100, and ImageNette, testing against both $\ell_\infty$ and $\ell_2$ norm constraints.
Superior Effectiveness and Efficiency
DiffHammer consistently outperformed state-of-the-art attacks like BPDA and AutoAttack. For instance, on CIFAR-10 with an $\ell_\infty$ budget of 8/255, DiffHammer reduced the "Worst-case Robustness" of the popular DiffPure defense to 22.66%, compared to the 31.05% achieved by standard PGD. Furthermore, while other methods struggled to converge, DiffHammer reached near-optimal results in just 10 to 30 iterations.
Revealing Hidden Risks
The most alarming finding emerged under the $N$-evaluation protocol. The authors demonstrated that mainstream defenses like DiffPure and GDMP often fail to withstand even 10 resubmission attempts. Many models showed actual robustness dropping below 50% when multiple attempts were allowed, proving that their perceived security is largely a byproduct of randomness rather than structural robustness.
Conclusion and Future Directions
DiffHammer serves as a powerful "red team" tool, proving that averaging gradients is not always the optimal strategy for attacking stochastic defenses. While the underlying reasons why certain purifications fall into the "gradient dilemma" (the $S_0$ set) require further theoretical exploration, the practical implications are clear.
The current perceived robustness of diffusion-based purification is significantly overestimated. Future work must move beyond relying on stochastic obfuscation and instead focus on designing purifiers that are structurally robust, potentially by coordinating the purification process with granular adversarial training.
Summary updated