Hacktricks-skills macos-firewall-bypass-audit
Audit and test macOS firewall configurations for potential bypass vulnerabilities. Use this skill whenever you need to assess macOS firewall security, check for known bypass techniques, enumerate allowed traffic, inspect PF rules, or validate Network Extension filter configurations. This skill helps security professionals identify weaknesses in firewall rules, test for CVE-2024-44206 and other recent vulnerabilities, and harden macOS systems against firewall evasion attacks.
git clone https://github.com/abelrguezr/hacktricks-skills
skills/macos-hardening/macos-security-and-privilege-escalation/macos-bypassing-firewalls/SKILL.MDmacOS Firewall Bypass Audit
A skill for security professionals to audit macOS firewall configurations and identify potential bypass vulnerabilities. This skill covers defensive testing of firewall rules, Network Extension filters, and known CVEs.
When to Use This Skill
Use this skill when you need to:
- Audit macOS firewall configurations for security assessments
- Test for known firewall bypass vulnerabilities (CVE-2024-44206, PF rule-ordering bugs, etc.)
- Enumerate allowed network traffic and identify whitelisted applications
- Inspect Packet Filter (PF) rules generated by GUI firewalls
- Check for Network Extension filter stability issues
- Validate that firewall rules are actually blocking intended traffic
- Research firewall bypass techniques for defensive hardening
Quick Start
# Check currently established connections lsof -i TCP -sTCP:ESTABLISHED # Inspect PF rules from GUI firewalls sudo pfctl -a com.apple/250.ApplicationFirewall -sr # Check for quick keyword rules (potential leak) pfctl -sr | grep quick
Audit Categories
1. Whitelist Abuse Detection
Firewalls often whitelist well-known macOS processes. Check if suspicious processes are masquerading as legitimate ones.
What to look for:
- Processes named
,launchd
, or other Apple-signed binariesmdnsreponder - Unexpected network activity from whitelisted processes
- Binary paths that don't match expected system locations
Audit command:
# List all processes with network connections lsof -i -n | grep -E "(launchd|mdnsreponder|nsurlsessiond)"
2. DNS Resolution Analysis
DNS queries go through
mdnsreponder, which is Apple-signed and typically allowed through firewalls.
Audit approach:
- Monitor DNS traffic patterns
- Check for unusual DNS query volumes
- Verify DNS responses match expected domains
3. Browser-Based Traffic Inspection
Browsers can be used to exfiltrate data even when other applications are blocked.
Test browser exfiltration paths:
| Browser | Command |
|---|---|
| Safari | |
| Chrome | |
| Firefox | |
Audit tip: Check if browser processes have outgoing network entitlements:
codesign -d --entitlements :- /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome 2>/dev/null | grep network
4. CVE-2024-44206 Testing (Web Content Filter Bypass)
Vulnerability: Safari/WebKit double URL-encoding bypass in Screen Time filters (patched July 2024).
Test procedure:
# Test if Screen Time filter is vulnerable open "http://test%2Eexample.com%2F./"
Expected behavior:
- Patched system: Request blocked by Screen Time
- Vulnerable system: Safari loads the page despite filter
Remediation: Update to macOS version with July 2024 security patches.
5. PF Rule-Ordering Bug Check (macOS 14 Sonoma)
Vulnerability: Rules with
quick keyword silently ignored in early macOS 14 beta (fixed in RC 2, build 23A344).
Test procedure:
# Check for quick rules pfctl -sr | grep quick # Verify traffic is actually blocked sudo tcpdump -n -i en0 not port 53
Expected behavior:
- If
rules exist but traffic still flows, the bug may be presentquick - Verify macOS build number:
sw_vers -buildVersion
6. QUIC/ECH Evasion Testing (macOS 12+)
Vulnerability: HTTP/3 over QUIC with Encrypted Client Hello can bypass domain filters.
Test procedure:
# Test Chrome with QUIC/ECH /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ --enable-quic \ --origin-to-force-quic-on=test-domain.com:443 \ --enable-features=EncryptedClientHello \ --user-data-dir=/tmp/h3test \ https://test-domain.com # Test with curl (8.10+) curl --http3-only https://test-domain.com
Expected behavior:
- If domain is blocked but request succeeds, filter cannot parse QUIC/ECH
- Check firewall logs for UDP/443 traffic
7. Network Extension Filter Stability (macOS 15 Sequoia)
Vulnerability: Early 15.0/15.1 builds crash third-party Network Extension filters.
Test procedure:
# Monitor Network Extension logs log stream --predicate 'subsystem == "com.apple.networkextension"' --style syslog # Generate UDP flow stress (run in separate terminal) python3 - <<'PY' import socket for i in range(5000): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.sendto(b'X'*32, ('1.1.1.1', 53)) PY
Expected behavior:
- Watch for filter crash/restart cycles
- Check if firewall GUI still shows "active" while rules are dropped
8. Entitlement Enumeration
Find binaries with outgoing network entitlements that could be abused.
Audit command:
# Check specific binary codesign -d --entitlements :- /path/to/bin 2>/dev/null | \ plutil -extract com.apple.security.network.client xml1 -o - - # Scan common locations for bin in /System/Applications/App\ Store.app/Contents/MacOS/App\ Store \ /System/Library/CoreServices/Menu\ Extras/User.menu/Contents/MacOS/User; do echo "=== $bin ===" codesign -d --entitlements :- "$bin" 2>/dev/null | grep -A2 network.client done
Audit Workflow
Step 1: Baseline Assessment
- Document current firewall configuration
- List all allowed applications
- Capture baseline network traffic
- Note macOS version and build number
Step 2: Vulnerability Testing
- Test for CVE-2024-44206 (if applicable)
- Check PF rule ordering (macOS 14)
- Test QUIC/ECH bypass (macOS 12+)
- Stress test Network Extension filters (macOS 15)
Step 3: Whitelist Analysis
- Enumerate all whitelisted processes
- Check for process masquerading
- Verify binary paths and signatures
- Review DNS resolution patterns
Step 4: Remediation Planning
- Update macOS to latest security patches
- Configure firewall to block QUIC/UDP-443 if needed
- Implement application allowlisting by path, not just name
- Enable logging for Network Extension events
- Consider additional monitoring for DNS and browser traffic
Scripts
Use the bundled scripts for common audit tasks:
- List all established TCP connectionscheck-allowed-traffic.sh
- Display PF rules from GUI firewallsinspect-pf-rules.sh
- Find binaries with network entitlementscheck-entitlements.sh
- Check if QUIC/ECH is availabletest-quic-capability.sh
- Watch Network Extension filter logsmonitor-netext.sh
References
- macOS Firewall Bypass Techniques
- Nosebeard Advisory NBL-001
- Apple Removes macOS Feature
- macOS Sequoia Network Extension Issues
- Microsoft Defender Network Protection
- LuLu Source Code
Safety Notes
- Always perform audits on systems you own or have explicit authorization to test
- Some tests may generate network traffic - ensure you're in a controlled environment
- CVE testing should only be done on systems where you can verify patch status
- Network Extension stress tests may temporarily impact firewall functionality
- Document all findings and remediate vulnerabilities discovered