Module 4 of 6 β€’ Defense-in-Depth & Cloud Firewalls

Security Groups vs. Network ACLs: Making Connections Secure

Every packet inside an AWS VPC passes through two different security checkpoints: the Network ACL (Stateless Subnet Guard) and the Security Group (Stateful ENI Bodyguard). Flip the firewall rules on the right and run the 3 packet tests below to see how they work together!

πŸ›‘οΈ
Stateless vs. Stateful in Plain English: A Network ACL (NACL) is like a border guard with amnesia at the neighborhood gateβ€”even if he lets you in, he checks his rulebook from scratch when you try to walk back out! A Security Group (SG) is like a personal VIP bodyguard standing right at the server's door (ENI)β€”once he checks your ID and lets you in, he remembers your face and automatically lets your reply back out.
Next: Module 5 (Cross-Account & Orgs) β†’ ← Prev: Module 3 (VPC Endpoints)
Interactive 2-Layer Firewall & SG-Chaining Simulator
🌍 EXTERNAL USERS πŸ§‘πŸ»β€πŸ’» Valid Customer 198.51.100.42 Src Port: 51234 Dst Port: 443 πŸ•΅οΈ Malicious Bot 203.0.113.66 Tries port 443 & direct port 8080 / 5432 attacks 🏒 VPC (10.0.0.0/16) β€” Defense-in-Depth Architecture 🚧 CHECKPOINT 1: NACL Subnet Border β€’ STATELESS πŸ“₯ NACL Inbound Rules #50 DENY 203.0.113.66/32 #100 ALLOW TCP 443 #110 ALLOW 1024-65535 #* DENY ALL Evaluated in # order! πŸ“€ NACL Outbound Rules #100 ALLOW TCP 443 #110 ALLOW 1024-65535 #* DENY ALL βœ“ Allows reply back to client ephemeral port 51234 πŸ›‘οΈ SG-ALB (Stateful ENI Firewall) βš–οΈ Tier 1: Public Load Balancer (ALB) Inbound Rule: ALLOW TCP 443 from 0.0.0.0/0 Stateful Tracker: Automatically permits return reply to client port 51234! ⬇ SG Chaining: App trusts SG-ALB badge ⬇ πŸ›‘οΈ SG-App (Attached to App ENI) πŸ–₯️ Tier 2: Private App EC2 Fleet (Port 8080) Inbound: ALLOW TCP 8080 ONLY from Source = sg-alb πŸ”’ Even if an attacker knows the App IP, they don't wear the sg-alb badge! ⬇ SG Chaining: DB trusts SG-App badge ⬇ πŸ›‘οΈ SG-DB (Attached to RDS ENI) πŸ—„οΈ Tier 3: Private RDS PostgreSQL (Port 5432) Inbound: ALLOW TCP 5432 ONLY from Source = sg-app πŸ”’ Only instances attached to sg-app can open port 5432
NACL = Subnet level, Stateless, Allow & Deny rules Security Group = ENI level, Stateful, Allow rules + SG Chaining