Explainer
Which prompt injection defenses work for browser agents?
No defense fully stops prompt injection in a browser agent. What OWASP, Anthropic, OpenAI and Google document, who measured what, and what to build first.

No defense stops prompt injection in a browser agent outright, and every major vendor I read says so. The layer you can rely on is architecture: keep untrusted pages, private data and the power to act out of the same autonomous session, and put confirmation gates outside the model on anything that changes state. Training and classifiers lower the attack rate; they don’t remove the risk.
I compared what OWASP, Anthropic, OpenAI, Google, Microsoft, Meta and Brave document, then set the vendors’ own numbers against two independent studies. Below you’ll find every defense with who measured it, what each agent API ships today, and a pick for read-only, logged-in and payment agents.
Short on time?
Short on time? Here's my take.
- Build this first
- Confirmation gates outside the model
- A check in your code on every state change. Every model lab and browser maker I read documents it, and it doesn't depend on the model resisting.
- Read-only research agent
- Isolated, logged-out browser
- No secrets in the session, and outbound traffic limited to the task's domains.
- Logged-in agent
- Break the trifecta
- Per-task profile, scoped credentials, and a confirmation on every send or write (Meta's Rule of Two).
- Payments
- Never autonomous
- A human approves amount and payee, or a platform checkout holds the credentials.
- Picking a model API
- Claude computer use
- Its injection classifier is on by default; Gemini's is opt-in. A pick from the docs, not a measured one.
Prices verified . Sponsors cannot buy a verdict or a position.
What is prompt injection when an agent browses? #
Prompt injection is text that makes a model do something its user never asked for. OWASP’s LLM01:2025 entry splits it in two: direct injection, where the user’s own input alters behaviour, and indirect injection, where the instructions arrive inside external content such as websites or files.
A browser agent lives on the indirect side. Every page it reads, every screenshot it takes and every tool result it gets back comes from someone you don’t control, and the model reads all of it in the same stream as your request.
Brave puts the root cause as “the collapse of the instruction/data boundary” and says indirect injection is “not a deficiency of any single architecture” (Brave, June 8, 2026). That’s why the problem shows up in every agent browser, not in one product.
Why does a logged-in agent raise the stakes? #
A research bot reading public pages can be misled into a bad summary. An agent signed into your email, CRM or bank can be misled into acting with your privileges, which is why Claude’s computer use docs say that using logins “increases the risk”. Which sign-in pattern you choose changes how much a hijacked agent can do; I compare them in safer login setups for browser agents.
Brave’s 2025 write-up of Perplexity’s Comet is the plain example: the browser sent page content to the model without separating it from the user’s instructions (Brave, August 20, 2025). Brave’s proposed fixes were to treat page content as untrusted, check actions against the user’s request, require user interaction for sensitive actions and isolate agentic browsing.
Does anyone claim it’s solved? #
No. Here’s what each party wrote, in its own words.
| Who | What they say |
|---|---|
| OWASP | “it is unclear if there are fool-proof methods of prevention for prompt injection” |
| Anthropic | “No browser agent is immune”, and a 1% success rate “still represents meaningful risk” |
| OpenAI | Prompt injection is “unlikely to ever be fully ‘solved’” |
| Brave | It “cannot be fully solved within the current LLM architecture” |
| Google Chrome | “security for web agents is still an emerging domain” |
| Microsoft | Its defense “does not rely on our ability to block all prompt injections” |
So the useful question isn’t which defense blocks injection. It’s which defenses lower the odds, and which ones limit the damage when an attack gets through.
Which defenses exist, and who measured them? #
I sorted every defense I found into ten families, and every number in the table was measured by the people behind that defense. The column I’d read first is “who measured”: a vendor grading its own model, paper authors grading their own method, or nobody, because the control is deterministic code.
| Defense | Documented by | Best public number | Who measured | Known limit |
|---|---|---|---|---|
| Adversarial training of the model | Anthropic, OpenAI, Chrome | 1.4% attack success (Claude Opus 4.5 with safeguards) | Anthropic, own attacker | Self-test; adaptive attacks broke most “near-zero” defenses in an independent study |
| Injection classifiers | Anthropic, Gemini (opt-in), Microsoft Prompt Shields, Chrome, Perplexity BrowseSafe | F1 about 0.91 (BrowseSafe) | Perplexity, own benchmark | 76.0% on multilanguage attacks; Chrome’s “cannot flag everything” |
| Spotlighting | Microsoft, Chrome | From over 50% to under 2% attack success | Paper authors (Microsoft) | 2024 tests on GPT-family models; base64 adds about 33% tokens |
| Instruction hierarchy | OpenAI paper | None in the abstract | Paper authors | Qualitative, GPT-3.5 |
| Alignment critic (second model checks actions) | Chrome, Brave | None published | Nobody | The critic sees less context |
| Origin or domain allowlists | Chrome, Claude, OpenAI, Gemini | Deterministic | Not applicable | Limits usefulness; lists need upkeep |
| Human confirmation gates | OWASP and every model lab and browser maker I read | Deterministic | Not applicable | My view, not a source’s: only as good as the approval screen |
| Isolation, no secrets in context | Claude, OpenAI, Browserbase | Deterministic | Not applicable | Contains damage; doesn’t stop the injection |
| Capability and information-flow design | CaMeL, Microsoft FIDES, design-patterns paper | 77% of AgentDojo tasks with provable security, vs 84% undefended | CaMeL authors | Costs utility; research code |
| Architecture rule (trifecta, Rule of Two) | Simon Willison, Meta | Not applicable | Not applicable | Rule of thumb; still needs supervision |
Table verified November 17, 2026. Sources for each row are linked in the sections below.
Training and classifiers lower the rate #
Anthropic trains Claude with reinforcement learning on simulated pages that carry injected instructions, scans all untrusted content with classifiers (hidden text, manipulated images, deceptive UI) and keeps an internal red team (Anthropic). OpenAI built an RL-trained automated attacker and rolled an adversarially trained browser-agent checkpoint out to all Atlas users, but it published no success rates. The page I read showed no date; the post was out by December 23, 2025, when Gigazine covered it. Atlas itself has since been retired: OpenAI’s help page is now titled “ChatGPT Atlas retirement”, and The Next Web reported a target of August 9, 2026. I could not confirm the shutdown date on an OpenAI page, so read the hardening post as describing a product that no longer ships.
Perplexity’s BrowseSafe detector reports an F1 of about 0.91, against about 0.85 for frontier models (GPT-5, Sonnet 4.5), which it says drop further without reasoning, and about 0.35 for PromptGuard-2, on Perplexity’s blog but not in the paper’s abstract. The same post shows the soft spots: multilanguage attacks drop balanced accuracy to 76.0%, and three distractors pull accuracy from over 90% to about 81%.
Spotlighting and instruction hierarchy change how the model reads #
Spotlighting marks untrusted text so the model can tell it apart from instructions; Microsoft describes three modes: delimiting, datamarking and encoding. The 2024 spotlighting paper by Microsoft authors reports attack success falling from greater than 50% to below 2% on GPT-family models, with minimal task impact.
Chrome’s developer guidance suggests delimiting for low-risk content and base64 encoding for high-risk content, at about 33% token overhead. OpenAI’s instruction-hierarchy paper trains models to ignore lower-privileged instructions and reports much better resistance on GPT-3.5 with little loss of capability, but its abstract gives no numbers.
Critics and allowlists check actions, not text #
Chrome’s agent design adds a User Alignment Critic: a separate model that sees only metadata about a proposed action, inspired by the dual-LLM pattern and CaMeL. Chrome also splits sites into read-only and read-writable Agent Origin Sets, and asks for confirmation before sensitive sites, sign-in, purchases and messages.
Every computer-use guide I read recommends a domain allowlist (Claude, OpenAI, Gemini). Gemini’s docs call an allowlist “more secure” than a blocklist, and I agree: a blocklist assumes you already know which page carries the attack.

Confirmation gates and isolation limit the damage #
OWASP’s mitigations include “Require human approval for high-risk actions”, and every model lab and browser maker I read documents a version of it (OWASP). Microsoft adds deterministic blocking of known data-exfiltration routes, such as markdown image injection, on top of human-in-the-loop consent (MSRC).
Isolation doesn’t stop an injection; it limits what one can reach. OpenAI’s guide recommends a fresh browser profile or isolated desktop and keeping credentials out of page text and screenshots, and Browserbase describes one VM per session, destroyed after use, with secrets passed as runtime parameters. That post is a product pitch, but its zero-trust stance “assumes the risk of the webpage being compromised”, which is the right starting point.
Capability designs aim for a guarantee #
CaMeL takes control and data flow from the trusted user query, so “untrusted data retrieved by the LLM can never impact the program flow”, and capabilities block unauthorized data flows. On the AgentDojo benchmark (97 tasks, 629 security test cases) it completed 77% of tasks with provable security, against 84% undefended: a cost of 7 percentage points.
A later 14-author paper describes design patterns that aim at “provable resistance”, each with its own trade-off between usefulness and security. Neither is a switch you can flip in a product today, but they’re the strongest answer I found to “what if the model gets fooled anyway?”
How much do the vendor numbers tell you? #
Less than they seem: each one is a vendor grading its own model against an attacker it chose. Anthropic’s chart is the most detailed public number for a browser agent. It used an internal adaptive “Best-of-N” attacker with 100 attempts per environment, roughly 2,200 to 3,200 attempts per bar (Anthropic, November 24, 2025).
| Claude model | Model only | Old safeguards | Improved safeguards |
|---|---|---|---|
| Opus 4.5 | 8.0% | 7.6% | 1.4% |
| Sonnet 4.5 | 13.8% | 10.8% | 1.9% |
| Haiku 4.5 | 12.0% | 11.1% | 2.4% |
| Sonnet 4 | 13.8% | 10.7% | 2.0% |
Attack success rate under Anthropic’s own attacker, from its November 2025 chart. Lower is better.
My arithmetic on Opus 4.5: going from 8.0% to 1.4% is an 82.5% relative drop ((8.0 − 1.4) ÷ 8.0). It still means about 1 to 2 successful attacks per 100 tries under that attacker, and Anthropic itself says 1% “still represents meaningful risk”.
Two things limit how far I’d lean on it. Anthropic chose the attacker and graded its own models, and the chart covers the 4.5 generation from a year ago; I found no independent measurement of Claude for Chrome, Comet or Gemini in Chrome after their latest updates (or of Atlas, which has been retired).
What happens when the attacker adapts? #
“The Attacker Moves Second”, by Nasr, Carlini and co-authors, went after 12 published defenses with adaptive attacks and reached over 90% attack success against most of them. The line I’d pin above any vendor chart: “the majority of defenses originally reported near-zero attack success rates”.
WASP, a web-agent benchmark mostly by researchers at FAIR (Meta), found that injections “partially succeed in up to 86%” of cases. Agents often failed to finish the attacker’s goal, which the authors call “security by incompetence”; I read that as protection that shrinks as agents get better at tasks.
One security vendor’s explainer quotes AgentDojo at “under 25%” and InjecAgent at “about 60%” (Aurascape). I couldn’t find either figure in the abstracts I read, so I left both out of the table.
My reading: treat any vendor attack-success rate as a floor set by the vendor’s own attacker, and re-check it after every model update. A filter that catches 95% of attacks sounds fine until you read Simon Willison calling that “very much a failing grade” for security.
What does each agent API ship today? #
If you’re building on a model API rather than a finished browser, the defaults differ, most of all on whether anything scans for injection out of the box. I compared the computer-use docs from the three model labs and Chrome’s agent guidance; the full Claude-versus-Gemini comparison is in my Gemini vs Claude computer use guide.
| Platform | Prompt-injection check | Confirmation | Isolation and limits |
|---|---|---|---|
| Claude computer use | Classifiers “automatically scan what the tool returns, such as screenshots”, on by default; opt out via support | Flagged content steers the model to check with you; docs advise confirmation for consequential actions and before each batch of actions | Dedicated VM or container, minimal privileges, no account logins, domain allowlist |
| Gemini computer use | Screenshot scanning (Gemini 3.5 Flash-Lite or later) is opt-in and defaults to false | Actions carry a safety_decision; on require_confirmation, prompt the end user and send a safety_acknowledgement only if they confirm |
Allowlist, sandbox, log everything; safety overrides are preferences, not guarantees |
| OpenAI computer use | “Treat screen content as untrusted”; page text cannot grant permission | Confirm consequential actions | Fresh profile or isolated desktop, allowlist of sites and actions, step, time and cost limits |
| Chrome agent | Parallel injection classifier plus a User Alignment Critic | Before sensitive sites, sign-in, purchases and messages | Agent Origin Sets, a work log with user takeover, automated red teaming, bug bounty up to $20,000 |
Verified November 17, 2026.
The difference I’d act on: Claude’s classifier runs unless you ask support to turn it off, while Gemini’s scan does nothing until you enable it. Anthropic’s docs still say the other precautions remain important with the classifier on.
If your agent reaches the browser through MCP, the 2025-11-25 spec says tool annotations “should be considered untrusted, unless obtained from a trusted server”, and hosts must get explicit user consent before invoking any tool. It also says MCP “cannot enforce these security principles at the protocol level”, so the gate is your host’s job; my browser MCP servers guide covers the servers themselves.
Does your agent hold the lethal trifecta? #
It does if it reads web pages, can reach private data and can send data out, and that’s the first thing I’d check in any design, before picking a classifier. Simon Willison’s lethal trifecta names three ingredients: access to private data, exposure to untrusted content and the ability to communicate externally, and his advice is to avoid the combination.
Meta’s Agents Rule of Two says the same thing in builder terms. An agent should hold at most two of three properties, and with all three in one session it “should not be permitted to operate autonomously”.
| Lethal trifecta (Willison) | Agents Rule of Two (Meta) | |
|---|---|---|
| First property | Exposure to untrusted content | [A] Untrustworthy inputs |
| Second property | Access to private data | [B] Sensitive systems or private data |
| Third property | External communication | [C] Change state or communicate externally |
| The rule | Avoid the combination | All three in one session: no autonomous operation |
| How the author frames it | A rule to design around | A stopgap until research can reliably catch injections; a supplement to least privilege, not a substitute |
Meta’s third property is broader than Willison’s, because it counts any change of state, such as a purchase or a deleted record, not only sending data out. I’d design to Meta’s version for that reason.
A browser agent always has [A], because the web is the untrusted input. So for every deployment, the real design question is which of [B] or [C] you remove, or put behind a human.
Which guardrails fit your deployment? #
Short version: an isolated, logged-out browser for read-only agents, a confirmation on every send or write for logged-in ones, and a human on every payment. Here’s the pick I’d make for the three shapes most builders ship, mapped to the Rule of Two.
| Deployment | Rule of Two status | My pick | Also add |
|---|---|---|---|
| Read-only research agent (no logins, no writes) | Has [A]; drop [B] | Isolated, logged-out browser with no secrets and outbound traffic limited to the task’s domains | Treat the output as untrusted; turn the classifier on if your API offers one |
| Logged-in agent (email, CRM, dashboards) | Has [A] and [B]; gate [C] | Per-task profile, scoped credentials never in the prompt, a confirmation on every send or write | Origin allowlist split into read-only and read-write sites, in the style of Chrome’s Origin Sets |
| Payments agent | Has all three | Never autonomous: a human approves amount and payee outside the model, or a platform checkout holds the credentials | A capability-style policy (the CaMeL idea) if you build the flow yourself |
Verified November 17, 2026.
For a research bot, the two risks are a poisoned answer and a leak through outbound requests. Restricting outbound traffic closes the leak, and reading the output as untrusted handles the rest, especially if results feed an index (my web scraping for RAG guide covers that side). A fresh cloud browser per task makes the “no cookies” part easy; I compare providers in picking a cloud browser for AI agents.
For a logged-in agent, the gate has to sit outside the model. A confirmation the model can talk itself past is just another prompt, while a check in your code that blocks the send until a person clicks doesn’t care what the page said. Frameworks where your code picks each step make those gates easier to place, which is one reason I’d look hard at the explicit-step style in Browser Use vs Stagehand.
For payments, all three properties are present by definition: the web, your money and an action that’s hard to undo. I’d keep a human on amount and payee, or hand checkout to a platform where the merchant and wallet hold the credentials, as I describe in ChatGPT Wallet and agent checkout.

What I would do first #
Ship the read-only agent first, in a fresh cloud-browser session per task, with no cookies and an outbound allowlist. Add logins only behind confirmation gates, and keep payments human-approved. The agent browser hub maps the browsers and tools for each of those steps.
If I were building on a model API today, I’d start on Claude’s computer use because its injection classifier is on by default. That’s a pick from the docs, not a measured one; on Gemini, I’d turn the scan on before anything else.
A checklist before your agent goes live #
Each item maps to one of the seven mitigations in OWASP LLM01:2025, shown in brackets.
- Isolate the browser. One VM or container per task with minimal privileges, destroyed after use, plus step, time and cost limits (Claude, OpenAI, Browserbase). [Least privilege]
- Keep secrets out of context. No credentials in prompts, page text or screenshots; pass them as runtime parameters (Browserbase). [Least privilege]
- Allowlist origins. Restrict where the agent can go, and separate sites it may read from sites it may write to (Chrome). [Constrain model behavior]
- Gate every write and send. Purchases, messages, sign-ins and deletions wait for a deterministic approval outside the model. [Human approval for high-risk actions]
- Spotlight untrusted text. Delimit page content, and encode it for high-risk flows if you can afford the extra tokens (Chrome for Developers). [Segregate external content]
- Turn the classifier on and cap inputs. Use your API’s scanner, and set token limits on inbound tool responses (Chrome for Developers). [Input and output filtering]
- Check actions against the request and log everything. Compare each action with what the user asked for, and keep a work log a person can review and take over from (Brave, Chrome). [Validate expected outputs]
- Red-team with an open tool. Chrome’s docs name Promptfoo, Bloom and Petri; repeat after each model update. [Adversarial testing]
FAQ #
Can prompt injection be fully prevented? #
No. OWASP says it is unclear if there are fool-proof methods of prevention, OpenAI calls it unlikely to ever be fully solved, Anthropic says no browser agent is immune, and Brave says it cannot be fully solved within the current LLM architecture. Plan to limit the damage, not to block every attempt.
Does running the model locally make it safe? #
No. Brave’s June 2026 analysis says local models are equally exposed, because the root cause is the collapse of the instruction/data boundary, not where the model runs. Isolation, least privilege and human approval still apply.
Is a prompt-injection classifier enough? #
No. Google says Chrome’s classifier cannot flag everything, Simon Willison calls a 95% catch rate a failing grade, and adaptive attacks beat most of 12 published defenses at over 90% success. Use a classifier as one layer under confirmation gates and isolation.
What is the lethal trifecta? #
It is Simon Willison’s name for an agent that combines private data, untrusted content and a way to communicate externally. Meta’s Agents Rule of Two makes the same point: an agent with untrusted inputs, sensitive data and the power to change state in one session should not run autonomously.
Does Claude or Gemini scan for prompt injection automatically? #
Claude’s computer use tool does: its classifiers scan what the tool returns, such as screenshots, by default, and you opt out through support. Gemini’s screenshot scan for prompt injection is opt-in and defaults to false.
What is spotlighting? #
It is a Microsoft technique that marks untrusted text so the model can tell it apart from instructions, by delimiting, datamarking or encoding. Chrome’s developer docs put the token overhead of base64 encoding at about 33%.
Sources
26 sources, accessed .
Official pricing, docs, changelogs and status pages 15
- OWASP LLM01:2025 Prompt Injection
- Anthropic, Mitigating the risk of prompt injections in browser use (Nov 24, 2025)
- Claude computer use tool docs
- OpenAI, Continuously hardening ChatGPT Atlas against prompt injection attacks (read via reader proxy)
- OpenAI computer use guide
- Google, Architecting Security for Agentic Capabilities in Chrome (Dec 8, 2025)
- Chrome for Developers, agent security
- Gemini computer use docs
- Microsoft MSRC, How Microsoft defends against indirect prompt injection attacks (Jul 29, 2025)
- Perplexity, BrowseSafe (Dec 2, 2025)
- Brave, Comet prompt injection (Aug 20, 2025)
- Brave, Indirect prompt injection (Jun 8, 2026)
- Meta, Agents Rule of Two (Oct 31, 2025)
- Model Context Protocol specification 2025-11-25
- Browserbase, prompt injection containment (Feb 13, 2026)
Independent benchmarks and published studies 8
- Hines et al., Spotlighting (arXiv 2403.14720)
- Wallace et al., The Instruction Hierarchy (arXiv 2404.13208)
- Debenedetti et al., CaMeL (arXiv 2503.18813)
- Design Patterns for Securing LLM Agents against Prompt Injections (arXiv 2506.08837)
- AgentDojo (arXiv 2406.13352)
- Nasr, Carlini et al., The Attacker Moves Second (arXiv 2510.09023)
- WASP web agent security benchmark (arXiv 2504.18575)
- BrowseSafe (arXiv 2511.20597)


