macOS Post-Exploitation Methodology
46 programs across 8 categories for comprehensive macOS post-exploitation. Uses native tools (security, dtrace, xattr, log, launchctl, dscl, defaults, osascript), Python, and direct SQLite access.
Prerequisites
Before deploying machook tools, verify:
- Root access — most operations require root (recon programs work without root)
- SIP status — DTrace tools require SIP disabled (
csrutil disable from Recovery Mode)
- Native tools only — all tools use macOS CLI, no third-party dependencies
csrutil status # SIP status (DTrace needs disabled)
sw_vers # macOS version
id # current user/groups
security list-keychains # available keychains
Kill Chain Phases
Phase 1 — Reconnaissance (First 60 seconds)
Understand the target before deploying offensive tools.
| Action |
Command |
Purpose |
| System info |
machook system_info |
Kernel, distro, CPU, memory, disk, hardware model |
| Processes |
machook process_enum |
Running processes, root services, listening ports |
| Network |
machook network_enum |
Interfaces, routing, ARP, DNS, Wi-Fi, firewall |
| Users |
machook user_enum |
Local users, admin group, sudo access, last logins |
| Applications |
machook installed_apps |
Installed apps, Homebrew, pip, npm — check versions via cve-mcp |
| Security posture |
machook security_framework |
SIP, Gatekeeper, FileVault, Firewall, XProtect, EDR, MDM |
| LaunchDaemons |
machook launchd_enum |
LaunchAgents/Daemons, third-party plist detection |
CVE Integration: After running installed_apps or security_framework, check software versions against CVE database via cve-mcp (cve search_by_product --product <name> --version <ver>). If cve-mcp is not enabled: cyberstrike mcp enable cve.
Phase 2 — Credential Harvesting
Extract credentials from macOS-specific stores.
| Action |
Command |
Purpose |
| Keychain dump |
machook keychain_dump |
Extract passwords from login/system Keychain |
| Chrome creds |
machook chrome_creds |
Chrome/Safari passwords, cookies, autofill |
| SSH keys |
machook ssh_keys |
Private keys, known_hosts, authorized_keys, SSH config |
| Safari data |
machook safari_creds |
History, bookmarks, downloads, extensions, LocalStorage |
| Cloud creds |
machook cloud_creds |
AWS, GCP, Azure, Docker, Kubernetes credentials |
| GPG keys |
machook gpg_keys |
GPG private keys, keyrings, agent status |
| iCloud tokens |
machook icloud_tokens |
iCloud account tokens, Accounts.sqlite, Keychain DB |
| Mail creds |
machook mail_creds |
Mail.app account credentials and tokens |
Phase 3 — Privilege Escalation
Escalate from user to root.
| Action |
Command |
Purpose |
| TCC bypass |
machook tcc_bypass |
Access camera, microphone, files without consent |
| Dylib hijack |
machook dylib_hijack |
SUID/SGID binaries with weak dylib paths, DYLD_INSERT |
| LaunchDaemon abuse |
machook launchd_plist_abuse |
Writable plists/binaries in LaunchDaemons |
| Sudo misconfig |
machook sudo_misconfig |
NOPASSWD, env_keep DYLD, sudo version CVEs |
| Auth DB |
machook authorization_db |
Authorization Database rights for privesc vectors |
| Installer abuse |
machook pkg_abuse |
Trojaned .pkg files, writable installer scripts |
Phase 4 — Persistence
Maintain access across reboots.
| Action |
Command |
Purpose |
| LaunchAgent |
machook launchagent_persist --label NAME --command CMD |
User-level persistence (survives reboot) |
| LaunchDaemon |
machook launchdaemon_persist --label NAME --command CMD |
Root-level persistence (requires root) |
| Login items |
machook login_items --path /path/to/app |
Run on user login via System Events |
| Cron |
machook cron_persist --command CMD |
Scheduled crontab persistence |
| Shell RC |
machook bashrc_persist --command CMD |
Inject into .zshrc/.bashrc (runs on shell open) |
| Periodic |
machook periodic_scripts --command CMD --frequency daily |
/etc/periodic/ scripts (root, daily/weekly/monthly) |
Phase 5 — Monitoring
Observe target activity for intelligence gathering.
| Action |
Command |
Purpose |
| Keylogging |
machook keylog_mac --duration 120 |
Capture keystrokes via osascript with app context |
| Process trace |
machook dtrace_exec --duration 60 |
Monitor all process executions (SIP disabled) |
| Network trace |
machook dtrace_net --duration 60 |
Monitor network connections (SIP disabled) |
| File trace |
machook dtrace_file --duration 60 |
Monitor file access (SIP disabled) |
| Clipboard |
machook clipboard_monitor --duration 60 |
Capture clipboard changes (passwords, tokens) |
| Screenshot |
machook screen_capture |
Silent screenshot via screencapture |
Phase 6 — Lateral Movement
Pivot to other systems on the network.
| Action |
Command |
Purpose |
| SSH pivot |
machook ssh_pivot --target HOST --command CMD |
SSH lateral movement, tunnels, agent forwarding |
| AirDrop recon |
machook airdrop_abuse |
AirDrop discoverability and nearby device scan |
| Bonjour/mDNS |
machook bonjour_enum |
Discover SSH, HTTP, SMB, AFP, VNC services |
| Apple Remote Desktop |
machook apple_remote_desktop |
ARD/Screen Sharing status and access audit |
Phase 7 — Evasion & Anti-Forensics
Reduce forensic footprint and bypass defenses.
| Action |
Command |
Purpose |
| XProtect check |
machook xprotect_check |
Enumerate detection signatures for evasion planning |
| Gatekeeper bypass |
machook gatekeeper_bypass --path /path |
Remove quarantine xattr for unsigned execution |
| Clear logs |
machook log_clear |
Clear unified logging, audit, crash reports |
| Clear history |
machook history_clear |
Shell, app history, recent items, Spotlight |
| Timestomp |
machook timestomp --path /path --reference /ref |
Modify file timestamps to blend in |
| EDR bypass |
machook endpoint_security_bypass |
Enumerate EDR extensions, check SIP/MDM bypass vectors |
Phase 8 — Exfiltration & Cleanup (MANDATORY)
Stage data and remove all traces.
| Action |
Command |
Purpose |
| Stage data |
machook data_stage --type keys --output /tmp/out.tar.gz |
Find and archive sensitive files |
| Audit artifacts |
machook artifact_enum |
Pre-cleanup audit of all CyberStrike traces |
| Cleanup |
machook cleanup_mac |
ALWAYS run before exiting |
Detection Considerations
macOS post-exploitation tools are detectable by:
- Endpoint Security Framework (ESF) — EDR agents using
es_new_client() for process/file/auth events
- Unified Logging —
log show --predicate 'process == "security"' for Keychain access
- TCC audit — TCC access logged in Console.app,
tccutil events visible
- SIP — When enabled, blocks DTrace system-wide tracing and TCC.db modification
- XProtect — Scans downloaded executables against YARA rules
- Gatekeeper — Checks code signing and quarantine attributes
- MDM/Jamf Protect — Managed Macs report configuration changes, new LaunchAgents
- CrowdStrike Falcon / SentinelOne — macOS EDR detects suspicious
security command usage, CGEventTap, dylib injection
- LaunchDaemon monitoring — New plists in /Library/LaunchDaemons/ trigger alerts
- Authorization DB changes — Modifications to system.privilege.* rights are logged
- SSH audit — New authorized_keys entries, SSH tunnels visible in
lsof
Program Reference
| Program |
Technique |
MITRE ATT&CK |
| system_info |
System information enumeration |
T1082 |
| process_enum |
Process and service discovery |
T1057 |
| network_enum |
Network configuration discovery |
T1016 |
| user_enum |
Local account and group discovery |
T1087.001 |
| installed_apps |
Software discovery with cve-mcp CTA |
T1518 |
| security_framework |
Security software discovery |
T1518.001 |
| launchd_enum |
Service enumeration |
T1007 |
| keychain_dump |
macOS Keychain extraction |
T1555.001 |
| chrome_creds |
Browser credential decryption |
T1555.003 |
| ssh_keys |
SSH private key discovery |
T1552.004 |
| safari_creds |
Safari browser data extraction |
T1555.003 |
| cloud_creds |
Cloud credential harvesting |
T1552.001 |
| gpg_keys |
GPG private key extraction |
T1552.004 |
| icloud_tokens |
iCloud token harvesting |
T1528 |
| mail_creds |
Mail credential extraction |
T1114.001 |
| tcc_bypass |
TCC database manipulation |
T1548 |
| dylib_hijack |
Dylib search order hijacking |
T1574.004 |
| launchd_plist_abuse |
Writable plist/binary abuse |
T1574.006 |
| sudo_misconfig |
Sudo misconfiguration abuse |
T1548.003 |
| authorization_db |
Authorization DB rights abuse |
T1548 |
| pkg_abuse |
Installer package abuse |
T1546.016 |
| launchagent_persist |
LaunchAgent persistence |
T1543.001 |
| launchdaemon_persist |
LaunchDaemon persistence |
T1543.004 |
| login_items |
Login item persistence |
T1547.015 |
| cron_persist |
Cron job persistence |
T1053.003 |
| bashrc_persist |
Shell RC file persistence |
T1546.004 |
| periodic_scripts |
Periodic script persistence |
T1053.003 |
| xprotect_check |
XProtect/MRT signature enumeration |
T1518.001 |
| gatekeeper_bypass |
Quarantine xattr removal |
T1553.001 |
| log_clear |
System log clearing |
T1070.002 |
| history_clear |
Shell/app history clearing |
T1070.003 |
| timestomp |
File timestamp modification |
T1070.006 |
| endpoint_security_bypass |
EDR enumeration and bypass |
T1562.001 |
| keylog_mac |
Keystroke capture |
T1056.001 |
| dtrace_exec |
Process execution tracing |
T1057 |
| dtrace_net |
Network connection tracing |
T1049 |
| dtrace_file |
File access tracing |
T1083 |
| clipboard_monitor |
Clipboard data capture |
T1115 |
| screen_capture |
Screen capture |
T1113 |
| ssh_pivot |
SSH lateral movement |
T1021.004 |
| airdrop_abuse |
AirDrop reconnaissance |
T1021 |
| bonjour_enum |
mDNS service discovery |
T1046 |
| apple_remote_desktop |
ARD/Screen Sharing abuse |
T1021.003 |
| data_stage |
Sensitive data staging |
T1074.001 |
| artifact_enum |
Pre-cleanup artifact audit |
T1070 |
| cleanup_mac |
Artifact removal and cleanup |
T1070 |
1---2name: macos-postexploit3description: macOS post-exploitation — 46 programs across recon, credential harvesting, privilege escalation, persistence, evasion, monitoring, lateral movement, and exfiltration4---56# macOS Post-Exploitation Methodology7846 programs across 8 categories for comprehensive macOS post-exploitation. Uses native tools (`security`, `dtrace`, `xattr`, `log`, `launchctl`, `dscl`, `defaults`, `osascript`), Python, and direct SQLite access.910## Prerequisites1112Before deploying machook tools, verify:13141. **Root access** — most operations require root (recon programs work without root)152. **SIP status** — DTrace tools require SIP disabled (`csrutil disable` from Recovery Mode)163. **Native tools only** — all tools use macOS CLI, no third-party dependencies1718```bash19csrutil status # SIP status (DTrace needs disabled)20sw_vers # macOS version21id # current user/groups22security list-keychains # available keychains23```2425## Kill Chain Phases2627### Phase 1 — Reconnaissance (First 60 seconds)2829Understand the target before deploying offensive tools.3031| Action | Command | Purpose |32|--------|---------|---------|33| System info | `machook system_info` | Kernel, distro, CPU, memory, disk, hardware model |34| Processes | `machook process_enum` | Running processes, root services, listening ports |35| Network | `machook network_enum` | Interfaces, routing, ARP, DNS, Wi-Fi, firewall |36| Users | `machook user_enum` | Local users, admin group, sudo access, last logins |37| Applications | `machook installed_apps` | Installed apps, Homebrew, pip, npm — check versions via cve-mcp |38| Security posture | `machook security_framework` | SIP, Gatekeeper, FileVault, Firewall, XProtect, EDR, MDM |39| LaunchDaemons | `machook launchd_enum` | LaunchAgents/Daemons, third-party plist detection |4041**CVE Integration:** After running `installed_apps` or `security_framework`, check software versions against CVE database via cve-mcp (`cve search_by_product --product <name> --version <ver>`). If cve-mcp is not enabled: `cyberstrike mcp enable cve`.4243### Phase 2 — Credential Harvesting4445Extract credentials from macOS-specific stores.4647| Action | Command | Purpose |48|--------|---------|---------|49| Keychain dump | `machook keychain_dump` | Extract passwords from login/system Keychain |50| Chrome creds | `machook chrome_creds` | Chrome/Safari passwords, cookies, autofill |51| SSH keys | `machook ssh_keys` | Private keys, known_hosts, authorized_keys, SSH config |52| Safari data | `machook safari_creds` | History, bookmarks, downloads, extensions, LocalStorage |53| Cloud creds | `machook cloud_creds` | AWS, GCP, Azure, Docker, Kubernetes credentials |54| GPG keys | `machook gpg_keys` | GPG private keys, keyrings, agent status |55| iCloud tokens | `machook icloud_tokens` | iCloud account tokens, Accounts.sqlite, Keychain DB |56| Mail creds | `machook mail_creds` | Mail.app account credentials and tokens |5758### Phase 3 — Privilege Escalation5960Escalate from user to root.6162| Action | Command | Purpose |63|--------|---------|---------|64| TCC bypass | `machook tcc_bypass` | Access camera, microphone, files without consent |65| Dylib hijack | `machook dylib_hijack` | SUID/SGID binaries with weak dylib paths, DYLD_INSERT |66| LaunchDaemon abuse | `machook launchd_plist_abuse` | Writable plists/binaries in LaunchDaemons |67| Sudo misconfig | `machook sudo_misconfig` | NOPASSWD, env_keep DYLD, sudo version CVEs |68| Auth DB | `machook authorization_db` | Authorization Database rights for privesc vectors |69| Installer abuse | `machook pkg_abuse` | Trojaned .pkg files, writable installer scripts |7071### Phase 4 — Persistence7273Maintain access across reboots.7475| Action | Command | Purpose |76|--------|---------|---------|77| LaunchAgent | `machook launchagent_persist --label NAME --command CMD` | User-level persistence (survives reboot) |78| LaunchDaemon | `machook launchdaemon_persist --label NAME --command CMD` | Root-level persistence (requires root) |79| Login items | `machook login_items --path /path/to/app` | Run on user login via System Events |80| Cron | `machook cron_persist --command CMD` | Scheduled crontab persistence |81| Shell RC | `machook bashrc_persist --command CMD` | Inject into .zshrc/.bashrc (runs on shell open) |82| Periodic | `machook periodic_scripts --command CMD --frequency daily` | /etc/periodic/ scripts (root, daily/weekly/monthly) |8384### Phase 5 — Monitoring8586Observe target activity for intelligence gathering.8788| Action | Command | Purpose |89|--------|---------|---------|90| Keylogging | `machook keylog_mac --duration 120` | Capture keystrokes via osascript with app context |91| Process trace | `machook dtrace_exec --duration 60` | Monitor all process executions (SIP disabled) |92| Network trace | `machook dtrace_net --duration 60` | Monitor network connections (SIP disabled) |93| File trace | `machook dtrace_file --duration 60` | Monitor file access (SIP disabled) |94| Clipboard | `machook clipboard_monitor --duration 60` | Capture clipboard changes (passwords, tokens) |95| Screenshot | `machook screen_capture` | Silent screenshot via screencapture |9697### Phase 6 — Lateral Movement9899Pivot to other systems on the network.100101| Action | Command | Purpose |102|--------|---------|---------|103| SSH pivot | `machook ssh_pivot --target HOST --command CMD` | SSH lateral movement, tunnels, agent forwarding |104| AirDrop recon | `machook airdrop_abuse` | AirDrop discoverability and nearby device scan |105| Bonjour/mDNS | `machook bonjour_enum` | Discover SSH, HTTP, SMB, AFP, VNC services |106| Apple Remote Desktop | `machook apple_remote_desktop` | ARD/Screen Sharing status and access audit |107108### Phase 7 — Evasion & Anti-Forensics109110Reduce forensic footprint and bypass defenses.111112| Action | Command | Purpose |113|--------|---------|---------|114| XProtect check | `machook xprotect_check` | Enumerate detection signatures for evasion planning |115| Gatekeeper bypass | `machook gatekeeper_bypass --path /path` | Remove quarantine xattr for unsigned execution |116| Clear logs | `machook log_clear` | Clear unified logging, audit, crash reports |117| Clear history | `machook history_clear` | Shell, app history, recent items, Spotlight |118| Timestomp | `machook timestomp --path /path --reference /ref` | Modify file timestamps to blend in |119| EDR bypass | `machook endpoint_security_bypass` | Enumerate EDR extensions, check SIP/MDM bypass vectors |120121### Phase 8 — Exfiltration & Cleanup (MANDATORY)122123Stage data and remove all traces.124125| Action | Command | Purpose |126|--------|---------|---------|127| Stage data | `machook data_stage --type keys --output /tmp/out.tar.gz` | Find and archive sensitive files |128| Audit artifacts | `machook artifact_enum` | Pre-cleanup audit of all CyberStrike traces |129| **Cleanup** | **`machook cleanup_mac`** | **ALWAYS run before exiting** |130131## Detection Considerations132133macOS post-exploitation tools are detectable by:134- **Endpoint Security Framework (ESF)** — EDR agents using `es_new_client()` for process/file/auth events135- **Unified Logging** — `log show --predicate 'process == "security"'` for Keychain access136- **TCC audit** — TCC access logged in Console.app, `tccutil` events visible137- **SIP** — When enabled, blocks DTrace system-wide tracing and TCC.db modification138- **XProtect** — Scans downloaded executables against YARA rules139- **Gatekeeper** — Checks code signing and quarantine attributes140- **MDM/Jamf Protect** — Managed Macs report configuration changes, new LaunchAgents141- **CrowdStrike Falcon / SentinelOne** — macOS EDR detects suspicious `security` command usage, CGEventTap, dylib injection142- **LaunchDaemon monitoring** — New plists in /Library/LaunchDaemons/ trigger alerts143- **Authorization DB changes** — Modifications to system.privilege.* rights are logged144- **SSH audit** — New authorized_keys entries, SSH tunnels visible in `lsof`145146## Program Reference147148| Program | Technique | MITRE ATT&CK |149|---------|-----------|---------------|150| system_info | System information enumeration | T1082 |151| process_enum | Process and service discovery | T1057 |152| network_enum | Network configuration discovery | T1016 |153| user_enum | Local account and group discovery | T1087.001 |154| installed_apps | Software discovery with cve-mcp CTA | T1518 |155| security_framework | Security software discovery | T1518.001 |156| launchd_enum | Service enumeration | T1007 |157| keychain_dump | macOS Keychain extraction | T1555.001 |158| chrome_creds | Browser credential decryption | T1555.003 |159| ssh_keys | SSH private key discovery | T1552.004 |160| safari_creds | Safari browser data extraction | T1555.003 |161| cloud_creds | Cloud credential harvesting | T1552.001 |162| gpg_keys | GPG private key extraction | T1552.004 |163| icloud_tokens | iCloud token harvesting | T1528 |164| mail_creds | Mail credential extraction | T1114.001 |165| tcc_bypass | TCC database manipulation | T1548 |166| dylib_hijack | Dylib search order hijacking | T1574.004 |167| launchd_plist_abuse | Writable plist/binary abuse | T1574.006 |168| sudo_misconfig | Sudo misconfiguration abuse | T1548.003 |169| authorization_db | Authorization DB rights abuse | T1548 |170| pkg_abuse | Installer package abuse | T1546.016 |171| launchagent_persist | LaunchAgent persistence | T1543.001 |172| launchdaemon_persist | LaunchDaemon persistence | T1543.004 |173| login_items | Login item persistence | T1547.015 |174| cron_persist | Cron job persistence | T1053.003 |175| bashrc_persist | Shell RC file persistence | T1546.004 |176| periodic_scripts | Periodic script persistence | T1053.003 |177| xprotect_check | XProtect/MRT signature enumeration | T1518.001 |178| gatekeeper_bypass | Quarantine xattr removal | T1553.001 |179| log_clear | System log clearing | T1070.002 |180| history_clear | Shell/app history clearing | T1070.003 |181| timestomp | File timestamp modification | T1070.006 |182| endpoint_security_bypass | EDR enumeration and bypass | T1562.001 |183| keylog_mac | Keystroke capture | T1056.001 |184| dtrace_exec | Process execution tracing | T1057 |185| dtrace_net | Network connection tracing | T1049 |186| dtrace_file | File access tracing | T1083 |187| clipboard_monitor | Clipboard data capture | T1115 |188| screen_capture | Screen capture | T1113 |189| ssh_pivot | SSH lateral movement | T1021.004 |190| airdrop_abuse | AirDrop reconnaissance | T1021 |191| bonjour_enum | mDNS service discovery | T1046 |192| apple_remote_desktop | ARD/Screen Sharing abuse | T1021.003 |193| data_stage | Sensitive data staging | T1074.001 |194| artifact_enum | Pre-cleanup artifact audit | T1070 |195| cleanup_mac | Artifact removal and cleanup | T1070 |