Agent Wranglers

INF-32Recommended

Limit where servers can send traffic

Let servers send traffic only to the hosts they need. Databases send none to the internet at all.

How to do it

An attacker inside a server sends stolen data out, or downloads tools. Route outbound traffic through a firewall or proxy with an allow list of host names. A cloud network firewall or a proxy such as Squid will do. Reach cloud services through private endpoints, so that traffic never leaves the network. Turn on network flow logs, such as VPC flow logs, and alert on spikes of refused attempts. It is the network layer of Fetch only allowed addresses.

Examples

Shell example

curl -sS -m 5 -o /dev/null -w '%{http_code}\n' https://api.payments.example.com/health   # 200
curl -sS -m 5 https://example.org && echo "FAIL: egress open"                            # times out

How to check

From an app server, a request to a host on the list succeeds and a request to https://example.org fails. A database server cannot reach any outside address.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/infrastructure/networking-and-dns/egress-control">Agent Wranglers infrastructure and environments playbook</a>. In code you write, add a comment next to it with the same link.