• Published
  • Reading time13 min
  • Sections11
  • Byheap.page

Make a claim that a test can actually falsify

“The sandbox has no network” is usually too broad. A more useful claim is: this task has no public internet egress, with deliberate ECR, S3 and Logs exceptions in this VPC. That statement identifies what must fail, what must work and where the evidence applies. It also admits that approved logging and service endpoints remain data channels.

Network reachability and data authorization answer different questions. A private endpoint supplies a route to a service; it does not by itself restrict a principal to one bucket or one job. A task can be unable to reach the internet yet still have excessive access to internal services. Review the destination, network path, identity and allowed operation together.

A security group filters stateful IP and port relationships. It is not a hostname policy, an HTTP policy or a complete data-loss control. A regional S3 prefix-list rule reaches regional S3 addresses; an endpoint policy and IAM narrow which operations and objects are usable. Do not read “port 443 only” as “approved data only.”

A failed request has several possible explanations

A negative probe can fail because your boundary works, the destination is down, DNS is broken or the application never started. Use a positive control that should succeed from this task and a negative destination you operate whose health is independently established from a control host. Without both, a timeout is weak evidence.

Separate the layers. DNS resolution does not prove a TCP connection. A TCP connection does not prove TLS identity or an authorized AWS operation. An AccessDenied response may actually demonstrate that a network path works while identity policy rejects the operation. Choose the test from the claim, then record which layer produced the result.

Keep probes narrow: selected destinations, protocols, short timeouts, synthetic data and a fixed attempt budget. Do not let tenants choose arbitrary internal destinations. Use the actual task’s subnet, security groups, image and role rather than testing an operations host and assuming the result transfers to the sandbox.

Interpret the controls together

A blocked negative path is meaningful only when the rest of the test is valid.
ObservationWhat it meansWhat to check
Allowed path works; forbidden path failsSupports the specific tested destination and protocol at that time.Keep independent canary-health evidence and the actual route/SG configuration. Continue with the remaining threat model.
Both paths failThe test environment may simply be broken.Inspect startup, DNS and the allowed endpoint first. Do not report complete isolation.
Forbidden path worksThe claimed boundary is violated, even if IAM rejects a later request.Find NAT, IPv6, proxy, local or attached-network paths. Withhold untrusted work until the intended control is restored.
No application evidenceThe task may have failed before the probe ran.Check stopped reason, exit code and image/log initialization. Missing logs are not a successful negative test.

A probe to EC2 IMDS at 169.254.169.254 does not establish that all link-local services are absent. Fargate runtime metadata and task credentials use different mechanisms. If a task role is attached, assume application code can obtain and exercise that role; do not print credential-endpoint responses as a verification artifact.

Test expected denials with the intended identity and synthetic resources. One allowed object and one forbidden object give stronger evidence about the policy boundary than a single successful upload. Keep rejected attempts distinguishable from timeouts and from a destination that was never healthy.

DNS and allowed services are residual channels

Security groups do not filter AmazonProvidedDNS. If DNS destinations or queries form part of your threat model, design Route 53 Resolver DNS Firewall rules or another deliberate resolver control. A DNS lookup can encode data even when the later TCP connection is blocked. Filtering queries also does not inspect the content of every otherwise allowed TLS session.

CloudWatch Logs is another exit. A compromised parser can put input data into an approved log stream. Limit what the workload receives, bound output and logging, set retention and control log readers. An allowlisted proxy or service can also be abused if it accepts arbitrary destinations or arbitrary object keys.

Review IPv4 and IPv6, VPC-local services, peering, transit gateways, VPNs and proxy configuration. The absence of one default route does not enumerate every possible path. Existing subnet attachments can invalidate an otherwise unchanged task definition.

Keep startup failures separate

CannotPullContainerError points toward image retrieval; ResourceInitializationError can identify logging or another bootstrap dependency. Neither establishes whether running user code can reach an unexpected destination. Restore the exact required path and repeat the positive control, rather than adding unrestricted egress to make the task start.

A network proof has a version and an expiry

Retain a small, redacted evidence bundle: the policy claim, task ARN, image digest, task-definition revision, actual routes and security groups, endpoint and identity policies, control-host health and bounded probe results. Include final STOPPED state and independent cleanup of any temporary endpoint or canary.

Repeat affected checks after changes to routes, DNS, endpoint policy, images, roles or network attachments. A past negative test is not a permanent property of a subnet. Reuse valid evidence for unchanged paths, and focus new tests on the changed boundary.

Network controls reduce reachability. A complete hostile-code design still needs tenant authorization, a task isolation boundary, minimal inputs and credentials, bounded resources and an independent deadline. Issue 001 connects these responsibilities.

Worked example: “no default route” still leaks a canary

Consider a synthetic test environment with no NAT gateway, no public IP and no IPv4 default route. The task can pull an image and write logs using private endpoints. A request to an external HTTPS canary times out, so the first test report says the sandbox cannot exfiltrate data. That conclusion is broader than the observation. The test has checked one public destination and protocol; it has not checked DNS queries, approved service operations or the contents of the log stream.

Use a harmless random marker, never a customer secret, to examine those remaining channels. A DNS query containing the marker can reach a resolver even when the later HTTPS connection cannot be established. Security groups and network ACLs do not filter the Amazon-provided DNS service. If preventing arbitrary DNS queries is a requirement, the resolver policy needs a separate design, such as Route 53 Resolver DNS Firewall with deliberately tested rules. An empty outbound security group is not a complete statement about DNS.

Next, have the synthetic job write the marker to its approved log stream. If an authorized log reader can retrieve it, a data exit exists by design. Calling this a vulnerability in the VPC would misidentify the control owner. The application gave the parser both the marker and a logging channel. The response might be to minimize input, constrain output, redact structured diagnostics in a trusted collector or accept that channel in the threat model. Removing a public route does not solve a permitted output path.

