3924 words
20 min read

DNS Exfiltration From an Air-Gapped VPC: No Route Out Is Not No Way Out

By Docker Captain · CNCF Ambassador · IBM Champion
Blueprint 20 The name boundary: a VPC with no route out is closed once its resolver refuses the names it does not need
Sealed network box, every port capped but one

A VPC with no internet gateway, no NAT gateway and no public address still answered example.com for a pod and for the node it ran on. No route out is not no way out: every VPC carries a resolver that looks up any public name for anything inside it, and whatever a workload writes into that name leaves with the question. That is DNS exfiltration, and the route table never sees it. I proved it on a real AWS account on 21 October 2026, with every address and every public resolver the probes tried already refused, and then proved the fix: a Route 53 Resolver DNS Firewall that answers AWS’s own names and refuses the rest.

The gap survives because of how egress gets reviewed. The review is a list of routes: no internet gateway, no NAT, no peering, security groups tight. A resolver is not a route, so it is not on the list. A repository of mine, an AI agent built to run with no way out of its cluster, had proven its boundary on kind, where every resolver in the path is one the repository can cut off. Taking that boundary to AWS meant showing the DNS check the lookup it exists to refuse, once, before trusting it. It is the discipline of planting the bug a test exists to catch, applied to a network.

What DNS exfiltration through the VPC resolver looks like#

The repository’s eighteenth decision record moves the boundary to AWS in two phases, and the first is the network alone. Two private subnets in two zones. No internet gateway, no NAT gateway, no public address anywhere. ECR, STS, EC2 and EKS answer through interface endpoints inside the VPC, and S3, where ECR keeps its layers, through a gateway endpoint. The public endpoint of the EKS API answers the runner’s single address and nothing else, for the length of a run.

# aws/network.tf in kubernetes-air-gapped-ai-agent at 7edecde, shortened:
# no gateway, no NAT, a route table with no routes, AWS through endpoints
# A VPC with no way out (ADR 18). No internet gateway and no NAT gateway are
# declared anywhere in this directory, and static check "aws" fails if one
# is. Each private subnet's route table holds the VPC's own range, which AWS
# adds itself, and the S3 gateway endpoint's prefix list. Nothing else.
# ...
locals {
azs = slice(data.aws_availability_zones.available.names, 0, 2)
subnets = [for i, _ in local.azs : cidrsubnet(var.vpc_cidr, 4, i)]
# What the nodes and pods reach in AWS, each through an interface endpoint
# in the VPC: the image registry (its API and its Docker endpoint), STS,
# EC2 for the node's own bootstrap, and EKS.
interface_endpoints = ["ecr.api", "ecr.dkr", "sts", "ec2", "eks"]
}
# ...
resource "aws_route_table" "private" {
count = length(local.azs)
vpc_id = aws_vpc.this.id
tags = { Name = "${var.cluster_name}-private-${local.azs[count.index]}" }
}
# ...
resource "aws_vpc_endpoint" "interface" {
for_each = toset(local.interface_endpoints)
vpc_id = aws_vpc.this.id
service_name = "com.amazonaws.${var.region}.${each.value}"
vpc_endpoint_type = "Interface"
subnet_ids = aws_subnet.private[*].id
security_group_ids = [aws_security_group.endpoints.id]
private_dns_enabled = true
tags = { Name = "${var.cluster_name}-${each.value}" }
}

A static check fails if a gateway, a NAT or a route ever appears in that directory. The route tables hold the VPC’s own range and the S3 prefix list, and nothing else. By the usual definition, nothing here can leave.

Then two probes try. One is an ordinary pod. The other runs on the node’s own network and asks the resolver the way the node does, with no cluster DNS in between. Every refusal sits beside a control from the same pod, because a pod on a dead network refuses everything and proves nothing:

