FDE Times dataFDE jobs open 932▼14 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 62Companies hiring 202Remote-friendly 24%Median US pay $201kTop hirer Databricks 92
中文VI

The newspaper of the Forward Deployed Engineer

Guides

Your agent's URL tool is a proxy into the client's network

Deny-lists will not save you; only a fetch path that pins the resolved IP and routes through an egress proxy closes the hole.

ShareLinkedInFacebookX

In brief

  • An agent with a URL fetch tool running inside a client's network lets anyone who controls the prompt reach internal services and the metadata service.
  • Deny-lists and hand-written IP checks are easy to bypass; use an allow-list, pin DNS, check every redirect and add an egress proxy.
  • On AWS, the default hop limit of 1 stops containers from getting an IMDSv2 token; raising it to 2 opens a path from the sandbox to credentials.
Diagram of three stacked layers that block SSRF for an agent. Top: the in-code layer, made up of an allow-list and IP checks, is the early filter. Middle, in bold orange: the egress proxy resolves domain names, checks IPs and pins the connection, and is the primary defence. Bottom: network and metadata, made up of a private subnet, IMDSv2 and hop limit.
Three layers to draw when presenting to a customer's security team: the in-code check holds only if every request passes through it. The egress proxy closes the gap between check and connection in one place. Source: Model Context Protocol security best practices, OWASP, AWS documentation on IMDSv2.

Twenty lines of code are enough to give a stranger a foothold inside a client’s firewall. Take an FDE in the third week of an engagement. The internal support agent is running well, and users ask for one small feature: “paste a link, and the agent reads and summarizes it.” A fetch_url tool takes about twenty lines, the demo goes smoothly, and everyone is happy.

But the agent runs on a virtual machine inside the client’s VPC. That machine can see the internal wiki, admin dashboards, databases and the cloud metadata service.

Now anyone who can type into the chat box, or plant an instruction in a web page the agent will read, can send requests from inside the firewall. The twenty-line tool handed them that power.

The flaw is called SSRF. FDEs are almost certain to run into it, because the job is to put agents close to a client’s real data. What follows covers how the attack works, what a safe fetch path looks like, and the most common mistakes.

Why do agents make SSRF worse?

In a traditional web application, an attacker has to find an exposed URL parameter. With an agent, the URL is chosen by a language model, and the model follows text, including text someone else has planted.

The Model Context Protocol’s security best practices document describes exactly this scenario. Its list of consequences includes one line every FDE should know by heart: a server-side MCP client becomes a proxy that bypasses network perimeter controls.

It has already happened in the wild. A May 2026 security bulletin from CraftedSignal on the auth-fetch-mcp package showed that an SSRF flaw in its fetch tool allowed the server to be forced into loading internal resources, cloud metadata endpoints or loopback addresses.

The most valuable target sits on the machine itself

In the cloud, the machine running the agent usually carries an IAM role. Anyone who obtains an IMDSv2 session token can use it to read that role’s temporary credentials from the metadata service. At that point they no longer need the agent: they hold the machine’s permissions and can call the client’s APIs directly.

AWS designed IMDSv2 to add a layer of defense for cases where a firewall is left wide open, a reverse proxy is misconfigured or an application has an SSRF vulnerability. The key mechanism: the response carrying the token has its TTL reduced to zero before it leaves the instance, so only the instance itself can receive the token. According to AWS documentation, the default hop limit for this response is 1.

When the agent runs in a container or sandbox on the instance, this number decides whether the sandbox can get a token. AWS explains that entering a container counts as an extra hop, so with a hop limit of 1 the container may receive no response at all.

The upshot: the default of 1 stops a container one hop from the instance from obtaining a token, while raising it to 2, as AWS itself suggests for container environments, lets the sandbox reach the machine’s credentials.

If someone has raised the hop limit “to make it work,” find out why. AWS also describes an alternative: pass settings such as the Region directly into the container instead of opening the metadata service to it.

What a safe fetch path looks like

The first question for the client is always whether the agent really needs to read any URL. If users only paste the company’s Confluence and GitHub links, use an allow-list. On its own, though, a domain allow-list does not stop DNS rebinding.

The reason is a timing gap the MCP document calls DNS TOCTOU. When you check, the domain points to a public IP; by the time you connect, the HTTP library may resolve it again and get an internal IP.

OWASP warns that a second, unchecked resolution between validation and connection can bypass those checks.

The 2026 advisory for MCP Atlassian is a real example: after validation, requests.get resolved DNS a second time and got 169.254.169.254, the metadata address. The fix MCP suggests is to pin the resolution result: resolve once, check that IP, then connect to that same IP.

