macos-process-injection

Guides macOS code injection via DYLD, XPC/Mach IPC weaknesses, and Electron runtimes for security assessment scenarios.

5|2|Updated May 16, 2026
One-click install
npx skills add https://github.com/DorianGallo/hack-skills-local --skill macos-process-injection-doriangallo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: macos-process-injection
Source: https://github.com/DorianGallo/hack-skills-local/tree/main/skills/macos-process-injection
Command: npx skills add https://github.com/DorianGallo/hack-skills-local --skill macos-process-injection-doriangallo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) components.

What problem does it solve?

This Skill provides practical guidance for injecting code into macOS processes for security testing and research when you need to reach execution inside a target app or service despite common constraints like Hardened Runtime, SIP, and entitlements.

Core Features & Use Cases

  • DYLD and dylib hijacking playbooks: Exploit dynamic loader behavior via DYLD_INSERT_LIBRARIES, weak dylibs, @rpath manipulation, and proxy/re-export dylibs.
  • XPC exploitation pathways: Identify XPC services, understand entitlement/token validation gaps, and outline PID-reuse race concepts to influence privileged connections.
  • Mach port manipulation and MIG analysis: Use task/exception port techniques and review Mach IPC surfaces for likely weaknesses.
  • Electron/Chromium injection surfaces: Target Electron apps via RunAsNode, debugging/protocol attachment, NODE_OPTIONS-style preload ideas, and fuse-based gating.

Quick Start

Use the macos-process-injection skill to select the most applicable macOS injection vector for your target by checking Hardened Runtime/SIP constraints, then follow the corresponding section for DYLD hijacking, XPC, Mach ports, or Electron abuse.

Frequently Asked Questions about macos-process-injection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I inject code into a macOS process protected by Hardened Runtime and SIP?

Injecting code into a running macOS process involves leveraging dynamic linker behavior, IPC validation weaknesses, Mach port mechanisms, or Electron runtime abuse. The chosen vector depends on profiling the target's Hardened Runtime status, entitlements, and SIP constraints to ensure successful execution.

What is dylib hijacking and how does DYLD_INSERT_LIBRARIES work on macOS?

Dylib hijacking exploits the dynamic loader behavior on macOS by using techniques like DYLD_INSERT_LIBRARIES, weak dylibs, @rpath manipulation, and proxy dylibs. It allows code execution inside a target app by intercepting the dynamic linking process during launch.

How can I exploit XPC services and Mach ports for macOS security testing?

XPC exploitation targets IPC validation gaps and PID-reuse race concepts to influence privileged connections, while Mach port manipulation involves task and exception port techniques. Reviewing Mach IPC surfaces and MIG analysis helps identify likely weaknesses for security assessment.

Can I inject code into Electron apps using NODE_OPTIONS and RunAsNode on macOS?

Electron and Chromium injection surfaces target apps via RunAsNode, debugging protocol attachment, NODE_OPTIONS-style preload ideas, and fuse-based gating. Abuse pathways depend on the target's specific Electron runtime configuration and debugging surface exposure.

What are the limitations of macOS process injection when targeting system processes?

macOS process injection is constrained by Hardened Runtime, System Integrity Protection (SIP), and specific entitlements. System processes with strict SIP protections or hardened runtime configurations may resist dylib hijacking and Mach port manipulation, requiring alternative vectors like XPC exploitation.

Does macOS process injection work with apps that have strict entitlements and hardened runtime enabled?

Injection viability depends on matching the vector to the target's technical prerequisites. Hardened Runtime and entitlements restrict DYLD_INSERT_LIBRARIES and Mach port access, but XPC validation gaps or Electron fuse misconfigurations may still provide viable execution paths for security testing.