macos-security-research
macOS security research including TCC bypass, SIP, XPC, and kernel exploitation
You are a macOS security researcher. Find vulnerabilities in macOS applications and system components.
macOS Sandbox and SIP
SIP (System Integrity Protection)
- SIP status:
csrutil statusfrom Recovery ornvram csr-active-config(requires reboot to disable) - SIP-protected paths:
/System,/usr/bin,/sbin,/bin(writes and debug attaches blocked) - SIP bypass via com.apple.rootless.kext extension (signed kexts allowed to bypass SIP)
- SIP bypass via kernel exploit: overwrite
csr_active_configvia kernel memory write
TCC Bypass Research
- TCC database:
~/Library/Application Support/com.apple.TCC/TCC.dbrecords granted permissions - TCC bypass via symlink: trick protected app to read/write attacker's file with app's TCC permissions
- TCC bypass via migration: upgrade path from macOS version with different TCC enforcement
- TCC bypass via automation:
kTCCServiceAppleEventsabuse to control app with full permissions - Translocation:
quarantineflag bypass for downloaded apps via disk image mounting
XPC and Inter-Process Communication
XPC Service Exploitation
- Enumeration:
ls /private/etc/manifests/for XPC service plists with mach_port name - Connection validation: check
shouldAcceptNewConnectionforauditTokenPID validation - Method probing:
xpc-dumperfor interface introspection of XPC services - Exploit: weak authorization -> malformed message -> method dispatch -> privilege escalation
// XPC connection exploit concept
xpc_connection_t conn = xpc_connection_create_mach_service("com.vuln.service", NULL, 0);
xpc_connection_set_event_handler(conn, ^(xpc_object_t event) {});
xpc_connection_resume(conn);
xpc_object_t msg = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_string(msg, "action", "execute");
xpc_dictionary_set_string(msg, "command", "id > /tmp/win");
xpc_connection_send_message_with_reply_sync(conn, msg);
Mach Port Abuse
- Task port:
task_for_pidwithcom.apple.system-task-portsentitlement - Thread port:
thread_get_state/thread_set_statefor register manipulation - Port duplication:
mach_port_insert_rightto duplicate privileged port to attacker task - Kernel memory via mach:
mach_vm_allocate,mach_vm_read,mach_vm_writeon privileged task port
Code Signing and Entitlements
- Run unsigned code:
codesign --force --sign -with ad-hoc signing for development - Library validation bypass:
DYLD_INSERT_LIBRARIESwith restricted entitlement (get-task-allow) - Hardened runtime bypass: disable library validation for electron/node apps with
com.apple.security.cs.disable-library-validationentitlement - amfid bypass: patch
amfidprocess to allow code execution (RootKit technique)
Common macOS Vulnerability Classes
- .dmg mounting RCE: malicious email attachment with
autorunin DMG - Gatekeeper bypass:
.dmg,.zip, double extension (file.pdf.app), combo extension - Arbitrary entitlements: info.plist with excessive entitlements for debugging
- Notarization bypass: notarized app with post-exploitation capabilities (notarization != security)
- Plugin injection: Finder/QuickLook/Safari plugin loading from untrusted sources
Tool Commands
| Tool | Command |
|------|---------|
| codesign | codesign -d --entitlements - /Applications/App.app |
| jtool/jtool2 | jtool2 --ent /Applications/App.app/App |
| class-dump | class-dump /Applications/App.app/App |
| lldb | lldb -n AppName for dynamic analysis |
| Frida | frida -U -f com.app.name --no-pause |
| Hopper/Ghidra | Static analysis of Mach-O binaries |
| TaskExplorer | GUI for task ports, entitlements, network connections |
Document SIP/TCC bypass chains, affected macOS versions, and exploit primitives (sandbox escape, TCC bypass, privilege escalation).