Terminal window
# tests/e2e/aws.sh in kubernetes-air-gapped-ai-agent at 7edecde, shortened:
# the lookups and the connections each probe tries
inpod() { local pod="$1"; shift; kubectl -n probe exec "$pod" -- sh -c "$*" 2>&1; }
resolves() { inpod "$1" "nslookup $2 ${3:-}" >/dev/null; }
opens() { inpod "$1" "nc -w 5 $2 $3 </dev/null" >/dev/null; }
# ... for the pod, then the pod on the node's network: the controls first
if resolves "$pod" example.com; then fail "$where resolved example.com: a lookup leaves the VPC, with whatever a workload puts in the name"
else pass "$where cannot resolve example.com (the resolver refuses names outside AWS)"; fi
if resolves "$pod" example.com 8.8.8.8; then fail "$where reached a public resolver, 8.8.8.8, directly"
else pass "$where cannot ask a public resolver directly (8.8.8.8)"; fi
# ... the control: ECR on 443, through its endpoint
for target in 1.1.1.1:443 8.8.8.8:53 151.101.0.81:443; do
if opens "$pod" "${target%:*}" "${target#*:}"; then fail "$where opened TCP to $target on the internet"
else pass "$where opens no TCP to $target"; fi
done

The first run to reach these checks left the firewall’s association off on purpose. This is what the probes printed:

# The boundary on AWS, run 39632816543, the firewall left off:
# what the probes printed, verbatim, lines that name a host left out
== a pod: names
PASS control: a pod resolves the cluster's own services
# ... the control that resolves ECR's API name to an address inside the VPC
FAIL a pod resolved example.com: a lookup leaves the VPC, with whatever a workload puts in the name
PASS a pod cannot ask a public resolver directly (8.8.8.8)
== a pod: addresses
PASS control: a pod opens TCP to ECR on 443, through its endpoint
PASS a pod opens no TCP to 1.1.1.1:443
PASS a pod opens no TCP to 8.8.8.8:53
PASS a pod opens no TCP to 151.101.0.81:443
== the node: names
# ... the same control, from the node
FAIL the node resolved example.com: a lookup leaves the VPC, with whatever a workload puts in the name
PASS the node cannot ask a public resolver directly (8.8.8.8)
# ... the node's addresses: the control on 443, and no TCP to any of the three

Two lines failed, and they say the same thing: the pod and the node each resolved example.com. Everything else held. Neither probe could open TCP to Cloudflare’s resolver on 443, to Google’s on 53 or to a Fastly address on 443, and neither could put a question to Google’s resolver directly. Every control answered: the probe’s image came from the run’s own ECR, ECR’s API name resolved to an address inside the VPC, and the endpoint opened on 443. The network was alive, closed to every address tried, and open to every name.

The route table was right. The boundary was not.

The two runs differed by one count, on one resource:

# aws/dns.tf in kubernetes-air-gapped-ai-agent at 7edecde, shortened:
# the one resource the two runs differ by
# Associated only when dns_firewall is true: the one run that shows the DNS
# check its violation leaves it off (ADR 18).
resource "aws_route53_resolver_firewall_rule_group_association" "this" {
count = var.dns_firewall ? 1 : 0
name = var.cluster_name
firewall_rule_group_id = aws_route53_resolver_firewall_rule_group.this.id
vpc_id = aws_vpc.this.id
priority = 101
}

With the association on, the next run passed all sixteen checks. The pod and the node were each refused example.com, and every control still answered:

# The boundary on AWS, run 39636241165, the firewall on:
# the two lines that had failed, verbatim
PASS a pod cannot resolve example.com (the resolver refuses names outside AWS)
# ...
PASS the node cannot resolve example.com (the resolver refuses names outside AWS)

It was destroyed afterwards with nothing left by tag or name, twenty-two minutes and about eleven cents after it started. In the production environment I run, every egress review I have sat through counted routes, gateways and security groups. None of them asked what the resolver would answer for a name nobody had approved.

Why this keeps happening#

The resolver is not a route, and a review built on routes misses it. AWS now calls it the Route 53 VPC Resolver. It is on by default in every VPC, at the base of the VPC’s range plus two, and for public names it performs recursive lookups against public name servers on the internet. The packet that reaches the internet is AWS’s, sent on the workload’s behalf. No route table of yours is in its path.

The controls a team reaches for first cannot see it either. AWS’s own guide says network ACLs and security groups cannot filter traffic to or from the resolver. VPC Flow Logs list traffic to it among what they never record. AWS Network Firewall, according to the DNS Firewall guide, has no visibility into the resolver’s queries at all. A Kubernetes NetworkPolicy sees an address and a port, and every name in the cluster goes to the same address on the same port. Each of these works on packets. This traffic never passes them as a packet of yours.

