Egress filtering: controlling what can leave your network

Most networks filter inbound traffic carefully and let everything out. How default-deny egress, DNS forced through your resolvers, and proxy-only web access cut off command-and-control and data theft, with firewall and cloud examples.

Lesson 14 of 17 · 10 min read · practice only with authorization

Diagram

From allow-all to default-deny outbound

Follow the path. One example at a time.

Step 1 of 4

Inventory

Find what servers actually need to reach.

Illustration: Inventory
$ zeek-cut id.orig_h id.resp_h id.resp_p < conn.log | awk '$1 ~ /^10\.20\./' | sort | uniq -c | sort -rn | head
 8812 10.20.0.11 10.20.0.2 53
 2240 10.20.0.11 52.94.0.10 443

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Servers that browse

    What fails
    Servers rarely need arbitrary internet access.
    Who is affected
    Data on servers if they are compromised.
    What you would notice
    Server outbound traffic to many unknown destinations.
    What you change
    Default-deny for server subnets, with explicit allows.
  2. DNS bypass

    What fails
    Hosts using external resolvers skip your filtering and logs.
    Who is affected
    Visibility and filtering.
    What you would notice
    Port 53 or 853 to outside addresses.
    What you change
    Allow DNS only to internal resolvers.
  3. Cloud egress

    What fails
    Cloud workloads often have open outbound by default.
    Who is affected
    Cloud data.
    What you would notice
    Security groups with 0.0.0.0/0 outbound.
    What you change
    Use NAT with firewall policy or egress proxies for workloads.

Workstations

For user devices, route web traffic through a proxy or secure web gateway that logs and filters by category, and block direct outbound on unusual ports. Users notice nothing, and malware loses easy paths out.

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

A database server tries to reach an unknown IP on port 4444 and is denied. Why is this a strong alert?

Sibling techniques

Pages at the same depth, plus a lab and a glossary card for this one.

  1. MapNetwork protocols for defenders: what each layer tells you in a captureEthernet, IP, TCP, UDP, DNS, TLS, and HTTP as they appear in a packet capture: the fields worth reading at each layer, a worked tcpdump trace of one web request, and which protocols leak what.

Practice

  1. LabControl benchA failure is described. Choose the control that changes the outcome.