AdInject: Real-World Black-Box Attacks on Web Agents via Advertising Delivery

Haowei Wang 1,2,3
Junjie Wang 1,2,3*
Xiaojun Jia 4
Rupeng Zhang 1,2,3
Mingyang Li 1,2,3
Zhe Liu 1,2,3
Yang Liu 4
Qing Wang 1,2,3*

1State Key Laboratory of Intelligent Game, Beijing, China, 2Institute of Software, Chinese Academy of Sciences, Beijing, China, 3University of Chinese Academy of Sciences, Beijing, China, 4Nanyang Technological University, Singapore, *Corresponding authors

TL;DR

We introduce AdInject, a novel, real-world black-box attack method that leverages internet advertising delivery to inject malicious content into Web Agents’ environments, misleading them into clicking ads with high success rates (often >60%, sometimes approaching 100%).

Diagram illustrating the AdInject attack methodology.
Demonstration of AdInject

Abstract

Vision-Language Model (VLM) based Web Agents represent a significant step towards automating complex tasks by simulating human-like interaction with websites. However, their deployment in uncontrolled web environments introduces significant security vulnerabilities. Existing research on adversarial environmental injection attacks often relies on unrealistic assumptions, such as direct HTML manipulation, knowledge of user intent, or access to agent model parameters, limiting their practical applicability. In this paper, we propose AdInject, a novel and real-world black-box attack method that leverages the internet advertising delivery to inject malicious content into the Web Agent’s environment. AdInject operates under a significantly more realistic threat model than prior work, assuming a black-box agent, static malicious content constraints, and no specific knowledge of user intent. AdInject includes strategies for designing malicious ad content aimed at misleading agents into clicking, and a VLM-based ad content optimization technique that infers potential user intents from the target website’s context and integrates these intents into the ad content to make it appear more relevant or critical to the agent’s task, thus enhancing attack effectiveness. Experimental evaluations demonstrate the effectiveness of AdInject, attack success rates exceeding 60% in most scenarios and approaching 100% in certain cases. This strongly demonstrates that prevalent advertising delivery constitutes a potent and real-world vector for environment injection attacks against Web Agents. This work highlights a critical vulnerability in Web Agent security arising from real-world environment manipulation channels, underscoring the urgent need for developing robust defense mechanisms against such threats.

Key Findings

Our research on AdInject revealed several critical aspects of Web Agent vulnerabilities:

  1. Novel Attack Vector via Advertising: We identified internet advertising delivery as a practical and potent channel for injecting malicious content to attack Web Agents, moving beyond less realistic injection methods.
  2. Realistic Black-Box Threat Model: AdInject operates under a stricter threat model, assuming no knowledge of the agent’s internals, user intent, and imposing constraints on static ad content, reflecting real-world attacker capabilities.
  3. Effective Malicious Ad Design: We developed strategies for crafting deceptive ad content (e.g., framing the ad click as a necessary step like “Close AD”) that successfully misleads Web Agents.
  4. VLM-Powered Content Optimization: A VLM-based technique to infer potential user intents from website context and tailor ad content further enhances attack success rates.
  5. High Attack Success Rates: Experiments on benchmarks like VisualWebArena and OSWorld showed AdInject achieving ASRs exceeding 60% in most scenarios and approaching 100% in some cases, demonstrating significant vulnerability in state-of-the-art Web Agents.
  6. Limited Defense Effectiveness: Simple prompt-based defenses, even with specific knowledge of the attack, only partially mitigate the threat, with AdInject still achieving around 50% ASR.

Technical Approach

AdInject’s methodology focuses on misleading a Web Agent into clicking a malicious ad, adhering to a realistic threat model.

Realistic Threat Model

  1. Black-box Agents: No access to agent internals, parameters, or task information. The attack must be general.
  2. Ad Content Constraints: Injected ads are restricted to static resources (text, images, links) without JavaScript, reflecting advertising platform policies.
Diagram illustrating the AdInject Advertisement Style.
Kinds of Styles

The core principle is to make the agent perceive clicking the ad as a necessary step to complete its task.

  1. Realism: Ad designs are based on common formats (e.g., Google AdSense display ads like pop-ups, banners, sidebars).
  2. Content Crafting: Manually designed content aims to be persuasive and task-interrupting. An example includes:

VLM-based Advertisement Content Optimization

Diagram illustrating the Content Optimization.
Demonstration of Content Optimization

To enhance effectiveness, AdInject employs a VLM to optimize ad content:

  1. Intent Inference: A VLM analyzes the target website’s homepage (screenshot and Accessibility Tree) to infer potential user intents.
  2. Content Refinement: The VLM then refines the initial ad content by integrating these inferred intents, making the ad appear more relevant or critical to the agent’s perceived task, thereby increasing the likelihood of a click.