None of it is obscure. MITRE ATT&CK lists DNS as a channel for command and control and as a protocol for exfiltration. AWS’s DNS Firewall page names DNS exfiltration as a primary use of the product, and describes it plainly: a compromised instance uses lookups to send data to a domain its operator controls. Amazon GuardDuty has a finding type for it. A finding reports the pattern after the lookups have left; it does not refuse one. And the firewall does nothing until someone associates a rule group with the VPC, which no VPC has by default. The open resolver is the default, and a default nobody costs is a default everybody ships.

The last reason is the platform change itself. On kind, the repository’s first decision record closes this door in three places: the node’s resolver, the path to Docker’s embedded resolver, and the block in CoreDNS that forwards outside names. None of the three exists on EKS. There CoreDNS hands every outside name to the VPC’s resolver, which is how the pod’s lookup got out, and the node does not ask CoreDNS at all. A boundary proven on one platform is a claim about that platform.

Risk and blast radius#

A lookup carries little, and little is enough. A DNS name holds labels of up to sixty-three octets and two hundred and fifty-five octets in all, the limits RFC 1035 set in 1987, and nothing limits how many names a workload asks for. An API key, a short-lived token, a customer’s record: each fits in a handful of lookups. Each one reaches the authoritative servers of a domain that anyone can register and anyone can run, and the answers can carry instructions back. That turns a leak into a channel.

The evidence is the larger exposure. Flow logs record nothing of it, and CloudTrail records calls to AWS’s APIs, not lookups. Without Resolver query logging, which Route 53 itself does not charge for, the VPC keeps no record that a question was ever asked. The repository’s own Terraform does not turn it on yet. A responder who opens the usual artifacts finds a clean network.

For this repository the stake is its whole claim. Its second phase puts the agent on this network: the signed models, the gateway, and the tool server that reads customer records. On kind, a daily suite shows that nothing leaves the company. On AWS without the firewall, any workload made to run code of someone else’s choosing could have sent those records out one name at a time, past a route table with nothing in it.

A diagram that says isolated is a claim. With the resolver open, the network does not keep it.

What closes the resolver’s way out, and what does not#

Most of the obvious options close the wrong door. Costs are list prices in US East, Northern Virginia, for two zones and a month of 730 hours.

OptionCloses the lookupKeeps the endpoints’ private namesCost a monthFit
No internet gateway and no NAT, nothing moreNo: a pod and the node resolved example.comYesNothing beyond the endpointsThe starting point, not a boundary
Security groups and network ACLsNo: they cannot filter traffic to the resolverYesNothingThe wrong layer
AWS Network FirewallNo: it has no visibility into the resolver’s queriesYesAbout $577 for two endpoints at $0.395 an hour, before dataTraffic that has a route; here nothing has one
DNS support turned off in the VPCYesNo: private DNS for interface endpoints needs it onNothingBreaks the endpoints the cluster needs
DNS Firewall: AWS’s names allowed, the rest NXDOMAIN, fail closedYes: all sixteen checks passedYesUnder a cent for seven names, plus $0.60 a million queriesThis design

One row closes the door and keeps the cluster working.

Framework: no route out, and no name out#

Three layers, a week each, each with an owner. Find the way out before closing it, and show the check its violation before trusting it.

Layer 1: find the resolver’s way out (week 1)#

Ask the resolver for a public name from inside the cluster, then list what stands between that question and the internet. An answer from the probe, with no rule group associated, is the way out, open. Check the query log association in the same pass, because it is the only record the VPC can keep.

Terminal window
# kubectl and the AWS CLI, for one cluster's VPC:
# does its resolver answer a public name, and what stands in the way
VPC=vpc-0123456789abcdef0 # the cluster's VPC
IMAGE=registry.example.internal/busybox # any image with nslookup that the nodes can pull
kubectl run dns-probe --rm -i --restart=Never --image="$IMAGE" -- nslookup example.com # an answer is the way out, open
aws route53resolver list-firewall-rule-group-associations --vpc-id "$VPC" \
--query 'FirewallRuleGroupAssociations[].[Name,Status,Priority]' --output table # empty: nothing filters names
aws route53resolver list-firewall-configs \
--query "FirewallConfigs[?ResourceId=='$VPC'].FirewallFailOpen" --output text # ENABLED: a lookup passes when the firewall cannot decide
aws route53resolver list-resolver-query-log-config-associations \
--filters "Name=ResourceId,Values=$VPC" \
--query 'ResolverQueryLogConfigAssociations[].Status' --output text # empty: no record of what was asked

