AWS Network Firewall Egress Filtering Bypass
AWS Network Firewall's egress filtering relies on the SNI in TLS or the Host header in HTTP to identify allowed domains, without verifying the destination IP via DNS. An attacker who has compromised a host can spoof these values to reach attacker-controlled servers, bypassing the allow list.
hackingthe.cloud
Published on hackingthe.cloud
AWS Network Firewall egress filtering can be easily bypassed by Jianjun Huo
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The firewall trusts the client-supplied SNI or Host header to decide the destination domain and does not verify the actual IP address against DNS.
Impact
An attacker with a compromised host could bypass egress filtering to reach command-and-control or exfiltration servers, though TLS inspection can block the HTTPS variant and does not protect HTTP traffic.
What the attacker needed
Compromised host inside the network; attacker-controlled server with public IP; egress filtering based on domain lists
The fix
AWS recommends enabling TLS inspection on Network Firewall, but this requires installing a custom CA on each host and does not protect HTTP traffic.
How it was found
- Compromise a host inside the network.
- Choose a legitimate domain name that is likely allowed, such as a Windows Update host or an AWS service endpoint.
- Send an HTTP request with a spoofed Host header to the attacker's IP address.
- Send an HTTPS request to the legitimate hostname but resolve it to the attacker's IP address.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Egress filtering is like a security guard at the exit who checks the name on a parcel before letting it leave. AWS Network Firewall only reads the name written on the outside (the domain in the TLS handshake or HTTP Host header) and does not check whether the parcel is actually going to that address. So an attacker can write a trusted name on the parcel and send it to their own server.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.