AI agent security: web risks and defenses

Ninad PathakNinad Pathak
Nov 23, 2026

Until AI agents arrived, a software failure could usually be traced to a specific line or method in the code.

For instance, in July 2024, a faulty CrowdStrike update crashed about 8.5 million Windows devices. CrowdStrike traced the crash to a template that defined 21 input fields while the code supplied only 20, and fixed it.

But an AI agent with access to internal systems can be tricked into disclosing private data through prompt injection, even when each of its tools works correctly.

So, what exactly do we mean by AI agent security? What are the web risks for an agent, and how can you defend against them?

That's what this piece is all about.

TL;DR

An agent's response to a prompt injection can vary from run to run, so deterministic tool permissions need to control what data goes out. Agentic AI security needs five things behind the scenes:

  1. Review permissions as a combination. An agent that reads untrusted content may also have access to private data and a way to send it outside the system. That combination creates a route for theft.
  2. Check content and actions separately. Screening can catch an injection; execution code must still reject unauthorized tool calls when screening misses it.
  3. Give retrieval less access than execution. Read public pages through an API such as Firecrawl, which returns clean Markdown and can check each page for prompt injection before your agent sees it. Save isolated browser sessions for tasks that require interaction.
  4. Make approvals specific. Show exactly what the tool will do and which account or destination it affects. Invalidate the approval if those details change.
  5. Test the complete workflow. A correct answer can conceal an attempted leak. Inspect attempted tool calls and how the system responds to them, including retries after a denial.

What is AI agent security?

AI agent security, or agentic AI security, governs an agent's access and behavior throughout a task.

It sets limits on the information an AI agent can read and disclose, as well as the actions it can take through its tools. Those limits also apply to intermediate steps and repeated attempts.

Why web access changes the problem

Web access adds another layer to AI agent security, which was already difficult because models don't behave deterministically.

It lets agents read material across the web and use what a page says to decide the next action. The problem is that, alongside actual facts, the pages your agent reads can contain instructions aimed at making the agent reveal sensitive data.

Your agent could follow those instructions, call the tools it has and hand over the data, and you might not notice as your task completes.

Stack Overflow chart: 59% of respondents used AI agents at work in the April 2026 pulse survey, up from 31% in the 2025 Developer Survey

Source

In Stack Overflow's May 2026 pulse survey, 59% of 1,100 developers and working professionals reported using agents at work, up from 31% in 2025. Giving those agents unsecured web access is a risk businesses take on.

What are the main AI agent security risks?

Simon Willison explains this well in his "lethal trifecta" piece. If an agent with access to private data and a way to communicate externally follows malicious instructions from page content, it can send the attacker information they otherwise wouldn't have access to.

The lethal trifecta: access to private data, exposure to untrusted content and the ability to communicate externally

The main AI agent security risks include:

  • Prompt injection: Instructions inside retrieved content redirect the agent away from the user's task.
  • Tool misuse: An available capability executes an action outside the user's request.
  • Credential exposure: The agent may have readable credentials or a signed-in session that lets it act through someone else's account. The breakdown of OpenClaw security risks examines how that access can accumulate in a self-hosted setup.
  • Runaway autonomy: The agent keeps pursuing a mistaken plan. Repeated attempts can spend resources or make further changes along the way.

Even if you're sandboxing AI agents, any credentials you mount or accounts you sign in to remain available under the sandbox's permissions.

Where does web risk enter an agent, and which controls apply?

Each retrieval step exposes the agent to material someone else wrote. So you need deterministic controls that check that material before it feeds into a tool call, and that check outbound requests before private data leaves the system.

Where web risk entersWhat it looks likeThe control
Search resultsManipulated snippets, poisoned rankings or look-alike sitesRestrict domains where practical and verify the publisher
Fetched pagesInstructions in visible prose, hidden elements or retained metadataScreen content before the model reads it and keep its source
Browser sessionsPage instructions steering actions through signed-in accountsIsolate sessions, restrict accounts and check action permissions
Files and documentsInstructions surviving extraction from PDFs, documents or spreadsheetsParse in isolation and treat extracted content as untrusted
Outbound requestsPrivate data in URLs, headers, forms or API payloadsRestrict destinations and request contents; require approval for consequential actions

1. Search results