Owner: the platform engineer who owns the VPC.

Layer 2: allow AWS’s names, refuse the rest, fail closed (week 2)#

Two domain lists, two rules and one setting. The allow list holds AWS’s service domain and the VPC’s internal zones. Every other name matches a list that holds a single wildcard, and gets NXDOMAIN, the answer that says a name does not exist, which clients stop retrying. With fail-open off, a firewall that cannot decide refuses too. That is already AWS’s default, answered with SERVFAIL, and writing it down turns any change to it into a diff that someone reviews.

# aws/dns.tf in kubernetes-air-gapped-ai-agent at 7edecde, shortened:
# the allow list, the refusal, and fail-open off
# NO NAME LOOKUP OUT (ADR 18). A VPC's resolver answers any name on the
# internet whatever the routes say, and a query carries whatever a workload
# puts in the name to whoever answers for it. With no route out, DNS is the
# way out left. This rule group answers the region's AWS service names and
# the VPC's own internal names, which AWS's servers answer, and refuses
# everything else with NXDOMAIN; fail-open is off, so a firewall that cannot
# decide refuses too.
resource "aws_route53_resolver_firewall_domain_list" "aws" {
name = "${var.cluster_name}-aws"
domains = [
"amazonaws.com",
"*.amazonaws.com",
"ec2.internal",
"*.ec2.internal",
"compute.internal",
"*.compute.internal",
]
}
resource "aws_route53_resolver_firewall_domain_list" "everything" {
name = "${var.cluster_name}-everything"
domains = ["*"]
}
resource "aws_route53_resolver_firewall_rule_group" "this" {
name = var.cluster_name
}
resource "aws_route53_resolver_firewall_rule" "allow_aws" {
name = "allow-aws"
action = "ALLOW"
firewall_domain_list_id = aws_route53_resolver_firewall_domain_list.aws.id
firewall_rule_group_id = aws_route53_resolver_firewall_rule_group.this.id
priority = 100
}
resource "aws_route53_resolver_firewall_rule" "block_everything_else" {
name = "block-everything-else"
action = "BLOCK"
block_response = "NXDOMAIN"
firewall_domain_list_id = aws_route53_resolver_firewall_domain_list.everything.id
firewall_rule_group_id = aws_route53_resolver_firewall_rule_group.this.id
priority = 200
}
# ... the association, shown above
resource "aws_route53_resolver_firewall_config" "this" {
resource_id = aws_vpc.this.id
firewall_fail_open = "DISABLED"
}

Owner: the engineer who owns the VPC’s Terraform, with security approving every name added to the allow list.

Layer 3: show the check its violation, then keep it running (week 3 onward)#

A DNS check that has only ever passed is a health check that cannot fail under another name. The repository holds the firewall’s shape on every plan, against a mocked provider, with no account and no cost:

# aws/tests/aws.tftest.hcl in kubernetes-air-gapped-ai-agent at 7edecde,
# shortened: the firewall's shape, asserted on every plan
# What the boundary on AWS promises (ADR 18), checked on a plan against a
# mocked AWS provider: no account, no credentials, no cost. Run by static
# check "aws"; what no plan can show (an internet gateway, a NAT gateway or a
# route declared anywhere: a route table's routes are only known after apply)
# the same check reads from the files, and tests/e2e/aws.sh tries on AWS.
# ... the mocked provider and the run's variables
run "no_name_lookup_out" {
command = plan
assert {
condition = aws_route53_resolver_firewall_rule.block_everything_else.action == "BLOCK" && aws_route53_resolver_firewall_rule.block_everything_else.block_response == "NXDOMAIN"
error_message = "every name outside the allow list is refused, NXDOMAIN"
}
assert {
condition = toset(aws_route53_resolver_firewall_domain_list.everything.domains) == toset(["*"])
error_message = "the refusal covers every name"
}
assert {
condition = aws_route53_resolver_firewall_rule.allow_aws.priority < aws_route53_resolver_firewall_rule.block_everything_else.priority
error_message = "the AWS names are allowed before everything else is refused"
}
assert {
condition = alltrue([for d in aws_route53_resolver_firewall_domain_list.aws.domains : endswith(d, "amazonaws.com") || endswith(d, ".internal")])
error_message = "the allow list holds AWS's names and the VPC's internal ones, nothing on the open internet"
}
assert {
condition = length(aws_route53_resolver_firewall_rule_group_association.this) == 1
error_message = "the rule group is on the VPC by default"
}
assert {
condition = aws_route53_resolver_firewall_config.this.firewall_fail_open == "DISABLED"
error_message = "a firewall that cannot decide refuses: fail-open is off"
}
}
# The one run that shows the DNS check its violation.
run "dns_firewall_off_is_the_violation" {
command = plan
variables {
dns_firewall = false
}
assert {
condition = length(aws_route53_resolver_firewall_rule_group_association.this) == 0
error_message = "with dns_firewall off, the rule group is not on the VPC"
}
}

