Agent skill · security · yaklang

macos-process-injection

macOS process injection playbook. Use when you need to inject code into running or launching macOS processes via dylib hijacking, DYLD environment variables, XPC exploitation, Mach port manipulation, or Electron/Chromium abuse.

Why this skill is useful

Adds detailed executable scripts and methodologies for advanced macOS process injection techniques that are not widely known.

What it needs

Requires gcc installed locally. About 8k tokens when loaded. Last updated 2026-06-16. 1,563 stars on the source repository.

What this skill does

SKILL: macOS Process Injection — Expert Attack Playbook AI LOAD INSTRUCTION: Expert macOS process injection techniques. Covers DYLDINSERTLIBRARIES, dylib hijacking (weak/rpath/proxy), XPC PID reuse attacks, Mach port manipulation, MIG abuse, and Electron injection. Base models miss entitlement prerequisites and SIP constraints on injection vectors. 0. RELATED ROUTING Before going deep, consider loading: macos-security-bypass when you need to bypass TCC, Gatekeeper, or SIP protections blocking your injection linux-privilege-escalation for Unix-layer escalation (shared object hijacking concepts apply) Advanced Reference Also load DYLIBXPCTECHNIQUES.md when you need: Step-by-step dylib hijacking methodology with tooling commands XPC exploitation walkthrough with code examples Mach port technique details and taskforpid patterns --- 1. DYLDINSERTLIBRARIES INJECTION The most straightforward injection: set an environment variable that forces the dynamic linker to preload your dylib. 1.1 Requirements and Restrictions Condition Can Inject? Reason --- --- --- Normal (non-hardened) binary Yes No restrictions Hardened Runtime enabled No DYLD strips env vars Hardened Runtime + com.apple.security.cs.allow-dyld-environment-variables Yes Entitlement explicitly allows it Apple system binary (SIP-protected) No DYLD env vars stripped by SIP SUID/SGID binary No DYLD env vars stripped for privilege safety App Sandbox enabled No Sandbox blocks env var injection 1.2 Basic Injection 1.3 Finding Injectable Targets --- 2. DYLIB HIJACKING Exploit the dynamic linker's library search order to load attacker-controlled dylibs instead of (or in addition to) legitimate ones. 2.1 Weak Dylib Hijacking (LCLOADWEAKDYLIB) Weak dylibs are optional — if missing, the binary still runs. If you can place a dylib at the expected path, it loads. 2.2 @rpath Hijacking @rpath is resolved from LCRPATH entries in the binary. If an earlier rpath directory is writable, you can place your dylib there. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills yaklang/macos-process-injection

View the source on GitHub

Browse the @skills marketplace