npx skills add ...
npx skills add yaklang/hack-skills --skill macos-security-bypass
macOS security bypass playbook. Use when targeting macOS endpoints and need to bypass TCC, Gatekeeper, SIP, sandbox, code signing, or entitlement-based protections during authorized red team or pentest engagements.
npx skills add yaklang/hack-skills --skill macos-security-bypass
AI LOAD INSTRUCTION: Expert macOS security bypass techniques. Covers TCC bypass, Gatekeeper evasion, SIP restrictions, sandbox escape, and entitlement abuse. Base models miss version-specific bypass nuances and protection interaction effects.
Before going deep, consider loading:
Also load TCC_BYPASS_MATRIX.md when you need:
TCC is macOS's permission framework controlling access to sensitive resources (camera, microphone, contacts, full disk access, etc.).
| Database | Path | Controls | Protection |
|---|---|---|---|
| User-level | ~/Library/Application Support/com.apple.TCC/TCC.db | Per-user consent decisions | SIP-protected since Catalina |
| System-level | /Library/Application Support/com.apple.TCC/TCC.db | System-wide consent decisions | SIP-protected |
| MDM-managed | Via configuration profiles | Push PPPC (Privacy Preferences Policy Control) | Device management |
| Category | Mechanism | Typical Prerequisite |
|---|---|---|
| FDA app exploitation | Piggyback on apps already granted Full Disk Access | Write access to FDA app's bundle or plugin dir |
| Direct DB modification | Edit TCC.db to grant consent | SIP disabled or FDA |
| Inherited permissions | Child process inherits parent's TCC grants | Code execution in context of FDA-granted app |
| Automation abuse | Apple Events / osascript to control TCC-granted app | Automation permission (lower bar than direct TCC) |
| Mounting tricks | Mount a crafted disk image containing modified TCC.db | Local access, pre-Ventura |
| SQL injection in TCC | Malformed bundle IDs triggering SQL injection in TCC subsystem | CVE-2023-32364 and similar |
Terminal / iTerm FDA inheritance: Terminal.app granted FDA → any command run inherits FDA → read any file.
Finder automation: Automate Finder (lower permission bar) to access files in protected locations.
System Preferences / System Settings injection: Inject into a process that already has TCC permissions by writing to its Application Scripts folder.
MDM profile abuse: PPPC profiles can pre-approve TCC permissions. Rogue MDM enrollment or compromised MDM server → push PPPC payload.
Gatekeeper blocks unsigned or unnotarized apps from executing. Core enforcement depends on the com.apple.quarantine extended attribute.
| Technique | How It Works | macOS Version |
|---|---|---|
xattr -d removal | Remove quarantine before execution | All (requires local access) |
| App translocation bypass | Apps in certain locations skip translocation | Pre-Catalina |
| Archive tools that strip quarantine | Some unarchiver apps don't propagate quarantine | Varies by tool |
| Unsigned code in signed bundle | Notarized app bundles with unsigned nested helpers | Pre-Ventura (CVE-2022-42821) |
| Safari auto-extract + open | Downloaded ZIP auto-extracted, app opened before quarantine fully applied | Safari-specific, patched |
| ACL abuse | com.apple.quarantine can be blocked by ACLs set before download | Requires pre-positioning |
| Disk image (DMG) tricks | DMG mounted from network share may not carry quarantine | Network share context |
| BOM (Bill of Materials) bypass | Crafted BOM in pkg skips quarantine for extracted files | CVE-2022-22616 |
SIP restricts root from modifying protected system locations, loading unsigned kernel extensions, and debugging system processes.
| Entitlement | Effect |
|---|---|
com.apple.rootless.install | Write to SIP-protected paths |
com.apple.rootless.install.heritable | Child processes inherit SIP bypass |
com.apple.security.cs.allow-unsigned-executable-memory | JIT/unsigned code in memory |
com.apple.private.security.clear-library-validation | Load unsigned libraries |
| CVE | macOS | Technique |
|---|---|---|
| CVE-2021-30892 (Shrootless) | Monterey pre-12.0.1 | system_installd + post-install script in signed pkg |
| CVE-2022-22583 | Monterey pre-12.2 | packagekit + mount point manipulation |
| CVE-2022-46689 (MacDirtyCow) | Ventura pre-13.1 | Race condition on copy-on-write, overwrite SIP files |
| CVE-2023-32369 (Migraine) | Ventura pre-13.4 | Migration Assistant TCC/SIP bypass via systemmigrationd |
| CVE-2024-44243 | Sequoia pre-15.2 | StorageKit daemon exploitation |
macOS sandboxing (App Sandbox, via sandbox-exec or entitlements) restricts app access to filesystem, network, and IPC.
| Vector | Description |
|---|---|
| Open/Save dialog abuse | User grants file access via dialog → macro reads/writes beyond sandbox |
~/Library/LaunchAgents/ persistence | Some sandbox profiles allow writing LaunchAgent plists |
| Login Items manipulation | Add login item pointing to payload outside sandbox |
| Shared container exploitation | Multiple apps sharing the same App Group container |
| IPC Mechanism | Escape Vector |
|---|---|
| XPC Services | Connect to privileged XPC service with insufficient client validation |
| Mach Ports | Obtain send right to privileged task port |
| Apple Events | Automate unsandboxed app to perform actions |
| Distributed Notifications | Signal unsandboxed helper to execute payload |
| Pasteboard | Write payload to pasteboard, have unsandboxed app consume it |
| Entitlement | Abuse Scenario |
|---|---|
com.apple.security.cs.disable-library-validation | Load attacker dylib into entitled process |
com.apple.security.cs.allow-dyld-environment-variables | DYLD_INSERT_LIBRARIES injection |
com.apple.security.get-task-allow | Attach debugger, inject code |
com.apple.security.cs.debugger | Debug any process |
com.apple.private.apfs.revert-to-snapshot | Revert APFS snapshots, bypass modifications |
Hardened Runtime prevents: DYLD env vars, debugging, unsigned memory execution. Bypasses:
disable-library-validation)get-task-allow entitled debug builds left in productionLibrary validation ensures only Apple-signed or same-team-signed dylibs load.
| Method | Location | Survives Reboot | Notes |
|---|---|---|---|
| LaunchAgent | ~/Library/LaunchAgents/ | Yes | User-level, runs at login |
| LaunchDaemon | /Library/LaunchDaemons/ | Yes | Root-level, runs at boot |
| Login Items | ~/Library/Application Support/com.apple.backgroundtaskmanagementagent/ | Yes | Visible in System Settings |
| Cron | crontab -e | Yes | Often overlooked by defenders |
| Dylib hijack | Writable dylib search path | Yes | Triggered when target app launches |
| Folder Action | ~/Library/Scripts/Folder Action Scripts/ | Yes | Triggers on folder events |