Then it plants the ways to undo it, and the static check must fail on each one: fail-open turned on, a public zone slipped into the allow list, and the association never made.

# tests/static/plants.tsv in kubernetes-air-gapped-ai-agent at 7edecde,
# shortened: three of the six plants for check aws
# file old new check that must fail what it plants (each field JSON-encoded)
# ...
"aws/dns.tf" "firewall_fail_open = \"DISABLED\"" "firewall_fail_open = \"ENABLED\"" "aws" "a DNS firewall that answers when it cannot decide"
"aws/dns.tf" " \"*.compute.internal\",\n" " \"*.compute.internal\",\n \"*.com\",\n" "aws" "a DNS allow list with a public zone in it"
# ...
"aws/dns.tf" "count = var.dns_firewall ? 1 : 0" "count = 0" "aws" "a DNS firewall never put on the VPC"

The live run keeps the violation one input away, so the proof can be repeated whenever someone doubts it:

# .github/workflows/aws.yml in kubernetes-air-gapped-ai-agent at 7edecde,
# shortened: a Thursday schedule, and the violation one input away
on:
schedule:
# Thursday: the day after aws-eks-reference-platform's run, so the two
# never share the account at once.
- cron: "47 2 * * 4"
workflow_dispatch:
inputs:
confirm:
description: "Type SPEND to create billed AWS resources (about $0.30 to $0.50 a run)"
required: true
type: string
dns_firewall:
description: "false only to show the DNS check its violation (ADR 18)"
required: false
type: choice
options: ["true", "false"]
default: "true"

The workflow carries a Thursday schedule. Its first scheduled run passed on 22 October 2026 with the whole agent on the boundary, 56 of 56 checks (the run), and the repository says weekly from that run, not from the runs by hand the day before. Of the six scheduled runs through 26 November 2026, four passed. One failed before it created anything on AWS, and one failed at a GPU step after the boundary’s checks had passed.

Owner: the platform team that owns the boundary, with the security engineer who signs it off running the violation by hand after any change to the allow list.

Tradeoffs#

The allow list turns every outside name into a decision. A SaaS endpoint, a licence server, a package mirror: each is a line someone adds and someone approves, and a workload that needs an unlisted name fails until they do. That friction is the control.

AWS’s service domain is allowed whole, so a workload can resolve any AWS endpoint name. The decision record’s argument is that resolving a name gives no route to anything without an endpoint, and that those zones are answered by AWS’s own servers, which no outside party reads. That is an assumption about AWS’s zones, written down in the record. It is the one I would test next.

The endpoints are the next way out, and this post does not close it. The S3 gateway endpoint and the interface endpoints carry AWS’s default endpoint policy, which grants full access. A workload holding a credential for another account could send data to that account’s bucket or registry through them. An endpoint policy that names this account’s resources closes that. The repository’s twenty-second decision record lists the S3 gateway endpoint as open, and I have not tested any of this here.

Fail closed moves the failure. If DNS Firewall is impaired, the resolver answers SERVFAIL and the cluster loses its names. That is an outage and not a hole, which is the right way round for a boundary.

