Skip to content
Pro lab

Agent Executor Egress-Containment Lab

An AI agent runs model-generated code in an executor, and that executor keeps reaching out — to documentation, to an unknown domain, to the cloud metadata endpoint (169.254.169.254), to an internal service, to a package registry, to a paste site, to the model-provider API, and — during a scored run — to the benchmark rubric host. For each, decide the egress call, the risk, and the control that fits — because default-deny is not deny-everything, link-local metadata is always off-limits, and a legitimate provider call should still go through a logging proxy. Motivated by Google Cloud AI Research's Harness² (arXiv 2610.14224), grounded in SSRF and cloud-metadata defence, with no invented CVEs.

0s

Executor egress log

1 / 9 triaged

Request · destinationStatus
Fetch a public docs pageExternal, unvetted host▶ now
POST to an unknown domainExternal, unvetted hostqueued
Read the cloud metadata endpointLink-local / cloud metadataqueued
Reach an internal serviceInternal service (RFC1918)queued
Download and run a dependencyPackage registry / mirrorqueued
Call the model-provider APIApproved / allow-listed hostqueued
Phone home to a paste siteExternal, unvetted hostqueued
Reach the benchmark / eval rubric hostBenchmark / eval rubric hostqueued
Open an outbound reverse shellExternal, unvetted hostqueued
Fetch a public docs pageExternal, unvetted host

GET https://docs.python.org/3/library/asyncio.html

The agent is reading language documentation it was told to consult while writing code.

1 · Egress decision

2 · Risk

3 · Containment control

Pick a decision, the risk, and a control to continue.

Destination × risk map

highlowriskapprovedmetadata · internaldestination →deny now

This request: name its risk and where it lands by destination.

Triage

A stream of outbound requests and runtime behaviours from an agent's code executor. For each of 9, decide the egress decision (allow / proxy+log / deny), the risk, and the containment control that fits.

So far: 0 / 9 requests triaged.

Live arena

4 active
adversary kill-chain1/5
platform-sec-noor19%
agent-eng-vera14%
ml-infra-tariq3%
platform-sec-you (you)0%

adversary staging…

Loading…

Sample report · illustrative data

Sample result: Agent Egress Containment Lab debrief

Example run of the triage drill where each outbound request from an AI agent's code-execution environment needs an egress decision, a risk class and the control that fits.

Run result (example)

Weighting
Egress decision 45%, control 35%, risk class 20%
Example score
78%
Clearing the run
Every egress decision and every control must be right
Outcome
Not cleared: two controls wrong

Selected scenarios and the expected answers

RequestEgress decisionRisk class
POST to an unknown domainDeny at the egress boundaryData exfiltration / C2
Read the cloud metadata endpointDenyCredential theft via cloud metadata
Reach an internal serviceDenySSRF / internal pivot
Download and run a dependencyAllow via proxy + log / allow-listSupply-chain / code execution
Call the model-provider APIAllow via proxy + log / allow-listBenign / expected
Reach the benchmark / eval rubric hostDeny during evaluationEval contamination

Lesson

Default-deny egress with a logging allow-list proxy for the few legitimate destinations covers most rounds. The drill also includes legitimate traffic so you do not learn to deny everything.

Made-up example data. Your own run uses your inputs. Downloads of the full report need Pro.

TL;DR

What this lab is

5 points
  • A browser-based triage lab: work a stream of outbound requests and runtime behaviours from an AI agent's code executor — fetch a docs page, POST to an unknown domain, read the cloud metadata endpoint (169.254.169.254), reach an internal service, download and run a dependency, phone home to a paste site, call the model-provider API, reach the benchmark/eval rubric host — and contain each one.
  • For every request you pick the EGRESS DECISION (allow / allow via proxy+log / deny), the RISK (benign, data-exfil/C2, SSRF, eval contamination, supply-chain, or credential theft via cloud metadata), and the CONTROL that actually fits.
  • The motivation is real and attributed: Google Cloud AI Research's Harness² (arXiv 2610.14224) reports its executor's network access is UNRESTRICTED and that the Codex executor runs with its SANDBOX DISABLED, and warns to restrict the network before evaluation so agents cannot reach benchmark answers / grading rubrics.
  • The core skill it drills: default-deny egress with a short allow-list, link-local / cloud-metadata and internal ranges always denied, sandbox the executor before running model-generated code, and block eval/rubric hosts during scoring — while NOT over-blocking the model-provider API, docs and a vetted mirror.
  • A live egress log plus a destination × risk map, difficulty tiers, a speed bonus and an S–D grade.

Default-deny is not deny-everything

Most agent-security mistakes sit at one of two extremes. The convenient one is an executor with unrestricted network and the sandbox disabled — which is precisely what Google Cloud AI Research's Harness² (arXiv 2610.14224) reports for its own setup, together with an explicit warning to restrict the network before evaluation so agents cannot reach benchmark answers or grading rubrics. That configuration lets model-generated code read the cloud metadata endpoint for IAM credentials, pivot into internal servicesvia SSRF, exfiltrate context to an attacker host, and quietly inflate its own benchmark score. The other extreme — deny all egress — breaks the agent, because it genuinely needs the model-provider API, documentation and vetted dependencies.

