Hunt: macOS
Current emphasis (update on wiki harvest): keychain / credential loot and XPC-dylib injection over grinding TCC or SIP bypasses first - models over- index on over-represented old methods; the newest harvested technique leads the checklist until superseded.
Assumes hunt-core for the scope gate, two-account rule, confirmation gate, enumeration limits, stop conditions, wiki protocol, FIND output, and Deadends. Do not re-derive any of that here.
Paths (binding - define once at the top of the run notes)
# seat side (wsl) - engagement tree is DOUBLE-NESTED in VMshare:
ENG_DIR=/mnt/c/Users/Lenovo/Desktop/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/macos/<host>
# VM side (WHERE cross-VM tooling runs, same tree through the share;
# most macOS commands run ON the macOS foothold itself):
ENG_DIR=/mnt/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/macos/<host>
Corpus and probes live in the VMshare tree; macOS-host command output is captured into $RUN over the foothold channel (SSH session), not run from the Kali VM. The repo tree targets/ is admin/ingest only - probe artifacts NEVER land there.
Transport
Every VM-native command block ships through ONE documented transport:
cd /mnt/c/Users/Lenovo/Documents/ObisidianVaults/ZTorch/ZTorch && bash scripts/vm-ssh.sh '<command>'
- vm-ssh lands as user tz (NOT root); one argument per call; quotes
ship as base64 (
echo <b64> | base64 -d | bash). - HTTP fetches via /opt/scope-shim/bin/{curl,httpx}; out-of-scope dies rc 126 (never work around); UNKNOWN = ADVISORY, self-deny.
- The macOS foothold session is driven over its own SSH/screen
channel (docs/shell-interaction.md); Kali-side only hashcat (-m
- and offline analysis run on the VM. Long cracks run detached (vm-bg.sh).
Entry gate
All four must pass; each is falsifiable:
Active engagement exists (repo tree targets//active.md) and the macOS host is on targets//scope.md in-scope. Scope-guard is the deny. (targets/ is the repo admin tree; $ENG_DIR holds corpus and run artifacts only - see Paths.)
hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md).
Producer verified - at least ONE of: (a) a macOS foothold exists (SSH/screen session recorded in the engagement state);
(b) a delivered .pkg/.dmg/.app is the engagement vector;
(c) kickoff seeded $RUN/raw/host-map.md. None = dispatch the surface lane first.Toolchain preflight (fails LOUD; install-on-demand per the operator rule; foothold-side binaries checked IN the session):
for t in /usr/bin/jq /usr/bin/python3 /home/tz/go/bin/hashcat; do command -v "$t" >/dev/null || { echo "MISSING TOOL: $t"; exit 1; } done # on the macOS foothold (inside the session): # csrutil status; spctl --status; sqlite3 -version # (missing foothold tools note their branch constraint)
Checklist (mandatory)
Copy checklist.md (this skill's dir) to
$ENG_DIR/hunt/macos/<host>/macos-checklist.md at run start.
Unchecked at stop = UNCHECKED lane, re-run from the first unchecked
step. The SKILL.md text and the checklist header agree byte-for-byte
on that copy target.
Nudge
Review-skill re-injection text (pinned; NOTE: completion-gate emits its own generic nudge - both mean: resume at the first unchecked box):
Your work was just reviewed by the review skill and it was found
that you either missed a step of analysis, or didn't generate an
artifact of sufficient proof. Look at the markdown based checklist
and the output for each step, find what you missed, and complete
that step.
2025-26 technique ladder: references/bypass-arsenal.md (NEW classes, defense->bypass map).
Wiki
Hub: [[macos-moc]] - Primary page: [[macos-tcc]] - Payload arsenal: wiki/payloads/macos-app-injection.md
Anchors: [[macos-privesc]], [[macos-keychain]]
REFS: [[macos-tcc]], wiki/payloads/macos-app-injection.md
mcp__wiki-search__query (lex) "macOS TCC SIP Gatekeeper AMFI keychain XPC dylib injection sandbox escape code signing entitlements" via wiki-search MCP - ONLY when you have a concrete hint the map above doesn't cover (a specific sink/version/CVE, an observed escape); not a blanket first step.
Environment note
macOS boxes on THM/HTB are usually a VM (not real Apple hardware) - SIP/Gatekeeper/TCC still apply as shipped, but device-specific protections (Secure Enclave, T2) generally do not. Confirm root/admin vs a sandboxed app context before picking an escalation path - the sandbox-escape and TCC-bypass techniques below assume different starting points.
Attack surface signals
APPROACH: Confirm root/admin vs sandboxed context, then rank the surface - TCC/SIP/Gatekeeper/AMFI bypass, keychain/credential loot (highest reward-per-effort), XPC/dylib/library injection, sandbox escape, MDM/installer abuse - and loot before grinding a hardened control.
AVOID: A permissive entitlement in a plist, an unsigned binary on disk, a world-writable bundle, or csrutil/spctl reporting a control present is NOT confirmation - the control must be DEFEATED and demonstrated (protected resource read, unsigned code ran, injected dylib executing in the entitled process).
Detected via: SSH/service banner (Darwin, Mac OS X 10., macOS 1[1-5]), a .app bundle / .plist
delivered as a foothold vector, Bonjour/mDNS (5353), ARD/screen-sharing (5900/3283), SMB served by
smbd with a macOS-flavoured share layout, or a CTF prompt naming macOS/Darwin explicitly.
Footholds: a delivered .pkg/.dmg/.app (installer/Gatekeeper abuse), a web app or service running
as a low-priv user, physical/VNC/screen-sharing access to a logged-in session.
Rank the surface once you have a foothold:
- TCC / SIP / Gatekeeper / AMFI - the macOS-specific security stack; a bypass here is the signature finding of this class and the primary path to protected data or unsigned code exec.
- Keychain / credential loot - highest reward-per-effort; a login-keychain dump or a reused hash often beats grinding a hardened control (see chaining note).
- XPC / dylib / library injection - inherit a privileged or entitled process's rights; the main local-privesc lever once enumeration finds a vulnerable service or a hijackable load path.
- Sandbox escape - only relevant from a sandboxed app context; escapes to the full user context.
- MDM / installer abuse - a
.pkgpostinstall runs as root at install time; MDM enrollment reaches the whole fleet. Highest blast radius when either is present.
Methodology
- Enumerate the foothold first -
Skill(wiki-arsenal)then [[macos-enumeration]]: users, running processes/services (launchd agents/daemons), installed.appbundles, network map, SIP status (csrutil status), Gatekeeper status (spctl --status), TCC database location + entries.
csrutil status # SIP enabled/disabled - gates which privesc paths are live
spctl --status # Gatekeeper assessment on/off
sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db "select * from access" # per-app TCC grants
- Credential / secret loot - [[macos-keychain]] (login keychain dump,
securityCLI, keychain ACL bypass) then the wider sweep in [[macos-loot-locations]] (local password hashes under/var/db/dslocal/, browser/app credential stores, sensitive DBs) - crack recovered hashes with hashcat-m 7100(salted SHA512-PBKDF2). - Evasion / bypass the OS security stack (pick per what's actually gating you):
- [[macos-gatekeeper]] - quarantine-attribute stripping, unsigned/ad-hoc-signed app execution.
- [[macos-code-signing]] - signature/entitlement inspection and abuse (
codesign, ad-hoc re-signing). - [[macos-amfi]] - AppleMobileFileIntegrity internals underlying code-signing enforcement, and its bypasses.
- [[macos-launch-constraints]] - trust-cache / launch-constraint evasion on newer macOS.
- [[macos-dirty-nib]] - NIB-file injection into a signed app to gain its entitlements.
- Privilege escalation / sandbox escape - [[macos-privesc]] (the general checklist: SUID, sudo,
cron/launchd, writable app bundles) alongside:
- [[macos-sandbox-escape]] - escape an app sandbox profile to the full user context.
- [[macos-xpc-abuse]] - abuse a privileged XPC service's exposed Mach interface.
- [[macos-function-hooking]] / [[macos-library-injection]] / [[macos-thread-injection]] /
[[macos-app-injection]] (payload) -
DYLD_INSERT_LIBRARIES/dylib hijack/thread-injection into a privileged or entitled process to inherit its rights. - [[macos-authorization-db]] - Authorization Services rights-database manipulation for a privesc.
- [[macos-tcc]] - TCC bypass to reach protected data (contacts/photos/full-disk-access/camera) or ride a TCC-granted app's entitlement.
- [[macos-installers-abuse]] -
.pkgpostinstall-script /.dmgabuse for root-run code at install time. - [[macos-chromium-injection]] - inject into a Chromium-based app (Electron/Chrome) via its debug/CEF surface for code exec in that app's context.
- Persistence + lateral - [[macos-persistence]] (launch agents/daemons, login items, cron) and [[macos-mdm]] (enrolled-MDM abuse for fleet-wide reach, if the host is MDM-managed).
Chaining. Foothold -> keychain/credential loot -> privesc is the reliable macOS chain: a
low-priv shell first dumps the login keychain and /var/db/dslocal/ hashes ([[macos-keychain]] /
[[macos-loot-locations]]), a cracked or reused admin password then unlocks sudo/security and the
privileged XPC/dylib paths in step 4. Loot before you grind a hardened control.
Evasion. Prefer the least-noisy path that clears the gate: strip the com.apple.quarantine
xattr rather than fully re-sign, ride an already-TCC-granted app's entitlement rather than defeating
TCC head-on, and load via a hijackable dylib search path before touching AMFI/launch-constraint
internals. Escalate to heavier bypasses ([[macos-amfi]], [[macos-launch-constraints]]) only when the
lighter path is actually blocked.
Distill a confirmed reusable macOS technique per hunt-core: python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page techniques/macos/macos-privesc.md.
N/A escapes
- "N/A: SIP disabled box" (privesc unconstrained - note it, do not grind bypass techniques against a disabled control)
- "N/A: no sandboxed app context" (sandbox-escape step)
- "N/A: not MDM-enrolled" (MDM step)
- "N/A: no .pkg/.dmg delivery vector" (installer step) An N/A tick is a claim with a reason, never a silent pass. Identical strings in SKILL.md and checklist.md.
Bitter-pill variant
Freehand run: skip checklist + numbered steps, one freehand pass over the host map, output ONLY $RUN/analysis/bitter-pill.md (tried/found/ dismissed, every claim carries evidence). The control-defeated gate survives freehand. Declare with a _requests.md row (lane = hunt-macos-bitterpill).
Depth walk (mandatory)
Walk EVERY applicable row of the payload arsenal page cited above.
Record each row in $RUN/coverage-depth.md as a table
| row | state | evidence | where state is probed, blocked, or
N/A, and evidence is a probe-pair path or a Deadends.md line. A bare
probed with no evidence reference fails the completion gate
(NEEDS-REVIEW). N/A rows cite why (surface shape forbids it).
Blocked implies research: before any Deadend is claimable on a blocked
row, (a) walk the arsenal page's bypass-ladder rows for that control
class, and (b) run one wiki query AND one mcp__wigolo__search for the
specific tech-plus-control bypass. Results, or a genuine null, land in
coverage-depth.md. "No research tried" is not a claimable state.
Exit artifact + handoff
ONE exit artifact set: $RUN/candidates.jsonl + candidates.md +
$ENG_DIR/hunt-macos-.md (pointer with MACOS-HUNT-DONE + counts).
Consumer (triage) finds at $RUN: raw/host-map.md, probes/*.jsonl,
probes/raw/, candidates.{jsonl,md}. Findings leave ONLY through G1.
Distill: python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page techniques/macos/macos-privesc.md.
Confirmation gate
NOT confirmation: a permissive entitlement (com.apple.security.*, a get-task-allow or a
private-framework entitlement) present in a plist; an unsigned or ad-hoc-signed binary sitting on
disk; a world-writable app bundle or launchd plist; csrutil/spctl reporting a control as present;
a DYLD_INSERT_LIBRARIES that the loader ignored on a hardened process. A capability that exists
is not a control that was bypassed.
IS confirmation: the control was actually defeated and demonstrated - TCC bypassed and the
protected resource (contacts/photos/full-disk/camera) actually read; SIP-protected path written or
csrutil-guarded action performed; Gatekeeper/AMFI/launch-constraint bypassed and your unsigned code
ran past it; an injected dylib/thread executing inside the privileged/entitled process and
exercising its rights; a .pkg postinstall or XPC call yielding a root-context action you performed -
each re-verified in a clean session and reproduced from your own written steps.
Validation
- Proof = the protected asset actually read (or the binary run) with the TCC prompt
NOT appearing, captured twice; or exec of unsigned code through the abused mechanism
with
idoutput proving the context. - Negative control: a normal app performing the same read DOES prompt.
False Positives
- Prompt suppressed by MDM configuration profile (documented policy, not a bypass).
- DYLD_* stripped: hardened runtime doing exactly its job.
- Quarantine attribute absent because an admin tool downloaded the file.
- LaunchAgent writable but load requires root (write is not load).
Cross-routing
- Load hunt-secrets for keychain/cred harvesting post-access.
- Load hunt-pwn for memory-corruption natives on Apple platforms.
- Not this skill: iOS/iPadOS surfaces (different TCC model, different skill scope).
Severity
| Severity | Class |
|---|---|
| CRITICAL | root / SIP-disabled code exec, MDM fleet compromise |
| HIGH | sandbox escape, XPC privesc, keychain-wide credential dump |
| MEDIUM | TCC bypass to a single data class, Gatekeeper bypass with no privilege gain |
Stop conditions
Terminal states complete (probed | N/A with reason | deadend row written), nothing written into skill dirs (skills/exploit/hunt/ hunt-macos/ stays untouched), no unchecked boxes above REVIEW. hunt-core stop conditions fire unchanged.