Firewalls & Network Defense
To bypass defenses, you must first understand how they work. This module covers the core network security controls you'll encounter during assessments.
Know Your Enemy
Firewall Types
Packet Filtering (L3/L4)
Examines packet headers only. Fast but limited visibility. Makes decisions based on source/dest IP, ports, and protocol.
Stateful Inspection (L3/L4)
Tracks connection state (SYN, ACK, etc.). Blocks packets that don't belong to established sessions.
Application Layer (L7 / WAF)
Deep packet inspection. Examines HTTP payloads, SQL queries, etc. Can block specific attack patterns.
Next-Gen Firewall (NGFW)
Combines stateful inspection, DPI, IPS, SSL inspection, and application awareness. Palo Alto, Fortinet, Cisco.
IDS vs IPS
| Feature | IDS (Detection) | IPS (Prevention) |
|---|---|---|
| Mode | Passive (monitoring) | Inline (blocking) |
| Action | Alerts only | Blocks + Alerts |
| Latency | None | Adds latency |
| Risk | Missed attacks | False positives block legit traffic |
| Examples | Snort, Suricata, Zeek | Snort (inline), Suricata, Palo Alto |
Evasion Techniques
Network Segmentation
Segmentation limits lateral movement. Understanding how networks are divided helps identify pivot points.
VLANs
Layer 2 logical separation. Can be bypassed via VLAN hopping (double tagging, switch spoofing).
Subnets + ACLs
Layer 3 separation with router ACLs controlling traffic. Look for overly permissive rules.
Micro-segmentation
Host-level firewalls, zero trust. Every workload isolated. Harder to move laterally.
Zero Trust Architecture
"Never trust, always verify." Zero Trust assumes the network is compromised and requires continuous authentication.
Zero Trust Principles
- ✓ Verify explicitly: Always authenticate and authorize based on all data points
- ✓ Least privilege: Limit access with just-in-time and just-enough access (JIT/JEA)
- ✓ Assume breach: Minimize blast radius, segment access, verify end-to-end encryption
Pentest Implication
Firewall Enumeration Commands
Detect Firewall with Nmap
# ACK scan to detect filtered ports (firewall present)
nmap -sA -p 1-1000 <target>
# Compare with SYN scan
nmap -sS -p 1-1000 <target>
# Firewall version detection
nmap --script=firewalk <target># ACK scan to detect filtered ports (firewall present)
nmap -sA -p 1-1000 <target>
# Compare with SYN scan
nmap -sS -p 1-1000 <target>
# Firewall version detection
nmap --script=firewalk <target>WAF Detection
# wafw00f - WAF fingerprinting
wafw00f https://target.com
# Nmap WAF detection
nmap --script=http-waf-detect <target>
# Manual test - send malicious payload
curl "https://target.com/?id=1' OR 1=1--" -v# wafw00f - WAF fingerprinting
wafw00f https://target.com
# Nmap WAF detection
nmap --script=http-waf-detect <target>
# Manual test - send malicious payload
curl "https://target.com/?id=1' OR 1=1--" -v