Prompt injection in web browsing means a webpage carries text that your agent reads as an instruction instead of as data. No filter reliably removes it, so the defense is architectural: untrusted page content goes through typed, schema-bound tools with narrow permissions, and every output stays traceable to its source URL. That is how we built Gyrence's Fetch, Extract and Map primitives, and it is the design this article argues for.
TL;DR
- Indirect prompt injection hides instructions in webpages, documents or tool results that an agent consumes. The user never sees them.
- OWASP's 2026 guidance says models make no architectural distinction between instructions and data, so there is no reliable prevention. Plan for containment.
- Damage scales with privilege: private data, untrusted content and outbound communication together are the dangerous combination.
- Use strict output schemas, least-privilege tools, source URLs on every record and per-channel testing.
- Treat everything fetched from the web as untrusted input, including markdown conversions and extracted JSON.
Table of Contents
- What prompt injection means when an agent browses
- What a hijacked agent actually does
- Pipelines are exposed too, not just browsers
- How effective are the attacks, and the defenses?
- Design for containment
- Test each channel separately
- Where Gyrence fits
- Perspective
- FAQ
- Sources
What prompt injection means when an agent browses
OWASP defines a prompt injection vulnerability as user prompts altering an LLM's behavior or output in unintended ways. The injected content does not need to be human-readable, as long as the model parses it.
Two variants matter:
- Direct: the user's own input overrides the system directives ("ignore previous instructions").
- Indirect: the instructions sit in webpages, documents, emails or database records the model consumes, so it follows them without the user knowing.
Web browsing is the indirect case. Your agent asks for a page, and the page answers with text aimed at the model.
What a hijacked agent actually does
These are documented attacks, not thought experiments.
- Brave showed that a hidden instruction in a Reddit comment, triggered by a "summarize this page" click, led an agent to pull the user's email, request a one-time code and exfiltrate both with no further input.
- Zenity Labs disclosed a vulnerability class in which a malicious email, calendar invite or social post hijacked agentic browsers with zero clicks, reaching Gmail, local files and a password vault.
- Palo Alto Unit 42 reported web-based payloads in HTML, user-generated text, metadata and comments found in the wild, with impact scaling with the privileges of the affected AI system.
Anthropic explains why browsers amplify the problem: every page, ad and script is a potential vector, and the agent can click, fill forms and download files.
Pipelines are exposed too, not just browsers
If your agent never clicks anything but searches, fetches, crawls and extracts, you are still in scope. Payloads planted in pages, tool results and retrieval stores act when retrieved. Rillor's report summarizes AgentDojo results of up to 70% average success for injections placed near the end of a tool response, and 90% success for PoisonedRAG from five poisoned texts per question in a million-document store.