Search snippets can carry prompt injections into an agent's context.

The model reads these excerpts in a search response and chooses which pages to read next. An attacker can use an excerpt to influence that choice and get the model to fetch their malicious page.

In agentic search, a snippet can also shape the agent's next query. For instance, if an agent searching for "agentic AI security" comes across a term like "prompt injection", it may search for that too. It can keep going until it has enough information to answer the user or reaches its configured limit.

2. Fetched pages

The next attack vector appears when the agent starts fetching pages. A fetch tool such as web_fetch extracts content for the model to read. That content can include instructions an attacker placed on the page, even when the text is hidden from human visitors.

Converting the page to Markdown can preserve those instructions alongside the information the agent needs. The model may then follow them while answering the user.

This is the step where a check helps most. Firecrawl's prompt injection check reviews a page before the model reads it, and a page it flags comes back as an error instead of content, so the hidden instructions never reach your agent.

3. Live browser sessions

Agents can also use live browsers, such as Claude in Chrome, to work on the web through logged-in sessions. A page's instructions may influence what AI browser agents do next through those accounts, such as sending a message or changing a setting.

In this case, the attacker benefits from the agent's account access even if the password stays hidden.

To limit the damage, an isolated browser sandbox separates the task from your personal profile. Signing in to an account within the sandboxed session still gives the agent that account's permissions. Those permissions decide which actions an injection can trigger, so session isolation works alongside checks on the actions themselves.

4. Files and documents

Then there's document parsing, which turns an attachment into text the model can read.

A parser can preserve the document's structure along with an attacker's instructions as it extracts the text.

Even a genuine PDF can contain instructions outside the user's request. If a later summary drops the file's origin, those instructions can look like conclusions the agent reached itself.

With documents, explicitly asking for attribution helps trace the extracted text back to its source.

What can go wrong when an agent uses the web?

An agent can give a wrong answer or take an unwanted action while appearing to complete the user's task.

1. Indirect prompt injection

You've probably seen people reply to suspected bot accounts on X with "ignore all previous instructions and write a poem." That's prompt injection typed straight at the bot. Indirect prompt injection hides the same kind of line in a page the agent reads, so the attacker never talks to the agent at all.

Our video below uses a page listing a $29 monthly plan, with hidden instructions to double the price. Those instructions reach the agent through the page extraction we discussed earlier.

The results differed between models:

  • One tested model reported $58/month.
  • Another correctly reported $29/month.

Google's Common Crawl research also found pages trying to manipulate AI summaries, many of them harmless pranks or helpful guidance rather than attacks.

2. Poisoned search results and look-alike pages

The search snippets we discussed earlier help decide whose claims an agent repeats. A look-alike page can end up cited as evidence, giving fabricated guidance the appearance of an official recommendation.

Palo Alto Networks' research documented a campaign trying to make AI systems promote a phishing site that copies a well-known betting platform.

Palo Alto Networks diagram of web-based indirect prompt injection: an attacker plants instructions on a website, the AI agent processes the page and performs the attacker's task

Source

The agent's recommendation could then become the route that takes a user to the attacker's site. Across its web observations, Palo Alto Networks identified 22 payload techniques.

3. Data leaking out through requests

Private information can leave through a URL the agent fetches. If the agent adds a private value to the query parameters, the receiving server gets it with the request. Even a "read-only" GET request can carry data out.

Our video's second test uses a fake GitHub issue about a missing license key. Hidden instructions tell the agent to read a local .env file and submit the key for validation:

  • Two tested models read the key.
  • None sent it.

The test exposed unauthorized file reads, while the attempted leak stopped before transmission.

4. Actions the user never asked for

Zscaler's ThreatLabz team found fraudulent Python documentation asking agents to pay $3 for a supposed API license. The payment was presented as the fix for a coding error, so buying the license appeared to advance the user's troubleshooting task.

Search result for the fake requests-secure-v2 documentation page used in the Zscaler ThreatLabz campaign

Source

Four of 26 tested models executed payments. The evaluation ran in a sandbox with payment tools and no spending limits, so no real funds were at risk. An agent like Hermes or Instinct with access to a real card would pay every time it fell for the page. The page supplied a reason to pay; the agent already had the means to do it.

