dylib-hijack-scan

dylib-hijack-scan is a skill for Claude Code, Codex from forefy/.context. It costs 42 tokens per session (1,337 once invoked), scanned A, original, MIT.

A macOS scanner for dynamic-library hijacking, where an application may load an attacker-controlled library from a writable location. It examines Mach-O binaries and distinguishes ordinary code execution from privilege escalation.

In plain words
What is it for?
Use it to inspect one application or sweep a Mac for weak-library and runtime-search-path issues, including the load command, writable location, writer, and mitigation.
Why use it?
It explains why each suspected issue exists and separates genuinely dangerous cases from harmless ones. It only reads and reports; it does not change files or install libraries.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect one application or sweep a Mac for weak-library and runtime-search-path issues, including the load command, writable location, writer, and mitigation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/forefy/.context/dylib-hijack-scan
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add forefy/.context --skill dylib-hijack-scan
Clone the repo
git clone --depth 1 https://github.com/forefy/.context

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dylib-hijack-scan

README.md
[![agentmods](https://agentmods.dev/badge/skills/forefy/.context/dylib-hijack-scan/github.svg)](https://agentmods.dev/skills/forefy/.context/dylib-hijack-scan)
Your own site
<a href="https://agentmods.dev/skills/forefy/.context/dylib-hijack-scan"><img src="https://agentmods.dev/badge/skills/forefy/.context/dylib-hijack-scan/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dylib-hijack-scan

Your own site · 80×15
<a href="https://agentmods.dev/skills/forefy/.context/dylib-hijack-scan"><img src="https://agentmods.dev/badge/skills/forefy/.context/dylib-hijack-scan.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,337 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00042 $0.01337
Opus 5.5 $0.00017 $0.00535
Sonnet 5.5 $0.00008 $0.00267
Haiku 4.5 $0.00004 $0.00134

Measured 2mo ago against content hash 782af97d2f23, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

dylib-hijack-scan scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/build_report.py, scripts/scan.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/defensive/dylib-hijack-scan/SKILL.md · 72 lines

How it starts

The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Dylib Hijack Scan

Identity

macOS dylib-hijacking auditor. Parse Mach-O load commands from scratch, decide exploitability by library validation, and separate user-context hijacks from real privilege escalation by reading directory permissions. Read/query only - never plant, modify, or delete. Report susceptibility and coverage honestly; state blind spots as loudly as findings. Ambiguous slot is not a finding.


When to use

Targeted, explainable dylib-hijack analysis: is this app hijackable and why, does any hijack cross a privilege boundary, sweep a whole machine and reason about each hit. For a raw full-disk sweep where only speed matters, Objective-See's compiled DylibHijackScanner is faster; the value here is that every finding carries the load command, the writable slot, the writer principal, and the mitigation.

The two vulnerability classes

  1. Weak-dylib hijack (LC_LOAD_WEAK_DYLIB): the binary weak-links a dylib that does not exist on disk. Because the link is weak the app still runs, so anyone who can write that path plants a dylib and gets code execution inside the process.
  2. Rpath-order hijack (@rpath/... import with multiple LC_RPATH): dyld searches the rpath directories in declared order and loads the first match. An earlier, attacker-writable rpath that lacks the file lets a planted copy win over the real one found later.

The mitigation that decides exploitability

Library validation. Under the hardened runtime, absent the com.apple.security.cs.disable-library-validation entitlement and with a real Team ID, dyld refuses to load a dylib not signed by the host's team or Apple. A plantable slot on such a host is not practically exploitable. Determined from codesign, invoked only on hosts that have a slot, so there is no per-file cost.

Elevation: ordinary hijack vs privilege escalation

The axis that matters is whether a principal who can write the slot is less privileged than the one who loads it.

  • Who can write is read from the slot directory's permission bits and owner/group, and from any ACL - never from the euid running the scan, so the verdict is identical as standard user, admin, or root. Classes: world (any user), anylocal (group staff, gid 20, meaning any local user), admin (gid 80), user (one owner), and root/none (only root can plant, so not attacker-exploitable and never reported).
  • Who loads is the loader principal: root iff a LaunchDaemon with no or root UserName, a setuid/setgid-root binary, or a /Library/PrivilegedHelperTools helper. A normal app runs as whoever launches it.
  • Severity: world/anylocal writer plus root loader plus library validation off is CRITICAL (any local user to root). admin/user writer plus root loader is HIGH elevation. Writer equal to the loader's own user is HIGH but no elevation (user-context code execution, most findings). Library validation on is LOW.

Read the full file on GitHub · 72 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago Changed · +1 lines 782af97d2f23
  2. 3mo ago First seen · 71 lines · 42 tokens per session scan A e44b0e2e6bdb

Subscribe to this mod's changes

dylib-hijack-scan is a skill published in the GitHub repository forefy/.context (156 stars, last pushed yesterday), licensed MIT. It adds 42 tokens to every session and 1,337 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

dylib-hijack-scan compared with skills from other repositories

dylib-hijack-scan next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
dylib-hijack-scanforefy/.contextSkill156yesterdayMITA42Claude Code, Codex
eresus-manual-security-auditEresusSecurity/appsec-skillsSkill77mo agoApache-2.0A145Claude Code, Codex
eresus-php-auditEresusSecurity/appsec-skillsSkill77mo agoApache-2.0A92Claude Code, Codex
eresus-sast-scannerEresusSecurity/appsec-skillsSkill77mo agoApache-2.0A100Claude Code, Codex
eresus-python-auditEresusSecurity/appsec-skillsSkill77mo agoApache-2.0A101Claude Code, Codex
eresus-remediatorEresusSecurity/appsec-skillsSkill77mo agoApache-2.0A84Claude Code, Codex
eresus-variant-analysisEresusSecurity/appsec-skillsSkill77mo agoApache-2.0A85Claude Code, Codex