The firewall is close to free at this size. Seven stored names at a twentieth of a cent each come to well under a cent a month. Queries cost sixty cents a million: a cluster that sends the resolver ten queries a second, around the clock, sends about twenty-six million a month, for about sixteen dollars. The endpoints are the larger bill. Five interface endpoints in two zones cost ten cents an hour in the run’s own table, about seventy-three dollars a month, and that is the price of reaching AWS without a NAT. These numbers are the state the runs measured, at commit 7edecde; since then main has a sixth interface endpoint, for the EKS authentication service, about eighty-eight dollars a month, and a seventh allowed name, under api.aws. AWS Network Firewall’s endpoints in two zones would cost about five hundred and seventy-seven dollars a month before data, and would still not see a lookup.

The proof itself was cheap, and not right the first time. The first attempt never reached the checks. The network plugin was installed after the node, so the node never became Ready and EKS gave up on it as unhealthy, for about twenty-six cents. The fix put the network plugin and kube-proxy before the node and CoreDNS after it. The two runs that followed cost about eleven cents each by their own tables, which leave out the firewall’s fee per query; it would take about seventeen thousand queries in twenty-two minutes to add a cent. The whole proof, failure included, came to under fifty cents.

The closing argument#

A VPC with no internet gateway and no NAT has no route out. It still has a way out, because every VPC ships with a resolver that will ask the internet anything on a workload’s behalf, and no route table, security group or flow log stands in its path. Closing it takes one rule group, one fail-closed setting and a check that has seen the lookup it refuses.

No route out is not no way out. The resolver is a way out too.

Sources#

Discussion#

If you have closed the resolver’s way out another way, or found a name your allow list could not live without, drop a comment below. Counterarguments are welcome and the comment thread is where I respond first.


Vladimir Mikhalev

Docker CaptainCNCF AmbassadorIBM Champion

The Verdict — production-tested analysis on YouTube.

The Verdict

Inconvenient truths about shipping in the AI era

Container security, platform engineering, and the agentic shift — tested in production, argued without the hype. The verdict reaches your inbox the moment there's one worth sending.

Related Posts

Same category
  1. 1
    Scheduled Workflows Fail Silently: A GitHub Actions Heartbeat for 122 Repositories
    DevOps & Cloud · GitHub Actions switches off a scheduled workflow after 60 quiet days, with no failed run and no red badge. What watches every schedule, and the watcher.
  2. 2
    Completed Is Not Restored: Kyverno Fail-Open, a Velero Restore and an HTTP 200 That Meant 500
    DevOps & Cloud · Scale Kyverno to zero and its webhooks vanish. A Velero restore said Completed over an empty disk. A 200 carried a 500. Three statuses that reported success.
  3. 3
    Docker Hub Immutable Tags: The Image That Shipped Before It Was Signed
    DevOps & Cloud · Docker Hub immutable tags refused a per-commit tag after the version tags were already out. The image shipped, the run died, and nothing ever signed it.
  4. 4
    Docker Hardened Images Migration: A Healthy Database That Kept Nothing
    DevOps & Cloud · Moving a Compose stack to Docker Hardened Images changes user IDs, paths and tools. On the old mount path, PostgreSQL stayed healthy and kept nothing.

Random Posts

Random
  1. 1
    Install Nextcloud with OnlyOffice Using Docker Compose
    Self-Hosting · Step-by-step guide to installing Nextcloud with OnlyOffice using Docker Compose. Includes Traefik, Let's Encrypt, secure document editing, and cloud storage.
  2. 2
    Docker Desktop's Performance Odyssey Over a Year of Innovations
    Opinion & Culture · Docker Desktop's 2023 performance work, read against Docker's and Ajeet Raina's published numbers with attribution, plus my own October 2026 rerun on an M4 Pro.
  3. 3
    Install Windows 10
    SysAdmin & IT Pro · Complete guide to installing Windows 10 safely. Step-by-step instructions with screenshots, license key setup, offline account creation, and post-install tips.
  4. 4
    Install ServiceDesk Plus on Ubuntu Server
    SysAdmin & IT Pro · Comprehensive guide to installing ServiceDesk Plus on Ubuntu Server 22.04 LTS. Covers setup, port config, auto-start service, and admin login.
DNS Exfiltration From an Air-Gapped VPC: No Route Out Is Not No Way Out
https://heyvaldemar.com/dns-exfiltration-air-gapped-vpc/
Author
Vladimir Mikhalev
Published
2026-12-03
License
CC BY-NC-SA 4.0