/security-agent-skills:hunting-setuid-and-capability-escalationfrom security-agent-skills
Audits hosts, images, or packages for local privilege escalation via setuid/setgid binaries and file capabilities. Enumerates carriers of elevated identity, classifies exposed primitives (exec, file read/write, library load), and traces attacker-controlled input.
Ships in security-agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A program that runs as a more privileged identity is only safe if it does exactly one narrow thing and exposes no way to turn that privilege into an arbitrary action. The bug is the pairing: an elevated identity (the setuid or setgid bit, or a file capability) next to a reachable primitive (spawn a shell or command, read or write a file, load a library) that an unprivileged user can steer. You find it by enumerating everything that carries elevated identity on the host, and for each asking what an unprivileged caller can make it do as that identity.
Audit local privilege escalation only on hosts or images you own or are authorized to test, with an unprivileged account you may escalate from. If you can't name the authorization, stop.
Enumerate every carrier of elevated identity. Inventory all setuid and setgid binaries and all files granted a capability, across the whole filesystem including mounted images and package payloads. Note the owning identity each escalates to and the specific capability granted (changing user id, overriding file-permission checks, raw disk or memory access, module loading, binding low ports). This inventory is the whole attack surface; do not scope it to a guessed shortlist.
Classify each by the primitive it exposes. For each carrier, determine what an unprivileged caller can drive it to do as the elevated identity: run a shell or an arbitrary command, read a file it chooses, write a file it chooses, load a library, or only a single fixed action with no attacker-influenced input. A carrier with an exec, read, write, or library-load primitive is the lead; one with none is likely fine.
Trace the primitive to attacker input. Follow the exposed primitive to what the caller controls: an argument, an environment variable, a config or data file it reads, a subprocess it launches by an unqualified name resolved through the caller's path, or a library it loads from a writable directory. The escalation is real only where caller input reaches the primitive; establish that hop, do not assume it.
Judge the capability as privilege, not a lesser grant. A capability that overrides file-permission checks reads and writes any file; one that gives raw disk or memory access, or loads modules, is root by another route. Treat these as full privilege on the binary that holds them, and check whether the binary confines them to its one purpose or lets a caller redirect them at an arbitrary target.
Check the custom and bundled carriers hardest. A stock system tool with the bit set is a known quantity; a vendor helper or an in-house setuid program is where the unsafe subprocess, the trusted writable path, the format-string, or the missing argument check lives. Read these as privileged code handling untrusted input, because that is what they are.
Confirm and record. Confirm by escalating on a test host: drive the primitive to run a command, read a protected file, or write one as the elevated identity. Kill the lead if every carrier is a single-purpose program with no attacker-reachable exec, read, write, or library-load, and every capability is confined to that purpose. Record with the exact binary or capability, the primitive, and the input path that reached it.
Confirm. A vendor-bundled setuid helper runs a maintenance step by invoking a compression tool by its short name, relying on the caller's path to find it. An unprivileged user prepends a writable directory holding a program of that name; the helper executes it as the owning privileged identity. Confirmed setuid-to-command escalation via unqualified subprocess and caller-controlled path,
high, remediation = invoke the subprocess by absolute path with a sanitized environment, or drop the setuid bit and gate the action behind an authenticated service.Kill. Every setuid and setgid binary is a stock single-purpose tool with no shell-out, no file argument the caller controls, and no honored path or loader variable; the two files with capabilities hold a low-port-bind grant confined to a fixed listener, not a file-override or raw-access capability. Escalation attempts through each primitive fail. Killed,
kill_reason= "no carrier exposes an attacker-reachable exec, read, write, or library-load; capabilities confined to a single non-file-override purpose."
You need a full filesystem inventory of setuid and setgid binaries and capability-bearing files across the host and any base image, the ability to read each carrier's behavior (which primitive it exposes and what input reaches it), and an unprivileged test account to confirm. A view that lists every privileged binary and traces its exec, file, and library operations to caller-controlled input turns this into a coverage pass over the whole carrier set; the identity-plus-primitive question is the method by hand.
hunting-scheduled-job-and-search-path-hijacks - the other local-escalation surface:
privileged jobs and the writable paths and globbed arguments they trust.hunting-dynamic-linker-hijacks - the library-load primitive in depth, through the loader's
search path and preload behavior.auditing-guard-gaps - the unguarded-peer pattern, here the setuid program that skips a
check its safer sibling applies.detecting-memory-safety-bugs - a memory-corruption primitive inside a setuid binary is a
direct escalation; pair the two.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
privilege-escalation, setuid, setgid, linux-capabilities, security-audit
npx claudepluginhub unboundcompute/security-agent-skills --plugin security-agent-skills194 skills in this plugin
/adjudicating-dependency-cve-reachabilityDecide whether a CVE in a dependency actually exposes your application before you scramble to patch: is the vulnerable function on a real call path from your code, do the trigger preconditions hold, and can an attacker control the input that reaches it. Use when an advisory, SCA scan, or dependency bot flags a CVE and you must separate a genuine exposure from unreachable noise, or justify why you are or are not affected. Covers pinning the vulnerable symbol, call-path reachability, precondition checks, and taint from your entry points./adjudicating-taint-pathsDecide whether a whitebox lead is a real bug by tracing taint from an untrusted source to a dangerous sink and confirming every hop against live source. Use after a scanner, a candidate list, or your own reading surfaces a "this looks dangerous" sink (SQL exec, system/exec, file open, deserialize, template render, redirect target, memcpy) and you must decide whether attacker- controlled input actually reaches it - or kill the lead with evidence. Covers forward and reverse taint, witness paths, sanitizer analysis, and the evidence rules that separate a finding from a false positive.Other plugins' skills for the same job