SnapGuard: 基于截图的轻量级提示注入检测方法
SnapGuard: Lightweight Prompt Injection Detection for Screenshot-Based Web Agents
AI总结:
针对基于截图的网络代理面临的提示注入攻击问题,提出SnapGuard方法,通过视觉稳定指标和文本信号分析实现高效检测,达到F1得分0.75,速度提升8倍。
摘要:
网络代理已成为自动化复杂网页环境交互的有效范式,但易受提示注入攻击影响,攻击者通过嵌入恶意指令诱导意外行为。截图型网络代理因依赖渲染的视觉页面而非结构化文本,传统文本中心防御无效。尽管多模态检测方法被探索,但依赖大视觉语言模型(VLMs)导致计算开销大。现代网页的复杂性使得VLMs需理解整个页面的全局语义,造成推理时间和GPU内存使用高。本文观察到注入网页在视觉和文本上均具显著差异。基于此,提出SnapGuard,将提示注入检测转化为网页截图的多模态表示分析。SnapGuard利用两个互补信号:视觉稳定性指标识别由恶意内容引起的异常平滑梯度分布,以及通过对比极性反转恢复的行动导向文本信号。在八种攻击和两种良性设置的评估中,SnapGuard达到F1得分0.75,优于GPT-4o-prompt,速度提升8倍(1.81秒 vs 14.50秒),无额外内存开销。
英文摘要:
Web agents have emerged as an effective paradigm for automating interactions with complex web environments, yet remain vulnerable to prompt injection attacks that embed malicious instructions into webpage content to induce unintended actions. This threat is further amplified for screenshot-based web agents, which operate on rendered visual webpages rather than structured textual representations, making predominant text-centric defenses ineffective. Although multimodal detection methods have been explored, they often rely on large vision-language models (VLMs), incurring significant computational overhead. The bottleneck lies in the complexity of modern webpages: VLMs must comprehend the global semantics of an entire page, resulting in substantial inference time and GPU memory usage. This raises a critical question: can we detect prompt injection attacks from screenshots in a lightweight manner? In this paper, we observe that injected webpages exhibit distinct characteristics compared to benign ones from both visual and textual perspectives. Building on this insight, we propose SnapGuard, a lightweight yet accurate method that reformulates prompt injection detection as multimodal representation analysis over webpage screenshots. SnapGuard leverages two complementary signals: a visual stability indicator that identifies abnormally smooth gradient distributions induced by malicious content, and action-oriented textual signals recovered via contrast-polarity reversal. Extensive evaluations across eight attacks and two benign settings demonstrate that SnapGuard achieves an F1 score of 0.75, outperforming GPT-4o-prompt while being 8x faster (1.81s vs. 14.50s) and introducing no additional memory overhead.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。