Finally, test one forbidden object operation with the intended task identity. A reachable S3 endpoint plus an overly broad role can expose data without using the public internet. A denied operation is useful authorization evidence; a timeout is reachability evidence. Keep these results separate in the test record. The refined conclusion can now name the denied paths, the deliberate exceptions and the controls responsible for each. It is more useful than an unconditional “no network” badge.

Build a matrix of claims and counterexamples

Start with the protected asset and an attacker capability. If untrusted code can choose arbitrary request bytes, testing only your application’s normal client library misses direct sockets and alternate protocols. If it can choose DNS labels, a hostname allowlist needs query-level review. If it can upload arbitrary output bytes, network filtering cannot determine whether those bytes contain a secret. A threat model should identify which choices remain under the attacker’s control after admission.

For each claim, define a counterexample that would falsify it. “No public IPv4 HTTPS egress” has a different counterexample from “only this job’s S3 prefix is writable.” The first needs a reachable external canary and a successful allowed control. The second needs an authenticated forbidden-object attempt and a known allowed object. Test IPv6 separately when it is enabled. Do not count an IPv4 failure as IPv6 evidence or infer that a task has no IPv6 path merely because the application normally selects an IPv4 address.

A healthy negative destination is essential. Confirm its health from an independent control environment immediately around the probe window and record the evidence without routing sandbox traffic through that environment. When both positive and negative controls fail, classify the run as inconclusive. This prevents an image crash, missing CA certificate or broken resolver from looking like a successful security control. Short fixed deadlines also distinguish a bounded negative test from a job that simply hung until an external operator stopped it.

Keep the probe inventory explicit and finite: destination, protocol, expected layer, timeout, attempt count and synthetic payload. Do not accept arbitrary tenant-supplied internal IP addresses as a diagnostic feature. That would turn the verifier into a network scanner with the verifier’s own privileges. The trusted harness selects the approved probes and records their outcome; the sandbox produces evidence that must still be interpreted against observed task and network configuration.

Keep the verifier’s authority outside generated code

Modal’s sandbox-sidecar article describes a trusted harness boundary for a specific platform. Its useful design principle is to keep credentials and privileged orchestration outside the process that runs generated code. Its product-specific boundary must not be translated into “put a privileged sidecar in the same ECS task.” Containers in one Fargate task share task-level resources and networking. A controller on localhost can become reachable by the very code it is meant to supervise.

A broker API needs authorization for every operation, not just an obscure port or a secret URL in an environment variable. Bind an operation to the authenticated tenant and logical job. Avoid arbitrary destination URLs, object keys, task definitions or AWS role names supplied by the sandbox. Return a narrow result rather than a broad credential. A broker that forwards any requested operation faithfully may preserve container isolation while still giving an attacker the capability to access unrelated customer data.

Modal’s account of the Hugging Face agent incident illustrates the distinction between infrastructure isolation and application-granted power. It is a vendor incident account, not an independent security audit, so use it to examine a failure category rather than establish a universal platform ranking. Ask what the agent was explicitly allowed to do and which outputs or credentials crossed the application boundary. A sandbox cannot retract authority that the trusted application deliberately hands to hostile code.

The same reasoning applies to tools used by coding agents. A tool that can fetch any URL, read any workspace path or commit any output needs its own capability restrictions. Placing the caller inside an isolated runtime does not narrow the tool automatically. Review the trusted side of every bridge: input parsing, authentication, ownership, request limits, response size and error behavior. The boundary can fail through a perfectly valid, authorized API request if the authorization model is too broad.

What a useful security evidence record contains

Record the exact claim, image digest, task-definition revision, subnet, ENI, security groups, relevant route tables and identity policies. Add endpoint policies and DNS rules for the paths being tested. Correlate the actual running task with those resources rather than relying on a template that may not match deployed state. Sensitive values and full customer payloads do not belong in this record; resource identifiers and redacted policy structure are usually sufficient to explain the result.

For every probe, retain the expected layer and observed result: resolution, connection, TLS, service authorization or application acceptance. Preserve response status and a bounded error category without logging credentials. Include independent canary health and positive-control success. A dashboard that reduces all failures to a green “blocked” icon destroys this distinction. Reviewers need to see inconclusive results and unexpected successes as separate outcomes.

Security research on operation forwarding across microVM boundaries reinforces why a small runtime boundary still needs a narrow host interface. The USENIX 2023 study linked below examined a particular older experimental stack on dedicated EC2 hosts. It is not evidence of an exploit against managed Fargate. The transferable lesson is to inspect every forwarded filesystem, device or management operation and its resource limits, not to label all microVM systems vulnerable or assume a VM boundary makes the surrounding API harmless.

Revalidation should follow changed assumptions. A new image can introduce a proxy setting or different resolver behavior. A new route or peering attachment can create reachability without changing the task definition. A role update can widen allowed object operations while the network remains identical. Keep a small map from each assumption to the checks it requires. Reuse valid unchanged evidence, repeat affected checks, and retire a security claim when the environment no longer matches the evidence that supported it.

Independent engineering & research

Original analysis by heap.page, informed by the references below. Historical research and vendor accounts are identified explicitly; current AWS behavior is checked against the service documentation.

AWS documentation & further study

Reviewed November 16, 2026. Service availability and limits can change; check the linked documentation for your Region.

Optional implementation files

Original teaching fixtures, checked locally against the documentation. They have not been deployed as a production baseline. Use a disposable account and review the resources, permissions and cost before running them.

Prepaid · USD

Top up balance

Available balance: $0.00

Your balance works across Heap tools. A failed lookup or generation releases its reserved amount.