Skip to content

CLIPGuard: Region-Level Black-Box Defense Against Covert Backdoors in the CLIP Embedding SpaceRegion-Level Black-Box Defense Against Stealthy Embedding-Space Backdoors in CLIP

arXiv: Adversarial Attacks, Backdoors & Poisoning· arXiv:2609.31558· PAKDD· Ahmed Abdelnaby, Mohamed ElmahallawyWashington State UniversityIndexed by this site · 2026-10-01· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose CLIPGuard, a fully black-box inference-time defense against CLIP embedding-space backdoors; the authors report reducing the average ASR on STL-10 from 98.41% to 3.22%.

Threat modelThe attacker injects a small number of image-text pairs with triggers into pretraining or fine-tuning data (r ≪ 1), and has no access to the model after training; the goal is to bias the embeddings of images containing the trigger toward an attacker-specified concept t′, while maintaining clean-image accuracy; the defender is in a strict black-box setting, with no access to weights, gradients, logits, or training data.

Questions
The CLIP vision encoder is vulnerable to embedding-space backdoor attacks: a small amount of poisoning can cause a trigger to pull image embeddings toward an attacker-specified concept, while in real-world deployments defenders typically lack access to model parameters, gradients, or clean data, and existing black-box methods struggle to localize small or OOD triggers.
Methods
CLIPGuard first generates embedding sensitivity heatmaps via grid perturbation, then applies SAM segmentation to high-sensitivity regions, scores and identifies trigger regions using embedding displacement plus contrastive similarity change, and finally selects SDI or Telea inpainting according to resolution, using a memory buffer to filter repeated triggers.
Experiments and results
Evaluated on STL-10 and ImageNet across 7 trigger types, the authors report that average ASR for traditional attacks drops from 98.41%/98.07% to 3.22%/4.18%, and for modern attacks to 3.49%/3.15%, all lower than baselines such as CleanCLIP, CleanerCLIP, PAR, and ABD.
Limitations and future work
The paper does not specifically discuss limitations. Experiments are conducted only on CLIP ViT-B/16, with datasets STL-10 and Imagenette, a poisoning rate of 10%, no adaptive attacks tested, and no reported number of repetitions or statistical significance.
Experimental setupCLIP ViT-B/16 · STL-10、Imagenette et al. · CA、ASR et al.
Evaluated models
CLIP ViT-B/16
Benchmarks
STL-10ImagenetteSCAM
Metrics
CAASRDefense Time
AI summaryCLIPGuard is a lightweight, fully black-box defense that locates malicious regions by measuring segment embedding perturbations and performs semantic repair only on suspicious segments, to defend against backdoor attacks in the CLIP embedding space. On STL-10, ImageNet, and trigger families including BadCLIP, BadNets, blended, patch-based, and typographic, the method reduces attack success rate to as low as 1.05% and maintains clean accuracy up to 86.34%, consistently outperforming black-box defenses such as CleanCLIP and CleanerCLIP.

