π‘οΈFirewall Evasion
Overview
Firewalls and IDS/IPS systems are designed to detect and block malicious traffic. Understanding how to evade these systems is crucial for penetration testing.
Common Evasion Techniques
1. Source Port Manipulation
Why it works:
Many firewalls allow traffic from "trusted" ports (53, 80, 443, 25)
Port 53 (DNS) is often allowed both inbound and outbound
Administrators rarely block DNS traffic
Basic Usage:
# Scan using DNS source port
sudo nmap -g53 --max-retries=1 -Pn -p- --disable-arp-ping <target>
# Alternative syntax
sudo nmap --source-port 53 -p- <target>2. Decoy Scanning
Purpose: Hide your real IP among fake ones
3. Packet Fragmentation
Purpose: Split packets to evade signature-based detection
4. Timing Manipulation
Purpose: Avoid rate-based detection
Lab Example: HTB Academy Hard
Scenario: Target has restrictive firewall that blocks most scans
Solution:
Advanced Evasion Techniques
1. IPv6 Evasion
2. Idle Scan (Zombie Scan)
3. Custom Packet Crafting
Firewall Detection
Identify Firewall Presence
Firewall Fingerprinting
Best Practices
Start with stealth techniques
Combine multiple evasion methods
Monitor for detection
Document successful techniques
Respect scope and permissions
Common Mistakes to Avoid
Using predictable decoy IPs
Ignoring timing considerations
Over-fragmenting packets
Not testing evasion effectiveness
Forgetting to use appropriate source ports
Tools and Resources
Nmap: Primary scanning tool
Netcat: Connection testing
Hping3: Custom packet crafting
Scapy: Python packet manipulation
Firewalk: Firewall analysis
References
HTB Academy: Firewall and IDS/IPS Evasion
Nmap Network Scanning Guide
Penetration Testing Execution Standard (PTES)
Last updated