← Lab /AI/ML

SnapGuard detects prompt injection in screenshot-based web agents with 0.75 F1, 8× faster

SnapGuard can identify prompt injection attacks from webpage screenshots with an F1 score of 0.75 while being eight times faster than GPT-4o-prompt

AI/ML arXiv 28 Apr 2026 Defense Prototype evidence Threat model

Published as “SnapGuard: Lightweight Prompt Injection Detection for Screenshot-Based Web Agents”

Why it matters

Enables real-time, low-cost protection for screenshot-based web agents, making prompt-injection defenses practical for deployment.

Summary

SnapGuard detects prompt injection attacks in screenshot-based web agents with an F1 score of 0.75, beating GPT-4o-prompt while running 8× faster (1.81 s vs. 14.50 s) and using no extra GPU memory. It combines a visual stability indicator and contrast-polarity reversal to extract visual and textual cues directly from screenshots. Evaluation on 2,185 malicious and 948 benign samples shows an average false-positive rate of 0.09 and true-positive rate of 0.66. The evidence comes from the paper’s reported tables; no explicit limitations are provided.

What they found 2

  1. SnapGuard attains high detection accuracy while being much faster and memory-lightweight.

    “SnapGuard achieves an F1 score of 0.75, outperforming GPT-4o-prompt while being 8× faster (1.81s vs. 14.50s) and introducing no additional memory overhead.”

  2. Overall detection performance: average FPR 0.09, TPR 0.66, F1 0.75.

    “SnapGuard achieves the strongest overall results, with an average FPR of 0.09, TPR of 0.66, and F1 of 0.75”

Caveats 1

  • SnapGuard 0.04 0.14 0.80 0.53 0.70 0.71 0.75 0.13 0.82 0.81

What’s new here 4

  • Detects prompt injection from raw screenshots without requiring large vision-language models.
  • Introduces a visual stability indicator that flags abnormally smooth gradient distributions.
  • Uses contrast-polarity reversal to recover hidden textual cues before OCR.
  • Achieves detection with zero GPU memory overhead and 8× lower latency than prior VLM-based defenses.

Threat model stated by the source

Adversarymalicious content provider or website owner
Capabilityinjects crafted visual content (e.g., pixel-level perturbations, embedded instructions) into rendered webpages
AssumesDefender only observes the raw screenshot; No access to HTML/DOM or agent internals