Manipulating LLM Web Agents with Indirect Prompt Injection Attack via HTML Accessibility Tree

Sam Johnson, Viet Pham, Thai Le
7/20/2025
cs.CRcs.AI

Official code: sej2020/Manipulating-Web-Agents (6 stars, MIT, last commit 2025-07-09).

Abstract

This work demonstrates that LLM-based web navigation agents offer powerful automation capabilities but are vulnerable to Indirect Prompt Injection (IPI) attacks. We show that adversaries can embed universal adversarial triggers in webpage HTML to hijack agent behavior that utilizes the accessibility tree to parse HTML, causing unintended or malicious actions. Using the Greedy Coordinate Gradient (GCG) algorithm and a Browser Gym agent powered by Llama-3.1, our system demonstrates high success rates across real websites in both targeted and general attacks, including login credential exfiltration and forced ad clicks. Our empirical results highlight critical security risks and the need for stronger defenses as LLM-driven autonomous web agents become more widely adopted. The system software (https://github.com/sej2020/manipulating-web-agents) is released under the MIT License, with an accompanying publicly available demo website (http://lethaiq.github.io/attack-web-llm-agent).

View on arXivView PDF

Code Implementations(1)

MIT
63PythonFeb 2, 20251 years agoMIT

Similar Papers

Cite this paper

@article{johnson2025manipulating,
  title  = {Manipulating LLM Web Agents with Indirect Prompt Injection Attack via HTML Accessibility Tree},
  author = {Sam Johnson and Viet Pham and Thai Le},
  year   = {2025},
  eprint = {2507.14799},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2507.14799v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2507.14799.svg)](https://codeofpaper.com/paper/2507.14799)

Discussion