Can prompt injection be detected before a web agent acts?
Only partly. In a 2025 benchmark, detectors found attacks with explicit text instructions or visible image changes with moderate to high accuracy. They largely failed on attacks with no explicit instructions or with imperceptible changes (Liu et al., 2025). If an agent can act for a user, detection should not be the only safeguard.
At a glance
- Finding: Page content can steer web agents, and detection is uneven.
- Why it matters: An agent that reads a page may treat hostile content as an instruction.
- Limit: These are research benchmarks and abstracts, not a measure of any product today.
What is prompt injection in a web agent?
A web agent is software that reads pages and takes steps such as clicking, typing or buying. Prompt injection means placing text or visuals on a page that the agent mistakes for instructions from its user.
An illustrative case: a product review contains hidden text telling the agent to open a different page. The user never asked for that. The agent can observe the text, but it has no authority to treat it as a command.
What the research found
Four papers from 2025 examined different parts of the problem. I reviewed only their abstracts.
- Pixel-level attacks. WebInject changes the raw pixels of a rendered page so that a screenshot-reading agent performs an attacker-chosen action. Its authors report it is highly effective against baselines (Wang et al., 2025).
- Visible malicious prompts. VPI-Bench has 306 test cases across five platforms. Computer-use agents were deceived at rates up to 51%, and browser-use agents up to 100%, on certain platforms. System-prompt defenses helped only a little (Trinh et al., 2025).
- Realistic HTML. BrowseSafe built a benchmark of injections in realistic HTML. It focused on attacks that influence actions, not just text output. The authors propose layered defenses, both architectural and model-based (Zhang et al., 2025).
- Detection. The WAInjectBench result above shows the gap between obvious and quiet attacks.
Why detection is not enough
The abstracts point to a shared lesson. Attacks can arrive through text, HTML or pixels, and some leave no obvious instruction to flag. A filter that reads only one channel will miss the others.
The "up to" figures also describe specific platforms and tests. They are not average failure rates for all agents.
What this means for your site and your agent
Site owners cannot fully control how an agent reads a page. You can still reduce risk on your own pages:
- Do not let user-generated content, such as reviews or comments, appear in places where it could pass as site instructions.
- Keep sensitive actions behind explicit confirmation steps.
If you build agents, the BrowseSafe authors' layered approach is a reasonable direction. Limit permissions, require approval for consequential actions, and add model-based checks as one layer among several. That is my inference from the abstracts, not a tested result.
What remains uncertain
These papers date from 2025, and I did not review their full methods. Agents, defenses and attacks change quickly. The abstracts do not show how often such attacks succeed against production agents today.
Next steps
- Map your actions. List what an agent could do on your site, such as checkout, account changes or form submission. Mark which ones need a human confirmation.
- Test with your own content. Place a harmless, clearly labeled test instruction in a review or comment field. Check whether your agent follows it. Record any action it takes.
- Separate reading from authority. In your agent design, treat page content as evidence only. Allow actions only when they trace back to the user's request.