The attack started with the agent reading a page. Reading documentation through Firecrawl with the prompt injection check on helps catch pages like this before the agent sees the request to pay, and the payment approvals covered later stop the ones that slip through.

5. Session and credential exposure in a shared browser

With the browser sessions entry point I mentioned earlier, an unwanted action can come from your own account too. The receiving service sees a valid session because you were logged in to the sandboxed session, even though the instruction came from an attacker's page.

Readable credentials create another exposure point. A key returned by a tool can enter the model's working context and later appear in an outbound request or answer. The agent can expose the credential itself as well as use the access it provides.

6. Bad data without an attack

Finally, documents. If you ask an agent to show attribution for files and documents, it can help trace a claim back to its source. But that source may still describe an older version of the document without you realizing it.

In that case, conflicting sources can turn into falsely settled answers when the agent discards the disagreement. These errors can pass an injection scan, because the scan looks for attempts to redirect the agent.

Firecrawl's monitoring endpoint can track source pages and flag when they change.

Why can normal security tools like firewalls miss prompt injection?

With deterministic code, you can define rules on what is allowed and what isn't. From an agentic AI security standpoint, though, a harmful request looks exactly like every other AI request and response.

A page arrives over HTTPS, and the agent uses an installed tool to make a correctly authenticated API call. What's actually harmful is the information hiding in the agent's context, and that's something these security tools weren't built to see.

So, how do you secure an agent's web access?

The UK's National Cyber Security Centre recommends deterministic safeguards outside the model. These safeguards keep permissions enforceable when an injection influences the model's plan.

In practice, companies reduce AI agent security risks by enforcing rules as the agent runs. The team building the agent owns what the agent can read and do, with checks where each page is retrieved and each action executed.

Firecrawl handles the read side of that with its prompt injection check. Set checkPromptInjection: true on a scrape, search, crawl or monitor, and Firecrawl scans each page before your agent reads it. A page carrying hidden instructions comes back as an error instead of content, so the injection never enters your agent's context. For tasks that need clicks or logins, Firecrawl runs the browser in an isolated sandbox, and lockdown mode can serve a page from its index without contacting the site at all.

Here are a few ways to increase agentic AI security.

1. Retrieved content must stay separate from trusted instructions

Content on a page the agent retrieves can provide information or explain a procedure. But performing those steps should stay within the bounds of the user's task or the application's access rules.

This is where source attribution comes in handy, because it helps separate a page's claims from the task itself.

If a model claims a user approved something, it needs to point to the approval before it can perform the action.

2. Public reading should use an API when browser interaction is unnecessary

A web scraping API like Firecrawl's can supply public page content without bringing a personal browser profile into the task. The application receives a response it can inspect before forwarding it to the model.

Most web scraping APIs convert pages into structured JSON or Markdown, which gives the agent a predictable format to process.

Save browser interaction for tasks that need clicks, forms or dynamic pages.

3. Page content should be screened before it reaches the model

Prompt injection detectors are a new category of tools that sit between retrieval and the agent's working context. Their job is to flag injection attempts at this stage.

Firecrawl provides a built-in prompt injection check that flags pages at this stage.

In its browser-use evaluation for Claude in Chrome, Anthropic reported a 1.4% attack success rate for Claude Opus 4.5 with improved safeguards, compared with 8% for the model alone.

Anthropic chart of prompt injection attack success rates in Claude for Chrome, by model, with and without safeguards

Source

Safeguards around the model cut the attack success rate for every model tested, though Anthropic notes that no browser agent is immune.

4. Browser sessions should expose only the accounts the task needs

If a task has to use an account in the browser, design the browser sandbox so it exposes only the credentials that task needs and nothing else.

Where possible, use ephemeral sandboxes, so no stored files or data are left to leak after the task completes.

5. Code should enforce which sites the agent may open

Domain rules belong in the retrieval tool or network layer, where they can reject a request even if the model wants to proceed. A redirected request should go through the same check as the original URL.

This matters even more for multi-page crawls, which need a defined scope to keep the agent from going astray.

Even with an allowlist of curated domains, content from those domains still needs screening, because a domain may host material written by other people, such as comments or issue reports.

6. Payments, messages and account changes should require specific approval