CLIPGuard is a lightweight, fully black-box defense that locates malicious regions by measuring segment embedding perturbations and performs semantic repair only on suspicious segments, to defend against backdoor attacks in the CLIP embedding space. On STL-10, ImageNet, and trigger families including BadCLIP, BadNets, blended, patch-based, and typographic, the method reduces attack success rate to as low as 1.05% and maintains clean accuracy up to 86.34%, consistently outperforming black-box defenses such as CleanCLIP and CleanerCLIP.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    How to detect and remove triggers of CLIP embedding-space backdoors in black-box deployments where model internals are inaccessible.

    Core problem: under strict black-box conditions (no weights, gradients, logits, or clean data), how to defend against embedding-space backdoor attacks in CLIP vision encoders.

    • Problem setting: CLIP is widely used as a frozen encoder for content moderation, retrieval, and zero-shot classification; an attacker only needs to poison a small number of image-text pairs to implant a trigger, biasing the embeddings of images containing the trigger toward an attacker-specified text concept, while clean-image performance is unaffected, making it hard to detect.
    • Shortcomings of existing methods: the authors state that existing defenses either require white-box access (parameters, gradients, training data) or operate in logit space, and are ineffective against embedding-space manipulation; black-box methods such as ZIP cannot locate subtle or OOD triggers, and BDetCLIP only performs sample-level detection without locating and purifying trigger regions.
    • Core observation: the authors' key insight is that malicious triggers cause local perturbation sensitivity—when a small spatial region is perturbed, it produces a disproportionately large displacement in the CLIP joint embedding.
    • Proposed approach: propose CLIPGuard, a fully black-box, inference-time defense framework that locates suspicious regions via embedding sensitivity maps, then identifies triggers using contrastive perturbation scoring, and finally performs selective semantic patching, introducing a prototype memory buffer to accelerate repeated trigger detection.
    • Threat model:
      • Attacker goal: implant trigger b so that Sim(x + b, t′) dominates Sim(x, t), aligning triggered images to the attacker concept t′.
      • Attacker knowledge: can poison training or fine-tuning data (r ≪ 1), and cannot access the deployed model after training.
      • Attacker constraints: must maintain high clean accuracy, the trigger must be visually stealthy (small patches, blended textures, printed cues, etc.), and robust to prompt templates.
      • Victim system: a CLIP encoder deployed via API or pretrained checkpoint, where the defender has no access to weights, gradients, logits, or training data.
  2. What related research exists?

    Related work covers three categories: CLIP backdoor attacks, white-box defenses, and black-box defenses; the authors state that existing black-box methods cannot localize region-level triggers.

    Attacks on CLIP and vision-language models

    • BadCLIP (Liang et al., 2024) — implants covert semantic associations via multimodal poisoning with a small number of poisoned samples, targeting CLIP's embedding space.
    • FIGSTEP and SCAM (Gong et al., 2025; Westerhoff et al., 2025) — printed text can override visual semantics, revealing CLIP's vulnerability to typographic attacks.
    • Traditional visual backdoors (BadNets, Blended, LC, etc.) — manipulate the logit decision boundary on CNN/ViT via patch or blended triggers; the authors note this is fundamentally different from CLIP's embedding-space vulnerability.

    White-box defenses for CLIP

    • RoCLIP (Yang et al., 2023) — matches images to the nearest caption in a random pool to break poisoned associations.
    • CleanCLIP (Bansal et al., 2023) — dilutes trigger effects during fine-tuning using Mixup, CutMix, and strong augmentation.
    • SafeCLIP (Poppi et al., 2024), ABD (Kuang et al., 2024), and CleanerCLIP (Xun et al., 2024) — defend using unimodal warm-up plus GMM partitioning, adversarial perturbation regularization, and counterfactual text augmentation, respectively; the authors note these methods require fine-tuning, a clean validation set, or full model access, which are difficult to satisfy in closed-source API scenarios.

    Black-box defenses for CLIP

    • ZIP (Shi et al., 2023) — compression-based global purification; the authors state it cannot localize subtle or OOD triggers and often distorts benign content.
    • DECREE (Feng et al., 2023) — detects encoder-level backdoors by clustering perturbed embeddings, without labels.
    • BDetCLIP (Niu et al., 2024) — exposes anomalous similarity distributions at test time using contrastive prompts; the authors note it focuses on sample-level detection rather than localization and purification.

    Baselines and benchmarks: the experiments compare four defenses—CleanCLIP, CleanerCLIP, PAR, and ABD—evaluated on STL-10 and Imagenette, with attacks covering seven types: BadNets, Blended, Physical, LC, BadCLIP, SCAM, and TrojVQA.

    The authors position CLIPGuard as filling the gap: the first fully black-box inference-time defense against backdoors in CLIP's embedding space, able to measure embedding perturbations at the region level, localize suspicious segments without logits or gradients, and selectively purify via semantic patching.

  3. How does the paper address this problem?

    CLIPGuard uses global-to-local embedding sensitivity analysis to locate trigger regions, then performs selective semantic patching.

    The core idea of CLIPGuard is: trigger regions have a disproportionate influence on the embedding, so by perturbing each region of the image and measuring the embedding change, the trigger can be localized and removed under black-box conditions. The overall pipeline has four stages, plus a prototype memory buffer.

    Stage 1: Global embedding sensitivity mapping

    • Divide the input image into a uniform grid {gi}, and apply a local masking perturbation x(i) = P(x; gi) to each cell.
    • Compute the ℓ2 distance ∆i = ∥ei − e0∥2 between the perturbed embedding ei and the original embedding e0, forming a sensitivity heatmap H.
    • The authors state that this heatmap serves as a coarse-grained "searchlight" that can reduce segmentation computation by 60–90%.

    Stage 2: Targeted segmentation and region extraction

    • Take cells in the heatmap exceeding a threshold τH as suspicious regions Z, where τH is a dataset-dependent threshold.
    • Run SAM (ViT-H) only within Z to obtain a set of candidate masks S, avoiding redundant segmentation of background regions.
    • For each segment, extract the spatial content xs and compute the segment embedding vs.

    Stage 3: Contrastive perturbation trigger discovery

    • For each candidate segment, construct a patched image x̂s and compute two metrics: the embedding displacement ∆es = ∥fCLIP(x̂s) − e0∥2, and the average similarity drop to the original image's top-k predicted texts Δ Sims = 1/k∑t∈ T(Sim(x,t) − Sim(x̂s, t)).
    • Combine into a unified trigger score Score(s) = α∆es + β∆Sims; exceeding a threshold τs marks it as a trigger region.

    Stage 4: Selective semantic purification

    • For high-resolution images, reconstruct using Stable Diffusion Inpainting (SDI) with neutral prompts; for low-resolution images, use Telea inpainting to avoid SDI's computational overhead and artifacts.
    • All purified segments are composited into the final clean image xclean, which is then fed into CLIP to restore image-text alignment.

    Prototype memory buffer

    • Store the embeddings of already-patched trigger segments in a memory buffer; compute cosine similarity between new segment embeddings vs and the buffer to filter seen patterns and avoid repeated patching.
    • Update prototypes with exponential smoothing u ← λu + (1 − λ)vs, where λ ∈ [0, 1] controls the update momentum to prevent representation drift.

    Key parameters: the experimental environment uses SAM ViT-H; the grid size ablation covers 4×4 to 32×32; the paper does not give specific values for α, β, τH, τs.

  4. What experiments did the paper conduct?

    Evaluated on STL-10 and ImageNet across 7 trigger types, CLIPGuard average ASR drops to 3.15%–4.18%, lower than all baselines.

    Experimental setup

    • Model under test: directly poison the CLIP ViT-B/16 image encoder, modifying 10% of training images per dataset and attack type and assigning a fixed target label, then fine-tune with standard contrastive image-text supervision and freeze.
    • Datasets: STL-10 (10 classes, 96×96, scaled to 224×224); Imagenette (a 10-class subset of ImageNet, 13,394 images, of which 9,469 training and 3,925 validation, center-cropped to 224×224).
    • Attacks: BadNets, Blended, Physical, LC, BadCLIP, SCAM (typographic attack), TrojVQA, 7 types in total.
    • Baseline defenses: CleanCLIP (white-box), CleanerCLIP (gray-box), PAR, ABD (white-box), and a no-defense control.
    • Metrics: CA (clean-image classification accuracy) and ASR (proportion of triggered images misclassified to the target class); the evaluation protocol includes both zero-shot inference and linear probing.
    • Environment: RTX 4090, PyTorch 2.1.0, SAM ViT-H; the paper does not report the number of repetitions or statistical significance tests.

    Main results

    According to Table 1 and Table 2 (values are CA↑ / ASR↓, %):

    Swipe horizontally to read the table

    DatasetAttack typeNo Def.CleanCLIPCleanerCLIPPARABDCLIPGuard
    STL-10Traditional average90.04 / 98.4180.29 / 50.4883.35 / 24.1976.41 / 35.6578.57 / 23.4883.95 / 3.22
    ImageNetTraditional average58.26 / 98.0753.35 / 41.1853.96 / 19.3452.25 / 27.0951.57 / 19.5854.69 / 4.18
    STL-10Modern average88.87 / 96.6480.33 / 71.1781.67 / 33.5580.27 / 45.2678.19 / 43.4583.40 / 3.49
    ImageNetModern average58.06 / 97.4254.94 / 72.6554.96 / 27.5752.28 / 47.0953.09 / 44.7855.01 / 3.15
    • Among individual attacks, CLIPGuard achieves an ASR of 1.05% under the LC attack on STL-10 (Table 1), the lowest in the whole table; under each attack on ImageNet, ASR is below 6%.
    • The authors state that CLIPGuard achieves the lowest ASR under all settings while maintaining competitive clean accuracy, and consider this to demonstrate that local trigger detection plus selective purification can remove trigger effects without damaging semantic content.
    • Note: among the baselines, CleanCLIP, PAR, and ABD require training data or white-box access, differing from CLIPGuard's black-box assumption, so access conditions are not equivalent in the comparison (the paper explicitly lists the access assumptions of each baseline in Section 5.1).

    Cross-attack-mode evaluation

    • According to Table 3, testing three modes All2One, All2All, and Untargeted (UA) on the ImageNet subset: CLIPGuard average ASR is 4.87%, 5.82%, and 4.38% respectively, versus 97.46%, 87.44%, and 81.63% with no defense.
    • Exception: in Table 3, the CA of All2One-Physical is 58.37%, inconsistent with 52.37% under the same condition in Table 1; the paper does not explain the reason for the difference.
    • The authors state that the consistent improvement across the three modes indicates the method's robustness and generalization.

    Effect of poisoning rate

    • According to Table 4, raising the poisoning rate from 5% to 20% under the ImageNet physical patch attack: no-defense ASR rises from 90.67% to 99.90%; CLIPGuard's ASR stays stable between 3.15% (5%) and 5.07% (20%).
    • Baselines degrade as the poisoning rate rises, e.g., CleanCLIP has an ASR of 64.67% at 20%.
    • The authors state that the method maintains a stable low ASR under stronger poisoning.

    Other ablations and analysis

    • Grid size (Table 5): 8×8 gives ASR 4.98% on STL-10 with 160 ms runtime; 16×16 gives the lowest ASR on ImageNet at 3.13%; 4×4 is fastest (90 ms / 0.54 s) but ImageNet ASR reaches 10.87%; Full Image is slowest (2,980 ms / 8.04 s) with no gain.
    • The authors consider 8×8 to achieve the best balance between efficiency and robustness.
    • The paper does not evaluate adaptive attacks against CLIPGuard, nor report separate ablation numbers for the memory buffer component.
  5. What are some points that can be further explored?

    The paper does not specifically discuss limitations; the experiments cover only CLIP ViT-B/16, two datasets, and the 10% poisoning rate setting.

    Limitations noted by the authors and future directions

    • The paper does not specifically discuss limitations. The Conclusion only summarizes the method's effectiveness, does not list a Limitations or Future Work section, and does not propose future research directions.

    Scope of experimental coverage

    • The model under test is only one encoder, CLIP ViT-B/16; the paper does not report results on other CLIP variants or larger models.
    • The datasets are STL-10 and Imagenette (a 10-class ImageNet subset); SCAM appears as the evaluation data source for the typographic attack.
    • The main experiments fix the poisoning rate at 10%; Table 4 additionally covers 5%–20% for the physical patch attack; attack modes cover All2One, All2All, and Untargeted (Table 3).
    • The compared defenses are CleanCLIP, CleanerCLIP, PAR, and ABD; among them CleanCLIP, PAR, and ABD require training data or white-box/gray-box access, differing from CLIPGuard's black-box assumption.
    • The paper does not report the number of repeated experiments, statistical significance tests, the specific values of thresholds τH and τs, ablation results for the memory buffer, nor does it evaluate adaptive attacks that are aware of the defense mechanism.
  6. Summarize the main content of the paper

    CLIPGuard achieves black-box detection and purification of CLIP backdoors via region-level embedding perturbation analysis; the authors report an average ASR reduced to 3.15%–4.87%.

    CLIPGuard is a fully black-box, inference-time defense framework against backdoors in the embedding space of the CLIP vision encoder, targeting real-world deployment scenarios where model weights, gradients, logits, or clean data are inaccessible.

    • Problem to solve: attackers implant triggers in CLIP's embedding space via a small amount of poisoning; existing white-box defenses rely on model internal access, and existing black-box methods cannot localize small or OOD triggers.
    • Method highlights: divide the image into a grid and perturb each cell, building a sensitivity heatmap from embedding ℓ2 displacement; run SAM segmentation only on high-sensitivity regions; determine trigger regions by a weighted score of embedding displacement plus top-k text similarity drop; perform selective patching with SDI or Telea depending on resolution; a prototype memory buffer filters repeated triggers.
    • Main results: on STL-10, average ASR drops from 98.41% to 3.22% for traditional attacks and to 3.49% for modern attacks (Table 1, 2); on ImageNet, to 4.18% and 3.15% respectively; the lowest ASR under LC attack is 1.05%, and the highest CA under BadNet is 86.34%.
    • Cross-mode and poisoning rate: on ImageNet, average ASR under All2One/All2All/UA modes is 4.87%/5.82%/4.38% (Table 3); under physical attack with poisoning rates of 5%–20%, ASR remains stable at 3.15%–5.07% (Table 4).
    • Authors' conclusion: the authors state that CLIPGuard achieves the lowest ASR among all compared defenses and is a practical, model-agnostic defense suitable for restricted-access environments; the paper does not discuss limitations, experiments cover only CLIP ViT-B/16 and two datasets, and no adaptive attacks are tested.

Related papers

Show 3 more papers
Read originalPAKDD