Results

AdInject was evaluated on VisualWebArena and OSWorld benchmarks using various Web Agents and settings.

Main Attack Effectiveness

The primary experiments, using default-sized pop-up style ads without content optimization, demonstrated significant attack success rates.

Table 1: Main Results on VisualWebArena (Partial) (Corresponds to Table 1 in the AdInject paper)

AgentModelSetting
ASR(%)ASR(\%)
StepclickStep_{click}
SRatk(%)SR_{atk}(\%)
SRorig(%)SR_{orig}(\%)
Basic AgentGPT-4oA11y Tree73.151.4527.3225.93
A11y Tree + Screen93.511.0045.8344.90
Set-of-Marks93.991.7518.5125.93
Basic AgentClaude-3.7A11y Tree37.922.7430.5620.38
A11y Tree + Screen66.672.4245.3833.33
Set-of-Marks53.248.5016.6720.83

These results show high ASRs, especially for GPT-4o, indicating the base AdInject method is highly effective at inducing unwanted clicks.

Ad Content Optimization Impact

The VLM-based ad content optimization further improved attack effectiveness.

Table 2: Results of Ad Content Optimization (Partial) (Corresponds to Table 3 in the AdInject paper)

ModelSetting
ASR(%)ASR(\%)
StepclickStep_{click}
SRatk(%)SR_{atk}(\%)
GPT-4oA11y Tree73.151.4527.32
A11y Tree w/ Optimize79.171.2925.00
A11y Tree + Screen93.511.0045.83
A11y Tree + Screen w/ Optimize94.901.0343.06
Claude-3.7A11y Tree37.922.7430.56
A11y Tree w/ Optimize63.892.2831.49
A11y Tree + Screen66.672.4245.38
A11y Tree + Screen w/ Optimize77.321.1838.43

Optimization consistently increased ASR and often reduced the steps needed for the agent to click the ad, demonstrating the value of tailoring ad content.

Baseline Comparison

AdInject’s core design principle significantly outperformed other ad content strategies.

Table 3: Results of Baseline Comparison (Partial, VisualWebArena, A11y Tree + Screen) (Corresponds to Table 4 in the AdInject paper)

ModelAd Setting
ASR(%)ASR(\%)
StepclickStep_{click}
SRatk(%)SR_{atk}(\%)
GPT-4oVanilla0.00-45.83
Injection0.00-41.67
Virus20.833.1442.13
Speculate4.175.3339.82
Ours93.511.0045.83
Claude-3.7Vanilla0.00-36.57
Injection0.00-44.90
Virus1.3913.3343.06
Speculate3.248.1445.83
Ours66.672.4245.38

The 0.00% ASR for ‘Vanilla’ ads confirms clicks are attack-induced. AdInject’s strategy of framing the ad click as necessary for task completion is markedly more effective.

Defense Experiments

Even with defensive prompts, AdInject maintained notable effectiveness.

Table 4: Results of Defense Experiments (Partial, VisualWebArena, Basic Agent GPT-4o, A11y Tree + Screen) (Corresponds to Table 7 in the AdInject paper)

PositionDefense Level
ASR(%)ASR(\%)
StepclickStep_{click}
SRatk(%)SR_{atk}(\%)
-None93.511.0045.83
Goal1 (Generic)93.511.0138.89
2 (Ads)92.601.0339.82
3 (Specific)56.941.0946.29
System1 (Generic)93.991.0247.22
2 (Ads)92.601.0650.00
3 (Specific)89.351.2251.85

Generic warnings were ineffective. Only specific warnings (Level 3), particularly when placed in the Goal prompt, reduced ASR, but the attack still succeeded in over half the cases.

Conclusion

In this paper, we introduce AdInject, a real-world black-box attack method targeting VLM-based Web Agents. Leveraging the internet advertising delivery, AdInject injects malicious content under a strict threat model, avoiding unrealistic assumptions of prior works. Our experimental results on VisualWebArena and OSWorld demonstrate the significant effectiveness of AdInject, achieving high attack success rates, often exceeding 60% and approaching 100% in certain scenarios. This work reveals a critical security vulnerability in Web Agents stemming from realistic environment manipulation channels, underscoring the urgent need for developing robust defense mechanisms against such practical threats.

BibTeX Citation

@misc{wang2025adinjectrealworldblackboxattacks,
      title={AdInject: Real-World Black-Box Attacks on Web Agents via Advertising Delivery}, 
      author={Haowei Wang and Junjie Wang and Xiaojun Jia and Rupeng Zhang and Mingyang Li and Zhe Liu and Yang Liu and Qing Wang},
      year={2025},
      eprint={2505.21499},
      archivePrefix={arXiv},
      primaryClass={cs.CR},
      url={https://arxiv.org/abs/2505.21499}, 
}