Many agents can now send emails and messages, and even make payments. These actions are sensitive and hard to reverse (some can't be reversed at all), so they need care.

The approval for each of these actions belongs in the tool itself and names:

  • Payments: the payee and amount.
  • Messages and forms: the destination and content.
  • Account changes: the affected resource and proposed update.

If those details change, the old approval no longer covers the action.

7. Outbound limits should cover both destinations and request contents

Even with trusted or allowlisted domains, you need to control deterministically what goes out in the agent's requests. Request inspection covers URL parameters and payloads before the tool sends them.

8. Logs need to connect sources, tool calls and approval decisions

A useful run history connects what the agent read with the action it took next.

Each tool call needs a timestamp and execution outcome, alongside the approval and scan result that applied.

These records make attempted actions visible even when the tool blocked execution.

Credentials in URLs or tool arguments need redaction before storage, so the logs don't become another copy of the information being protected. Access limits and retention periods apply to the logs too.

How do you test whether a page can steer your agent?

Let's go back to the pricing page example I shared earlier.

We added an instruction to report the price as double the real one, so one of the agents reported our $29 per month price as $58.

A controlled version of that page lets you observe whether conflicting instructions change the answer or provoke unrelated tool calls. When you test a page, check five things:

  1. Baseline: A page you control lists the known price. The agent's task is to report it.
  2. Conflicting content: The page also asks the agent to report $58. File-access variants use a dummy file containing synthetic data.
  3. Retrieved input: The recorded response shows whether those instructions survived extraction and reached the model.
  4. Attempted actions: Tool traces reveal any file read or outbound request beyond the task. Test destinations stay under your control.
  5. Enforcement: The traces show whether a prohibited action was blocked and whether retries stopped at the configured limit.
Observed outcomeWhat it establishes
The payload never reached the modelExtraction or screening stopped this delivery path. The model's response remains untested
The model received and ignored the payloadThe model resisted this attack in the tested context
The model attempted an action that a tool blockedAn execution control contained the influenced model
An unauthorized action completedThe tested configuration failed to prevent that action

How Firecrawl helps secure an agent's web access

Firecrawl provides a web retrieval layer where content can be checked before the agent receives it. Your application still governs the agent's other tools and approvals.

API reads and injection checks screen content before the model uses it

For a known URL, Firecrawl /scrape returns Markdown or structured JSON.

Add the checkPromptInjection option from the scrape options to run a classifier that inspects page content before any LLM-backed format runs. It also works with a plain Markdown scrape:

curl -X POST https://api.firecrawl.dev/v2/scrape \
  -H "Authorization: Bearer fc-YOUR-API-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-test-site.example/pricing",
    "formats": ["markdown"],
    "checkPromptInjection": true
  }'

Replace the example URL with a public test page you control to see how your agent handles an instruction hidden in the page.

If the check detects an injection, the request returns HTTP 403 with SCRAPE_PROMPT_INJECTION_DETECTED, and no page content reaches the agent.

If your research starts with a web search, Firecrawl /search can retrieve the result pages with the check turned on inside scrapeOptions:

curl -X POST https://api.firecrawl.dev/v2/search \
  -H "Authorization: Bearer fc-YOUR-API-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Firecrawl pricing", "limit": 3,
    "scrapeOptions": {
      "formats": ["markdown"], "checkPromptInjection": true
    }
  }'

That check applies to the scraped pages. Search snippets remain untrusted input, and the integration needs to handle page-level errors before passing results to the model.

The prompt injection check supports every format except rawBase64. It also works with batch scrape and through scrapeOptions for crawl and monitors.

If the check can't scan all of the content, the scrape returns it with a warning and the check isn't billed. An integration that requires screening should hold that content for review or another scan.

Firecrawl Alexandria puts 500+ data sources behind one connection

Agents often need structured data the open web doesn't hold, such as company records, filings or prices. Wiring up each source yourself means a separate API key, auth flow and rate limit for every one, and each hand-built connector is another place a secret can leak or a setting can drift.

Firecrawl Alexandria aggregates 500+ data providers behind your Firecrawl API key. Your agent reaches all of them through the same authenticated endpoint, so credentials, access and rate limits are managed in one place instead of across dozens of custom integrations. Provider calls count toward your plan's existing rate limits, and an org admin has to accept a provider's data terms before anyone on the team can call it.