For RAG ingestion, that means a poisoned page that survives chunking and embedding keeps working long after the crawl. Our own guide to agent-safe web scraping covers the ingestion side in more detail.
How effective are the attacks, and the defenses?
| Study | Finding |
|---|---|
| AgentBreaker, 2026 | Context-aware injections hit 71.7%–100% success against five web agents; proposed defenses cut it to 1.7% |
| EMNLP 2025 demo | A trigger tuned on eight login pages leaked credentials on 3 of 11 unseen ones |
| Anthropic browser testing, 2025 | 23.6% attack success without mitigations; 11.2% with them in autonomous mode |
Two lessons follow. Static benchmarks understate risk, because page-specific attacks do far better. And mitigations help without eliminating the problem, so they sit alongside architecture, not in place of it.
Design for containment
OWASP's 2026 list recommends strict output schemas validated in trusted code, least-privilege tool access and capability budgeting. It also cites the "lethal trifecta": an agent with private data access, untrusted content ingestion and external communication has the conditions for high-impact exploitation. Remove one leg and the risk falls sharply.
In practice:
- Separate reading from acting. The agent that reads the web should not hold credentials, send email or write to your systems.
- Return typed data, not prose. Extract into a fixed JSON schema and validate it in your own code. A page cannot add a field the schema does not define.
- Keep provenance. Every record carries its source URL, so a compliance reviewer can trace a suspicious value back to the page that produced it.
- Limit the tools. Expose only the tools a task needs. Chrome's security guidance names malicious tool descriptions and contaminated tool outputs as the two attack vectors for WebMCP, and recommends deterministic guardrails such as token limits, origin restrictions and user confirmation.
- Cap the blast radius. Token limits, call limits and spending caps stop a hijacked loop from running unattended.
- Surface failures. An agent that gets a typed failure (blocked, empty, wrong content type) can stop. One that gets silent junk may improvise.
For MCP specifically, see our MCP security checklist and the guide to giving agents the web safely.
Test each channel separately
Web pages, tool outputs, email, retrieval stores and images hide payloads differently, and success varies with payload position and task. Promptfoo's harness shows the pattern: payloads in HTML comments, CSS-hidden text or woven into paragraphs, with exfiltration detected deterministically by watching outbound HTTP requests. Chrome's guidance also suggests content classifiers, intent-checking critics and routine red-teaming.
Two practical habits:
- Build a small corpus of hostile pages for each ingestion path and rerun it on every prompt or model change.
- Assert on behavior (did an unexpected request leave the sandbox?), not on whether the model "refused".
If you also publish pages and want to know how AI bots see them, a free AI crawlability audit shows what crawlers can reach. For agent-side checks, our browsing checklist for developers lists the controls to verify.
Where Gyrence fits
Gyrence gives agents five composable primitives (Search, Traverse, Fetch, Extract, Map) and a hosted MCP endpoint. Extract returns schema-guided JSON, and every call returns a typed response that includes the failure cases, so your code validates results instead of parsing free text. Spending caps bound what a runaway agent can consume, and LLM extraction carries no separate charge. Paid plans are Standard at $75 per month, Growth at $299 and Scale at $549, with Free, Founders and Pay-As-You-Go options on the pricing page. To wire it into an agent, start at the connect guide.
Perspective
We do not claim a scraper can make the web safe. Web data is a storm, and a page can say anything it likes.
What an API can do is stop making the problem worse. Return typed responses. Name the failure modes instead of hiding them. Keep the source on every record. Cap spend so a looping agent cannot run up a bill.
Our position: the fetching layer should be boring and honest, and the trust decision should stay in your code, where you can validate it. Treat every fetched byte as untrusted, and give the agent only the tools the task needs.
Glen
FAQ
Can prompt injection be fully prevented?
No reliable prevention exists today. OWASP's 2026 guidance says models do not architecturally separate instructions from data. Defense means layering schema validation, least privilege, confirmation for risky actions and monitoring.
Does converting pages to markdown remove injected instructions?
Not by itself. Hidden text, comments and attribute content can survive conversion as plain text the model reads. Treat the markdown as untrusted and validate whatever the model derives from it.
Is a read-only agent safe?
It is safer, since it lacks the ability to act or communicate outward. It can still be steered into producing manipulated output, so validate results and keep source URLs for review.
How often should I retest?
Retest whenever you change the model, prompts, tools or ingestion path. Research shows defenses that pass static sets can fail under small adaptive changes.
Sources
- OWASP LLM01:2025 Prompt Injection
- Microsoft Learn: Prompt Injection (Direct / Indirect)
- Brave: Agentic Browser Security
- Zenity Labs PleaseFix disclosure
- Palo Alto Unit 42: Web-Based Indirect Prompt Injection
- Anthropic: Mitigating prompt injections in browser use
- Rillor: Indirect prompt injection testing report
- AgentBreaker (ACM)
- EMNLP 2025 demo on web navigation agents
- Ars Technica on Anthropic browser testing
- OWASP Top 10 for LLM Applications 2026
- Chrome developer security guidance
- Promptfoo: Indirect Prompt Injection in Web-Browsing Agents

