/security-agent-skills:detecting-memory-safety-bugsfrom security-agent-skills
Finds use-after-free, double-free, out-of-bounds read/write, uninitialized use, and NULL deref bugs in C/C++ and other unmanaged code by reasoning about object lifetime and buffer bounds along real code paths.
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.
Temporal and spatial memory bugs are the ones a sink-based catalog usually doesn't model: there's no single "dangerous function" to grep - the bug is a relationship between a pointer's lifetime and its use, or between an index and a bound, spread across code paths. So you hunt them by reasoning about lifetime and bounds, not by matching a call. This skill covers the five workhorse classes and how to confirm each.
hunting-bugs-with-a-code-graph flags these as
out-of-catalog and sends you here).Authorized source only. If you can't name the authorization, stop.
For every candidate, the confirmation is a path: an allocation/definition site, the operation that changes its state, and the use - read the source at each.
Use-after-free (UAF). A pointer is used after its object is freed. Hunt:
for each free/delete/refcount-drop, ask what still holds this pointer and
can any path reach a use after this point - including aliases stored in
structs, callbacks, and error paths. Confirm: a live path free → … → deref with
no reassignment in between. Watch the classic shapes: free-in-a-loop then use,
free in an error branch then fallthrough use, and a cached pointer that
outlives the object.
Double-free. The same allocation freed twice. Hunt: two frees reachable in sequence on some path without a nulling/reassignment between them; ownership handed to a callee that also frees; error paths that free then fall into a cleanup that frees again. Confirm: both frees hit the same object on one path.
Out-of-bounds read/write. An index or pointer crosses a buffer's bound.
Hunt: every buffer access where the index/length is attacker-influenced or
derived from a separate field (length prefixes are a hotspot). Confirm: trace
the index/length source and the buffer's true size; the bug is any path where
index/len can exceed size - off-by-one at <= size, unchecked memcpy
length, integer-truncated length, signed/unsigned confusion at the check.
Uninitialized use. A value is read before it's written. Hunt: stack structs
and locals used on a path that skipped their initialization (an early goto,
an error branch, a partially-filled struct). Confirm: a path from declaration
to use with no write on that path.
NULL / invalid-pointer deref. A pointer that can be NULL (or an error sentinel) is dereferenced without a check. Hunt: allocation and lookup returns that can fail; dereferences of a parameter documented as nullable. Confirm: a path where the returning call can yield NULL and the deref has no guard between.
Overflow is rarely the final bug - it's the step that produces a bad
length/index/size. Treat a * b, a + b, and truncating casts on
attacker-influenced sizes as candidates because they flow into an allocation or
a bound. Trace overflow → size/index → memory op; report the memory bug with the
overflow as its cause.
UAF via error path. In
parse_record:rec = alloc(); if (read(rec) < 0) { free(rec); } … use(rec->field);- thefreeis in the error branch but the function falls through touse(rec->field)without returning. Path: alloc → free (error branch) → deref (fallthrough). Confirmed UAF;reachable = conditional(read returns < 0); impact = attacker-triggered malformed record frees then dereferences. Remediation:returnafter the free, or restructure cleanup with a single exit.
You need to follow a pointer's aliases and a value's flow across functions, and
read the exact body at each site. A code property graph with points-to/alias
information makes "what else holds this pointer" answerable; a memory-safety
static analyzer (or the compiler's sanitizers on targeted inputs) corroborates;
manual path reading closes it. Confirm every class as a concrete path, then emit
per the finding schema with the alloc/free/use hops in
path.
adjudicating-taint-paths - for the attacker-input side (who controls the
length/index).hunting-bugs-with-a-code-graph - the master loop that routes these here.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
memory-safety, c-cpp, use-after-free, buffer-overflow, static-analysis
194 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./auditing-account-abstraction-and-paymaster-trustAudit an ERC-4337 account-abstraction deployment for trust misplaced in the user-operation lifecycle: a smart account whose validation accepts a signature or nonce it should reject, a paymaster that agrees to sponsor gas for operations it should not so an attacker drains its deposit, a bundler or entry-point assumption that lets a user operation be replayed or reordered for gain, and validation logic that reads mutable state or reaches outside its allowed scope. Covers smart-contract wallets, paymasters, bundlers, and the entry point in an account-abstraction stack where a user operation is validated and sponsored before it executes. Use when a user operation is validated, paid for, and executed by separate parties and that trust split is the boundary. The crafted user operation is the source, the drained paymaster or unauthorized execution is the sink, and the over-permissive validation or sponsorship rule is the bug./auditing-account-recovery-and-reset-trustAudit password reset and account recovery flows for the trust that lets an attacker take over an account: a reset token that is guessable, long-lived, reusable, or not bound to the account it was issued for, a recovery path that verifies a weaker factor than login and bypasses multi-factor, a reset link whose host comes from an attacker-controllable header so the token leaks, and a recovery that trusts an unverified email or phone change to redirect the reset. Covers the recovery surface of authentication systems, where resetting a credential or recovering access is the alternate door into an account. Use when an application offers password reset or account recovery and that flow is a path to authentication. The attacker-driven recovery request is the source, the account it takes over is the sink, and the weak token, bypassed factor, or leaked reset link that grants it is the bug./auditing-admission-control-policy-gapsAudit cluster admission control for gaps that let a non-compliant or hostile workload through: a validating webhook that fails open when its backend is unreachable, a policy that scopes by namespace or label and misses the namespaces that matter, a mutating webhook whose changes are trusted downstream, and an ordering or exemption that lets a privileged pod bypass the checks meant to stop it. Covers Kubernetes admission webhooks and policy engines that are supposed to enforce workload security at create and update time. Use when admission policies are the control that keeps privileged, unsigned, or over-permissioned workloads out of the cluster. The workload submitted for admission is the source, the admitted resource is the sink, and the policy gap that let it through is the bug./auditing-ai-agent-permissionsAudit what an AI agent is actually allowed to do versus what its task needs. Covers excessive agency (tools, scopes, and autonomy beyond the job), missing human-in-the-loop gates on irreversible actions, over-broad credentials and their blast radius, sandbox and code-interpreter escape, unfiltered egress, and unbounded resource or spend (denial-of-wallet). Use when granting an agent a tool or scope, reviewing an agent's permission posture, or deciding which actions need approval. The model's restraint is not a control; permissions are.npx claudepluginhub unboundcompute/security-agent-skills --plugin security-agent-skillsOther plugins' skills for the same job