The job is the middle: a default-deny executor with a short, explicit allow-list reached through a logging proxy. The model-provider API, a docs host and a vetted artifact mirror are allowed and audited; everything else — unknown POSTs, paste uploads, arbitrary outbound channels, internal RFC1918 ranges and the link-local metadata service — simply has nowhere to go. Run model-generated code sandboxed, and during scoring block the eval and rubric hosts so the measurement reflects the agent and not retrieved answers. The whole skill of containment is telling the few legitimate destinations apart from the many that should never connect, and spending your allow-list only where the agent truly needs it.

Beyond host names: DNS, raw IPs, the metadata address and operations

Three gaps remain even when the web path is default-deny. DNS: names can carry data inside the query, so executors should resolve only through a resolver you run that answers allow-listed names, with no direct route to other resolvers. Direct IP paths: a rule written as host names does not see a connection to a literal address, so enforce the list at the network layer on the destination reached. The cloud metadata endpoint (169.254.169.254, covered by link-local blocking) stays denied from the executor in every case; the MCP security best-practices page lists cloud metadata endpoints, private ranges and DNS rebinding among the SSRF risks and recommends blocking those ranges and using an egress proxy.

The fourth gap is operations. Allowing GitHub must not mean allowing private repository data to be published to a public pull request. Invariant Labs showed that path as a demonstrated attack against an agent using the GitHub MCP server (a malicious public issue, then private data in a public pull request); it ran on the researchers' own test repositories and no mass breach is reported. Write rules per operation and target, and route writes that cross a visibility boundary to a person. Practise the approval step in the Agent Step-Up Approval Lab, check a whole environment with the Agent Environment Readiness tool, and read the local vs managed AI agents guide.

Sources (accessed 4 Nov 2026): Invariant Labs, GitHub MCP exploited (26 May 2025); MCP security best practices.

Frequently asked questions

What does the Agent Executor Egress-Containment Lab teach?

It teaches how to contain the network and runtime of an AI agent's code-execution environment (the "executor"). For each outbound request or runtime behaviour you decide the egress decision (allow, allow via a logging proxy / allow-list, or deny), name the risk, and choose the control that fits. The lab makes the key distinction explicit: a default-deny egress stance is not the same as denying everything — a few destinations like the model-provider API, documentation and a vetted package mirror are legitimate and should be allowed through a proxy, while unknown POSTs, paste uploads, arbitrary outbound channels, internal services and the cloud-metadata endpoint are denied.

Is the "unrestricted executor" scenario based on something real?

Yes. It is attributed to Google Cloud AI Research's Harness² paper (arXiv 2610.14224), which reports that its executor's network access is unrestricted and that the Codex executor runs with its sandbox disabled, and explicitly warns operators to restrict the executor's network access before evaluation so agents cannot reach benchmark answers or grading rubrics. The lab turns that warning into practice: default-deny egress, sandboxing the executor, and blocking the eval/rubric hosts during scoring so a measurement reflects the agent rather than retrieved answers. The lab invents no CVEs and contains no exploit detail.

Why is the cloud metadata endpoint (169.254.169.254) always a deny?

Because the link-local metadata service hands out temporary cloud IAM credentials to anything on the instance that can reach it. A code-execution environment reaching 169.254.169.254 (or a friendly alias like metadata.google.internal, which resolves to the same link-local address) is credential theft waiting to happen. There is no legitimate reason for the executor to call it, so the control is to hard-deny link-local and metadata ranges at the network boundary and give the workload a minimal, scoped identity instead of node-wide credentials. This is standard SSRF / cloud-metadata defence.

Is this a real proxy or does it touch my network?

No. It is an educational, offline triage exercise with a synthetic set of requests. It does not connect to, proxy, or touch any network, and it contains no exploit detail — only the defender decision of egress call, risk and control. It is meant to build the judgement a platform-security or ML-infrastructure owner uses when deciding what an agent's executor may and may not reach.

How do you stop data leaving through DNS or a raw IP address?

Filtering web requests by host name is not enough. Executors should resolve names only through a resolver you operate, which answers allow-listed names and refuses the rest, and they should be unable to reach other resolvers or DNS-over-HTTPS endpoints directly. The allow-list should also be enforced at the network layer on the destination actually being reached, so a connection to a literal IP address with no host name is refused unless that address was listed on purpose. The cloud metadata address (169.254.169.254) and private ranges stay blocked in every case. These are PlayCISO practice points, and the MCP security best-practices page makes a related recommendation for SSRF: block private and link-local ranges and use an egress proxy.

Is allowing a host such as GitHub enough of a rule?

No. A host-level rule cannot tell reading an issue from publishing private code. Invariant Labs demonstrated an attack path where a malicious public GitHub issue led an agent using the GitHub MCP server to copy data from private repositories into a pull request on a public repository. Invariant describes it as a research demonstration on its own test repositories and reports no real-world exploitation. The control is an operation-level rule: which actions, on which repositories, with writes that cross from private to public sent for human approval.

The tools people use most on PlayCISO.

All tools