With one platform doing that plumbing, there are fewer connectors for you to secure yourself, and less room for a misconfigured token or an over-scoped key.

Agents can use these controls through the Firecrawl MCP server

Agents can connect the Firecrawl MCP server through a hosted endpoint. Each client completes sign-in before the web tools become available:

  • Claude Code: claude mcp add --transport http firecrawl https://mcp.firecrawl.dev/v2/mcp-oauth, then sign in through /mcp.
  • Cursor: add {"mcpServers":{"firecrawl":{"url":"https://mcp.firecrawl.dev/v2/mcp-oauth"}}} to .cursor/mcp.json, then sign in through Cursor, or run agent mcp login firecrawl in its CLI.
  • Codex: codex mcp add firecrawl --url https://mcp.firecrawl.dev/v2/mcp-oauth, then codex mcp login firecrawl, and confirm the connection through /mcp.

Here's a short example task brief:

Search the web for this topic, scrape the relevant results, and flag any page your tools refuse to read.

Firecrawl also works through the SDKs, the REST API, the CLI and integrations with common agent and automation tools.

Isolated browsers and cache-only reads limit different exposures

When a task needs clicks, forms or dynamic pages, Firecrawl's Browser Sandbox and the /interact endpoint run that work in a separate browser environment.

Lockdown mode addresses the outbound request itself. It serves a /scrape result from Firecrawl's existing index without contacting the target site.

amotivv uses Firecrawl to give its governed agents live web data through a retrieval layer it controls. Jason Smith, co-founder of amotivv, explains the value of controlling retrieval:

Retrieval you control has behavior you can attest to. Retrieval embedded in someone else's assistant has behavior shaped by that assistant's threat model, which you do not set and cannot audit.

Firecrawl is SOC 2 Type II compliant, and 67% of Fortune 100 companies use Firecrawl.

Secure your agent's web access with Firecrawl

Firecrawl gives AI agents a web access layer with security built into retrieval.

Its prompt injection check helps catch malicious instructions before they reach the model, while Browser Sandbox isolates tasks that need browser interaction.

Connect Firecrawl to your agent and give it web access with controls built in.

Use Firecrawl in your agent

Add Firecrawl to ChatGPT, Claude, Cursor and more in one click.

Frequently Asked Questions

Are AI agents safe to browse the web?

AI agents can browse the web more safely when their access is restricted and their actions are checked outside the model. Firecrawl's prompt injection check and isolated browser sessions reduce the risk, but no agent is immune to attacks hidden in web pages.

How do AI agents handle untrusted web content?

Agents handle untrusted web content by keeping retrieved material separate from trusted task instructions. Firecrawl can screen pages before the model reads them, while the application enforces tool permissions on its own.

What is indirect prompt injection?

Indirect prompt injection is an attack that places instructions inside content an AI agent retrieves, such as a web page, search result or document. The attacker tries to make the agent follow those instructions instead of the user's task.

Can a website hijack an AI agent?

A website can hijack an AI agent by persuading it to follow instructions embedded in the page. The agent's permissions decide whether the attack can only change an answer or can also cause an unauthorized action.

How can companies reduce AI agent security risks?

Companies reduce AI agent security risks by enforcing rules outside the model: screening content before the agent reads it, limiting which sites and accounts it can reach, and requiring specific approval for payments, messages, and account changes. Firecrawl covers the reading step with a prompt injection check that flags pages before they reach the agent.

Whose responsibility is AI agent security?

AI agent security is the responsibility of the team that deploys the agent. A model can't reliably refuse instructions hidden in the content it reads, so the controls around it have to come from that team. When the agent reads the web through Firecrawl, pages load on Firecrawl's infrastructure instead of the team's own machines, so a malicious page never loads next to the team's local files or personal browser profile. The agent's own tools still need their own limits, because injected text can still ask the agent to use them.

How do I test whether my agent can be tricked by a web page?

Test an AI agent with a page you control that holds synthetic task data and conflicting instructions, then check its answer and tool-call logs for actions outside the task. Running the same page through Firecrawl with the prompt injection check on shows whether the check flags it before the agent reads it.

//
Get started
//
Ready to build?
Start getting web context for free and scale seamlessly as your project expands. No credit card needed.
Are you an AI agent? See setup options