Community程式設計與開發github.com

yaklang/macos-process-injection

macOS 程序注入腳本。當您需要透過 dylib 劫持、DYLD 環境變數、XPC 利用、Mach 端口操作或 Electron/Chromium 濫用,將程式碼注入正在執行或啟動中的 macOS 程序時使用。

macos-process-injection 是什麼?

此技能提供了一套全面的 macOS 程序注入技術操作指南,專為需要在 macOS 上執行進階滲透測試或惡意軟體分析的開發者與安全研究人員設計。它涵蓋多種注入方法,包括 dylib 劫持、利用 DYLD_INSERT_LIBRARIES 等環境變數、XPC 服務漏洞利用、Mach 端口操作,以及針對 Electron 和 Chromium 應用程式的濫用技術。這些技術可用於程式碼注入、鉤取函數呼叫、繞過安全機制,或在目標程序上下文中執行任意有效負載。此技能主要支援 macOS 作業系統,並依賴於操作系統原生元件與架構。通過詳細的步驟說明與實例,使用者可以深入理解每種技術的攻擊面、實作細節與潛在風險,從而更有效地進行安全評估與防禦策略制定。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/yaklang/hack-skills/tree/main/skills/macos-process-injection

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

macos-process-injection 是做什麼的?

macOS 程序注入腳本。當您需要透過 dylib 劫持、DYLD 環境變數、XPC 利用、Mach 端口操作或 Electron/Chromium 濫用,將程式碼注入正在執行或啟動中的 macOS 程序時使用。

注入方法

1. Dylib 劫持

透過在程序的搜尋路徑中放置惡意的 dylib 來劫持動態庫載入。

# 範例:建立惡意 dylib 並取代原路徑
$ cp malicious.dylib /Applications/TargetApp.app/Contents/Frameworks/TargetLibrary.framework/Versions/A/TargetLibrary

2. DYLD 環境變數

使用 DYLD_INSERT_LIBRARIES 環境變數在程序啟動時注入程式碼。

# 範例:使用 dyld 插入注入
$ DYLD_INSERT_LIBRARIES=inject.dylib /path/to/target

3. XPC 利用

針對 XPC 服務進行漏洞利用,以執行任意程式碼。

  • 識別目標 XPC 服務
  • 分析其授權與輸入驗證
  • 透過惡意客戶端觸發損毀或執行

4. Mach 端口操作

使用 Mach 核心端口(例如 task_for_pid)進行程序間注入。

# 範例:使用 task_for_pid 取得目標任務端口
$ ./mach_inject <target_pid>

5. Electron/Chromium 利用

濫用 Electron 或 Chromium 應用程式的架構弱點來注入 JavaScript 或原生程式碼。

  • 修改應用程式的主進程或渲染器進程
  • 注入惡意擴充功能或外掛程式
  • 利用開發者工具或其他偵錯介面

注意事項

  • 在真實系統上操作前,請先在隔離環境中測試。
  • 某些方法需要 root 權限或特殊授權。
  • macOS 的 System Integrity Protection (SIP) 可能會阻擋某些注入技術。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

yaklang/401-403-bypass-techniques

401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.

yaklang/active-directory-acl-abuse

Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.

yaklang/active-directory-certificate-services

AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.

yaklang/active-directory-kerberos-attacks

Kerberos attack playbook for Active Directory. Use when targeting AD authentication via AS-REP roasting, Kerberoasting, golden/silver/diamond tickets, delegation abuse, or pass-the-ticket attacks.

yaklang/ai-ml-security

AI/ML security playbook. Use when assessing model supply chain attacks (pickle RCE, poisoned weights), adversarial examples, model poisoning, model stealing, data privacy attacks (membership inference, model inversion), and autonomous agent security risks.

yaklang/android-pentesting-tricks

Android pentesting playbook. Use when testing Android applications for SSL pinning bypass, exported component abuse, WebView vulnerabilities, intent redirection, root detection bypass, tapjacking, and backup extraction during authorized mobile security assessments.

yaklang/anti-debugging-techniques

Anti-debugging detection and bypass playbook. Use when reversing protected binaries that detect debuggers via ptrace, PEB flags, timing checks, or signal/exception handlers on Linux and Windows.

yaklang/api-auth-and-jwt-abuse

API authentication and JWT abuse playbook. Use when testing bearer tokens, API keys, claim trust, header spoofing, rate limits, and API auth boundary weaknesses.

yaklang/api-authorization-and-bola

API authorization and BOLA testing playbook. Use when APIs expose object identifiers, nested resources, hidden writable fields, or weak function-level authorization.

yaklang/api-recon-and-docs

API reconnaissance and documentation review playbook. Use when discovering endpoints, schemas, versions, OpenAPI specs, hidden docs, and surface area for API testing.

yaklang/api-sec

Entry P1 category router for API security. Use when choosing between API recon, authorization, token abuse, and hidden-parameter workflows before any deeper API topic skill.

yaklang/arbitrary-write-to-rce

Arbitrary write to RCE playbook. Use when you have an arbitrary write primitive (from heap exploitation, format string, or OOB write) and need to convert it into code execution by targeting GOT, hooks, _IO_FILE vtable, exit_funcs, TLS_dtor_list, modprobe_path, .fini_array, or C++ vtables.

yaklang/authbypass-authentication-flaws

Authentication bypass testing playbook. Use when assessing login flows, password reset logic, account recovery, MFA bypass, token predictability, brute-force resistance, and session boundary flaws.

yaklang/auth-sec

Entry P1 category router for authentication and authorization. Use when testing login flows, sessions, object authorization, JWT, OAuth, CORS, CSRF, and enterprise SSO weaknesses before any deeper auth topic skill.

yaklang/binary-protection-bypass

Binary protection bypass playbook. Use when identifying and bypassing ASLR, PIE, NX/DEP, stack canary, RELRO, FORTIFY_SOURCE, CET, and MTE protections in ELF binaries to enable exploitation.

yaklang/browser-exploitation-v8

Browser and V8 exploitation playbook. Use when exploiting JavaScript engine vulnerabilities including JIT type confusion, incorrect bounds elimination, and V8 sandbox bypass to achieve renderer RCE and sandbox escape in Chrome/Chromium.

yaklang/business-logic-vuln

Entry P1 category router for business logic testing. Use when workflow abuse, race conditions, pricing flaws, or multi-step state attacks matter more than parser-level input injection.

yaklang/business-logic-vulnerabilities

Business logic vulnerability playbook. Use when reasoning about workflows, race conditions, price manipulation, coupon abuse, state machines, and multi-step authorization gaps.

yaklang/classical-cipher-analysis

Classical cipher analysis playbook. Use when encountering substitution ciphers, Vigenere, transposition, XOR, or encoded text in CTF challenges that requires frequency analysis, Kasiski examination, or known-plaintext cryptanalysis.

yaklang/clickjacking

Clickjacking playbook. Use when testing whether target pages can be framed, whether X-Frame-Options or CSP frame-ancestors are properly configured, and whether UI redress attacks can trigger sensitive actions.

相關技能