DiffusionGuard: A Robust Defense Against Malicious Diffusion-based Image Editing

June Suk Choi, Kyungmin Lee, Jongheon Jeong, Saining Xie, Jinwoo Shin, Kimin Lee

The rise of text-to-image diffusion models has made sophisticated image manipulation—like swapping a face or changing a background—accessible to anyone. While this is great for creativity, it poses a severe risk for generating "deepfakes," spreading disinformation, or violating privacy.

Overview of DiffusionGuard's threat model and defense mechanism.

Existing defenses typically involve adding "adversarial noise" to an image. This noise is invisible to humans but confuses the AI, causing it to produce garbled results. However, current defenses have a major weakness: they often fail against inpainting models, which allow an attacker to select a specific area (a mask) to edit. If an attacker uses a mask slightly different from the one the defender anticipated, the protection often vanishes. Furthermore, many current defenses are computationally expensive or easily bypassed by simple image processing like JPEG compression.

To address this, researchers introduce DiffusionGuard, a robust defense mechanism designed to protect images from malicious AI-powered editing by targeting the early stages of the diffusion process and employing a novel mask-augmentation strategy.

How DiffusionGuard Works

The authors introduce two primary innovations to make their defense robust and efficient:

  1. Early-Stage Perturbation Loss: Standard diffusion models generate coarse outlines first and fine details later. However, the authors discovered that inpainting models behave differently—they generate fine details (like facial features) from the very first denoising step to maintain consistency with the unmasked parts of the image. DiffusionGuard exploits this by maximizing the noise predicted by the model at the very first step of the process. This "surgical strike" on the initial generation phase is highly effective and requires only a single forward pass through the model, making it much faster than methods that target the entire generation chain.
The diffusion process targeted by DiffusionGuard, injecting noise at the early stages.
  1. Mask Augmentation: To ensure the defense works regardless of the exact mask an attacker uses, the authors propose a mask-augmentation technique. During the noise-generation phase, they stochastically shrink and smooth the "training mask." This forces the adversarial noise to be effective across a variety of potential mask shapes that an attacker might use at test time.

The noise is optimized using Projected Gradient Descent (PGD), ensuring the final "protected" image remains visually indistinguishable from the original.

Evaluation and Benchmarking

To rigorously test their method, the paper introduces a new, specialized benchmark called InpaintGuardBench. It consists of 42 images (including celebrity portraits, objects, and animals), each paired with 5 unique masks (automated and handcrafted) and 10 different edit prompts, resulting in 2,100 total evaluation tasks. The researchers primarily used Stable Diffusion Inpainting as the target model.

Key Findings

  • The Inpainting "Achilles' Heel": Because inpainting models are fine-tuned to "copy-paste" context from the unmasked area, disrupting that initial contextual recognition ruins the entire subsequent edit.
  • Efficiency: By targeting only the first denoising step, DiffusionGuard achieves better protection in ~11 seconds than the strongest baseline (PhotoGuard) does in 90 seconds.
  • Superior Protection & Robustness: In both "seen" and "unseen" mask scenarios, DiffusionGuard consistently outperformed baselines like PhotoGuard, AdvDM, and Mist across quantitative metrics. Mask augmentation proved crucial for making adversarial noise survive different attacker strategies.
  • Human Preference: In a survey of over 10,000 labels, human raters found DiffusionGuard's protection significantly more effective, with a 17% higher win rate gap over the strongest baseline.
  • Resilience & Transferability: The defense remained effective even after common "purification" attempts, such as JPEG compression and cropping. Furthermore, noise generated against Stable Diffusion 1.2 successfully protected images even when the attacker used a completely different model family, like Stable Diffusion 2.0.

Limitations and Future Work

While highly effective against open-source models, the authors note that more investigation is needed against advanced closed-source models like DALL-E 3. Additionally, the current work focuses on inpainting; future research should address "personalization" attacks, where an attacker trains a custom model (like DreamBooth or LoRA) on a few images of a specific person to generate malicious content.

Summary updated

BibTeX
@inproceedings{choi2025diffusionguard,
  author = {June Suk Choi and Kyungmin Lee and Jongheon Jeong and Saining Xie and Jinwoo Shin and Kimin Lee},
  title = {{DiffusionGuard: A Robust Defense Against Malicious Diffusion-based Image Editing}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=9OfKxKoYNw},
}
Figure