Here is the core of the check, in Python:

import ipaddress, socket
from urllib.parse import urlparse

class BlockedDestination(Exception):
    pass

def resolve_and_check(url: str):
    parsed = urlparse(url)
    if parsed.scheme not in ("http", "https"):
        raise BlockedDestination(f"scheme {parsed.scheme}")
    host = parsed.hostname
    ips = {ipaddress.ip_address(info[4][0])
           for info in socket.getaddrinfo(host, None)}
    for ip in ips:
        if ip.version == 6 and ip.ipv4_mapped:
            ip = ip.ipv4_mapped
        if (ip.is_private or ip.is_loopback or ip.is_link_local
                or ip.is_reserved or ip.is_multicast or ip.is_unspecified):
            raise BlockedDestination(f"{host} -> {ip}")
    return host, sorted(ips, key=str)[0]  # the IP to pin for the connection

Three details matter. The function uses the standard library rather than slicing IP strings by hand, because the MCP document warns that attackers get past hand-written parsers by writing IPs in octal, hexadecimal or IPv4-mapped IPv6 form.

It rejects the request if any of the domain’s IPs falls in a private, loopback or link-local range. And it returns an IP so the next step connects straight to it without resolving again.

The hard part is that very step of “connecting straight to the IP” when the URL is HTTPS. You open a socket to the pinned IP, but the SNI in the TLS handshake, certificate verification and the Host header must still carry the original domain, or the server returns the wrong page or the certificate is rejected.

OWASP notes that not every SDK ships with this kind of check built in, so developers have to handle the edge cases themselves.

The advisory for datamodel-code-generator shows the cost: the guard checked the IP once and then let httpx resolve DNS on its own, so nothing tied the connection to the IP that had passed the check.

So treat the function above as an early filter in the application, and hand IP pinning to the egress proxy described below.

Next comes the redirect loop. Turn off the HTTP library’s automatic redirect following, for example with allow_redirects=False. On each 3xx response, take the Location header, call resolve_and_check again and stop after a few hops, because the first URL may be clean while the third points inside.

Good code is still not the main defense

The function above is a protection layer inside the application. It holds only if every path that sends requests goes through it, including browser tools, third-party MCP servers and webhooks. One path that forgets to call it is enough for a breach.

That is why the MCP document advises server-side deployments to use an egress proxy such as Smokescreen, a proxy designed to prevent SSRF, rather than patching each adapter. The proxy itself resolves the domain, checks the IP and opens the connection, so the gap between check and use is closed in one place instead of being scattered across every tool.

At a client site, the sensible setup is to put the agent in a subnet whose only route to the internet runs through the proxy, with no route to databases, IMDSv2 enforced and the hop limit kept at a level that stops the sandbox from reaching the token.

When presenting to the client’s security team, draw three layers: the allow-list and IP checks in code, the egress proxy in the middle, and network segmentation plus metadata configuration at the bottom. If one layer fails, the others still block the attack. A diagram like this usually gets you through a security review far faster than the sentence “we validate URLs.”

Common mistakes

The most common mistake is a deny-list along the lines of “block the strings localhost and 127.”. Those addresses can be written many other ways, and this is precisely the hand-written check the MCP document says to avoid. The second mistake is checking the URL once at the start and then letting the HTTP library follow redirects and re-resolve DNS on its own.

The third is thinking only about users who type malicious URLs. With an agent, the URL can sit in an email, a ticket or a web page the agent is asked to read. The fourth is trusting the cloud to handle metadata, when a hop limit change “so the container works” can reopen exactly that door.

A diagram that fixes bugs and wins jobs

The exercise for this week: take the network diagram of your most recent deployment, mark the machine running the agent, then draw every arrow that machine can send a request to. Any arrow you cannot explain to the client is work to do before the next demo.

That diagram, along with the list of arrows you cut, is also the best evidence you can bring to a job search. If a posting mentions deploying inside client infrastructure or working with security teams, tell exactly that story in the interview: which machine, which arrow, which layer blocked it.

On a CV, a line such as “designed egress policy and blocked SSRF for agents running inside client networks, passing security review” says more than three lines listing frameworks. Hiring managers for FDE roles need to know you can see the arrows others miss.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
8 sources
Read next on the roadmap · Stage 3: Applied AIThe MCP server you approved yesterday can turn hostile after an updateHow to read, version-pin and isolate third-party MCP servers before an agent touches a client's data, and why one approval at install time is not enough.