Default-Deny Egress for AI Agents: Stopping SSRF and Tool-Call Data Exfiltration

Proactive Security for the AI Era
NodeZero continuously and autonomously pentests infrastructure, identity, cloud, and now web applications, chaining weaknesses across every domain the way real attackers do. Every finding ships with replayable proof showing exploitable business impact, not theoretical risk.
Give an AI agent a tool that fetches a URL, queries an internal API, or reads a webhook payload, and you have given it the ability to make an outbound network connection to a destination it chooses at runtime, based on content it just read. That content might be a document a user uploaded, a web page the agent retrieved to answer a question, or a response from another tool the agent already called. None of that content is guaranteed to be trustworthy, and an agent has no reliable way to tell the difference between an instruction from its operator and an instruction embedded in the text it is processing. That gap, between what the agent is supposed to do and what it can be talked into doing by content it reads, is what makes egress control a distinct architectural requirement for agentic systems rather than a restatement of ordinary network segmentation. This piece works through why the risk is structurally different from classic SSRF, what a default-deny egress layer for agent tool calls actually requires, and how to build and test one.
The problem: agents decide their own outbound destinations
Classic server-side request forgery exploits a specific vulnerable parameter: a URL field, a webhook callback, an image-import feature that a developer wired to accept user input and then fetches it server-side. The set of things the server can be tricked into fetching is bounded by which parameters exist and how they are validated. Finding an SSRF bug in a traditional application means finding one of those parameters and proving it reaches an internal or attacker-controlled destination.
An AI agent with tool access removes that boundary. The agent's next action, including which URL to fetch, which internal API to query, or which endpoint to send a summary to, is a decision the model makes at runtime based on the full context it is holding, which includes untrusted content by design. A retrieved web page can contain text instructing the agent to fetch a second URL. A tool's own JSON response can contain a field the agent interprets as an instruction. A document a user uploaded for summarization can carry hidden text steering a later tool call. None of these are bugs in the traditional sense; they are the intended behavior of a system built to read content and act on it. The result is that any tool capable of making an outbound request is a potential SSRF path, not because the tool is poorly written, but because the caller deciding the destination is a language model reasoning over untrusted input rather than a fixed code path.
The highest-value target for this kind of steering is the cloud metadata service. AWS, Azure, and GCP all expose instance metadata, including temporary IAM credentials, at the link-local address 169.254.169.254, reachable without authentication from inside the VM or container. An agent that can be steered into fetching that address, directly or via a redirect chain, hands back live cloud credentials to whatever untrusted content triggered the request. A second target is anything on the internal network the agent's runtime can otherwise reach: internal admin panels, other services' unauthenticated APIs, or metadata about the deployment itself. A third is exfiltration in the other direction: an agent convinced to POST a summary of sensitive data it has read to an attacker-controlled endpoint disguised as a legitimate-looking callback URL.
Prerequisites
Building egress control for agent tool calls requires a specific network architecture in place before the allowlist logic itself matters:
Agent runtime isolation. The process or container executing agent tool calls needs to run in its own network segment or namespace, separate from the rest of your infrastructure, so that "internal network" and "agent network" are distinct zones with a controllable boundary between them. If the agent runs on the same flat network as your databases and internal services with no segmentation, an egress proxy in front of its HTTP client only closes one of several paths to those services.
Forced routing of all outbound traffic. Every outbound connection the agent's tools can make, not just the ones going through an HTTP fetch tool, needs to be forced through the control point. This usually means a combination of a network-level default-deny firewall rule (nothing leaves the agent's subnet unless a rule permits it) and an HTTP-aware forward proxy for the traffic that needs domain-level allowlisting rather than just IP/port rules.
An inventory of what the agent actually needs to reach. You cannot write a default-deny allowlist without first knowing the legitimate destinations: which APIs each tool calls, which internal services are genuinely required, and which of those can be scoped to a specific agent or task rather than granted globally.
Logging and alerting infrastructure. A default-deny policy generates denied-request events by design, both from real attacks and from legitimate new integrations you have not allowlisted yet. You need somewhere those denials land and get reviewed, or the policy either gets disabled the first time it blocks something legitimate, or drifts silently.
Briefings like this, every morning before 9am.
Threat intel, active CVEs, and campaign alerts, distilled for practitioners. 50,000+ subscribers. No noise.
Procedure
The following steps build the egress control layer from the network boundary inward to the allowlist logic itself.
Subscribe to unlock Remediation & Mitigation steps
Free subscribers unlock full IOC lists, Sigma detection rules, remediation steps, and every daily briefing.
Validation: test cases to confirm the control actually holds
Before trusting this architecture in production, run the following test cases against it. Each should fail (be blocked) except the last, which should succeed:
Metadata endpoint fetch. Configure a test agent or tool call to request http://169.254.169.254/latest/meta-data/ (or the equivalent Azure or GCP metadata path). Confirm the proxy and the network-layer firewall both independently deny it, and confirm the denial is logged and alerts fire.
DNS-rebinding attempt. Register a test domain whose DNS record you control, add it to the allowlist as if it were a legitimate destination, then change its DNS record to resolve to an internal RFC1918 address or 169.254.169.254 and repeat the request. Confirm the proxy's resolve-then-validate step catches the changed resolution rather than trusting the hostname because it matched the allowlist string.
Internal RFC1918 address fetch. Attempt to reach an internal service by its private IP address directly (bypassing DNS entirely) from the agent's network segment. Confirm the network-layer firewall rule from the procedure blocks it independent of whatever the HTTP proxy does, proving the control does not rely solely on hostname-based logic.
Redirect-chain evasion. Point a test request at an allowlisted domain that issues an HTTP redirect to a blocked destination (an internal IP or the metadata range). Confirm the proxy re-applies its validation after following the redirect rather than only checking the original request's destination.
Legitimate allowlisted call. Run a real tool call to a destination that is genuinely on the agent's allowlist (the actual API the tool is meant to reach) and confirm it succeeds with no added latency that would make the control operationally unworkable. A control that blocks everything, including legitimate traffic, will get disabled the first time it causes an incident; validating the positive case is as important as validating the negative ones.
Failure cases: where this architecture breaks down in practice
Allowlist drift as agents gain new tools. The most common way this control degrades is silent: a team adds a new tool or integration to an agent, the tool works in testing because a developer manually added a permissive rule to get past the proxy, and that rule is never scoped down or reviewed again. Over time the allowlist accumulates broad exceptions that no longer reflect what any single agent actually needs, and the effective policy converges toward allow-most rather than default-deny. Treat every new tool addition as a required allowlist review, not an optional one, and periodically audit for allowlist entries nobody can explain.
Proxies that only cover HTTP, missing other protocols the agent's tools use. An HTTP-aware forward proxy stops fetch and browse tools cleanly, but agent tool ecosystems increasingly include direct database clients, gRPC calls to internal services, raw DNS lookups performed independently of any HTTP request, and in some deployments a shell or code-execution tool that can invoke curl, wget, or a language runtime's own socket library directly. Any of those paths that does not route through the HTTP proxy bypasses the allowlist entirely unless the network-layer default-deny firewall from the procedure's first steps is also genuinely enforced. Verify coverage by attempting an outbound connection through every distinct tool category the agent has access to, not just the ones that obviously make HTTP calls.
Agents running outside the controlled network path. Browser-based agents, client-side agent extensions, or agents embedded in a desktop application make their outbound requests from the end user's own network, not from infrastructure you control. A server-side egress proxy has no visibility into or control over those requests at all. For these deployment models, the equivalent control has to live in the browser extension or client application itself (a local allowlist enforced in the client, or routing the client's traffic through a company-managed proxy via device management), and it is a fundamentally weaker control because it runs on infrastructure the user, not you, ultimately controls. Any risk assessment for a client-side or browser-based agent needs to treat egress control as substantially harder to guarantee, not as a solved problem carried over from the server-side pattern.
Degraded allowlists under time pressure. During an incident or a rushed feature launch, the fastest way to unblock a failing agent is often to widen an allowlist rule rather than diagnose why the narrower rule was insufficient. Each of these shortcuts is individually reasonable and cumulatively erodes the control. Track allowlist rule count and scope over time as an operational metric, the same way you would track firewall rule sprawl, so the trend is visible before the policy has quietly become permissive.
Security tradeoffs
Default-deny egress for agents is not free, and the costs are worth naming rather than glossing over.
Operational overhead versus blast radius. Maintaining a per-agent, per-task allowlist requires ongoing engineering attention: every new integration needs a reviewed rule, every agent redesign needs the allowlist re-audited, and every denial needs someone to determine whether it is an attack or a legitimate gap. That overhead is real and recurring. The alternative, unrestricted or loosely restricted egress, converts every prompt injection or malicious tool response from a contained event into a potential path to cloud credential theft, internal network reconnaissance, or data exfiltration. The overhead is the cost of keeping the blast radius of a single successful injection bounded to what a specific agent's specific allowlist permits, rather than open to your entire reachable network.
False-positive blocking of legitimate new integrations. A well-enforced default-deny policy will, by design, block a legitimate new API call the first time a team tries it, before anyone has added it to the allowlist. This creates friction that teams will be tempted to route around, either by requesting overly broad allowlist entries or by disabling the proxy for a specific agent "temporarily." Building a fast, low-friction path to review and approve new allowlist entries (ideally as fast as a normal pull request review, not a multi-day change-management process) is what keeps that friction from turning into pressure to weaken the control instead.
DNS-rebinding and redirect-chain checks add latency and complexity. Resolving DNS at the proxy, validating every returned IP, and re-validating after redirects is more code and more processing per request than a naive hostname-string allowlist check. It is also the part of the architecture most likely to have a subtle bug if implemented in a hurry (missing IPv6 ranges, not re-validating after a redirect, caching a resolution longer than the DNS record's TTL in a way that misses a rebinding attempt). This is the piece of the procedure worth the most code review scrutiny, since a control that looks complete but has a gap in exactly this logic is worse than no control, in that it creates false confidence.
For teams already working through where AI tools fit in their broader governance picture, this control is one piece of a larger problem; our guide on shadow AI governance covers the visibility gap that often exists before an organization even knows which agents have outbound network access to begin with. And because many agent tool integrations authenticate via OAuth grants to SaaS platforms rather than static API keys, the access those grants represent is worth auditing on its own terms; see our guide on auditing OAuth app grants across Microsoft 365, Entra ID, and Google Workspace for how to find and review what an agent's connected apps can actually reach, independent of the network-layer controls in this piece.
The bottom line
An AI agent with tool access is a system that decides its own outbound network destinations at runtime based on content it cannot fully verify, which makes classic SSRF thinking (protect the known vulnerable parameters) insufficient on its own. The fix is architectural, not a prompt-level guardrail: force every outbound connection through a default-deny proxy or firewall, block link-local and cloud metadata ranges explicitly and redundantly, resolve and validate DNS before connecting rather than trusting a hostname that once matched an allowlist, and scope what each agent and task can reach as narrowly as its actual tools require. None of this is a one-time deployment. Allowlists drift as agents gain tools, new protocols slip past HTTP-only proxies, and client-side agents sit entirely outside the network path this architecture controls. Treat the allowlist and its coverage as a living piece of infrastructure that gets reviewed on every tool change, the same discipline you would already apply to firewall rules protecting anything else with this much reach.
Frequently asked questions
Why is SSRF a bigger problem for AI agents than for traditional web applications?
In a traditional web application, the set of outbound destinations a server will contact is fixed by the code a developer wrote: a payment API, a specific webhook URL, a known internal service. SSRF in that context requires an attacker to find a specific vulnerable parameter that lets them redirect one of those fixed calls somewhere else. An AI agent has no fixed destination list. It reads content, including content it did not choose and cannot fully trust (a retrieved document, a scraped web page, a tool's own response), and it decides in real time what URL to fetch next based on that content. If an attacker can influence any text the agent reads, they can potentially influence what the agent's next tool call targets, which means every tool capable of making a network request is a latent SSRF path, not just the ones a developer explicitly wired to user input.
What is the cloud metadata endpoint and why do agents need to be blocked from reaching it?
Cloud providers expose a link-local address, 169.254.169.254, from inside virtual machines and containers so workloads can query their own instance metadata, including temporary IAM credentials, without any authentication. AWS, Azure, and GCP all use the same address for this purpose (with provider-specific paths and headers). If an agent's fetch tool can be pointed at that address, either directly or through a redirect, it will return live cloud credentials to whatever process made the request, and from there to whatever untrusted content steered the agent there in the first place. Blocking that address (and provider-specific alternates, since some environments expose additional metadata IPs) at the network layer, not just in application logic, is the single highest-value control in this entire architecture because the impact of a successful hit is full cloud account compromise, not just an internal data leak.
Isn't a prompt-based guardrail enough to stop an agent from fetching a bad URL?
No. A prompt-based guardrail, a classifier, or an in-process filtering library only has a chance to act if it runs somewhere in the code path between the model's decision and the actual network call, and agent frameworks vary widely in whether that hook exists, whether it is enforced consistently across every tool, and whether a determined prompt injection can talk the model into rephrasing its way around it. The proxy or firewall sitting at the network egress boundary sees every outbound connection regardless of which tool, framework, or library produced it, and it enforces policy before a TCP connection completes rather than after a model has already decided to make one. Treat inference-layer guardrails as a second layer that reduces how often the network layer gets tested, not as a substitute for it.
What is DNS rebinding and why does an allowlist by hostname alone not stop it?
DNS rebinding is an attack where a hostname that passes an allowlist check at one moment resolves to a different, disallowed IP address (often an internal RFC1918 address or the metadata endpoint) by the time the actual connection is made. If a proxy checks a hostname against its allowlist, then performs a separate DNS lookup and connects to whatever that lookup returns, an attacker who controls the DNS record for an allowlisted-sounding domain (or who wins a race between the check and the connect) can redirect the connection anywhere. The fix is to resolve the hostname once, validate that every resolved IP address is itself allowed (not link-local, not RFC1918, not the metadata range) before opening a connection, and pin the connection to that validated address rather than letting the underlying HTTP client re-resolve the hostname on its own.
Does a default-deny egress proxy also need to inspect protocols other than HTTP?
Yes, and this is one of the most common gaps. Many egress proxies are deployed as HTTP forward proxies because that is what a fetch or browse tool uses, but agent tool ecosystems commonly include database clients, raw TCP or gRPC connections to internal services, DNS lookups performed independently of any HTTP request, and in some setups shell or subprocess tools that can invoke curl, wget, or a scripting language's own networking stack directly. Any of those paths that bypasses the HTTP proxy bypasses the allowlist entirely. A complete architecture enforces default-deny at the network namespace or firewall level (so nothing leaves the agent's network segment on any protocol without matching a rule) and treats the HTTP-aware proxy as an additional layer for the traffic that needs application-level allowlisting, not as the only control.
How do we keep the allowlist from becoming unmanageable as agents get more tools?
Scope allowlists per agent and per task rather than maintaining one global list that every agent shares. A code-review agent and a customer-support agent have different legitimate destinations, and a shared allowlist sized for the union of both is larger than either one needs, which increases blast radius if either agent is compromised. Build the list from the agent's actual declared tool set (map which APIs and domains each tool is documented to call) rather than watching traffic and adding whatever shows up, since traffic-based allowlisting tends to encode whatever the agent happened to do during testing rather than what it is supposed to be allowed to do. Review the list whenever a new tool is added to an agent, treat allowlist changes as a reviewed configuration change rather than an ad hoc firewall edit, and alert on denied requests so allowlist gaps surface as an operational signal instead of a silent failure users report later.
Sources & references
Free resources
Critical CVE Reference Card 2025–2026
25 actively exploited vulnerabilities with CVSS scores, exploit status, and patch availability. Print it, pin it, share it with your SOC team.
Ransomware Incident Response Playbook
Step-by-step 24-hour IR checklist covering detection, containment, eradication, and recovery. Built for SOC teams, IR leads, and CISOs.
Get threat intel before your inbox does.
50,000+ security professionals read Decryption Digest for early warnings on zero-days, ransomware, and nation-state campaigns. Free, daily, no spam.
Unsubscribe anytime. We never sell your data.

Founder & Cybersecurity Evangelist, Decryption Digest
Cybersecurity professional with expertise in threat intelligence, vulnerability research, and enterprise security. Covers zero-days, ransomware, and nation-state operations for 50,000+ security professionals every morning.
