/security-agent-skills:hunting-smart-contract-reentrancyfrom security-agent-skills
Hunts smart contracts for reentrancy bugs where state is mutated after an external call, covering single-function, cross-function, callback-hook, and read-only variants. Use when the fix is reordering effects before interactions or adding a mutex.
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.
Reentrancy is a control-flow bug: a contract makes an external call before it finishes updating its own state, and the callee, which the attacker controls, calls back in and finds the old state still in place. The classic shape is sending value before zeroing a balance, but it generalizes to any effect that lands after an interaction, across functions that share state and through callback hooks that hand the attacker control mid-update. This is a crowded topic, so the value is not naming the pattern but killing the lead that a guard or an already-updated state defeats. The dividing line from access control: if the fix is to reorder effects before interactions or add a mutex, it is reentrancy and belongs here; if the fix is to add or repair an authorization check, it belongs in the access-control skill.
Analyze only contracts you own or are authorized to assess, and exercise a reentrancy path only on a test network or a local fork, never against live value, an exploit here moves real funds irreversibly. Prove it against a fork. If you can't name the authorization, stop.
Map external calls against state updates first. For each function, find every external call (a value transfer, a token call, a call to a supplied address) and every state update the function and its siblings depend on, and record which comes first. Reentrancy exists only where an effect lands after an interaction; establish that ordering before anything else.
Check single-function reentrancy. Look for a function that performs an external call before updating the state that call's safety depends on, the withdraw-before-zeroing shape, so a re-entrant call sees the pre-update balance and repeats the withdrawal.
Check cross-function reentrancy. Look for a callback that re-enters a different function sharing the same state, where the first function has not yet committed its update, so the second acts on stale shared state even though neither function alone reorders its own effects.
Check callback hooks. Look for a token receive hook, a fallback, or any callback the contract invokes that hands control to attacker code in the middle of a state change, including standard token hooks that call the recipient before the sender's accounting settles.
Check read-only reentrancy. Look for a view function another contract trusts (a price, a share value, a balance) that returns mid-transaction state during a callback, so an integrating contract reads an inconsistent value even though this contract never writes during the re-entrant call.
Confirm and record. Confirm by showing a re-entrant call acts on stale state and gains value or breaks an invariant. Kill the lead if the function follows checks-effects-interactions so the state is already updated before the external call, if a reentrancy guard (a mutex modifier) protects the function and every sibling that shares the state, if the external call target is trusted and cannot re-enter (a fixed, known, non-attacker contract), if the call transfers no control (a low-level send with no code at the target, a pull pattern with no callback), or if the state read during a view is not relied on cross-contract. Record the function, the call-before-effect ordering, and the re-entry path.
Confirm. A withdraw function sends the caller their balance with an external value transfer, then sets their balance to zero; the recipient is a contract whose fallback calls withdraw again, and the second call sees the original non-zero balance and withdraws once more, draining the contract. Confirmed single-function reentrancy from interaction-before-effects,
critical, remediation = zero the balance before the transfer (effects before interactions) and add a reentrancy guard.Kill. A withdraw function updates the balance to zero first and only then transfers value, and the function carries a reentrancy guard shared by every sibling that touches the balance. A re-entrant call finds the balance already zero and the guard engaged. Killed,
kill_reason= "the function follows checks-effects-interactions and is guarded across all siblings, so re-entry acts on already-updated state."
You need the functions and their external calls, the state each function and its siblings depend on and when it is updated, the callback hooks the contract invokes, any reentrancy guard and which functions it covers, and the views other contracts trust. For each function, decide whether an effect lands after an interaction an attacker can re-enter. Reading the call order tells you where the window is; tracing the re-entry across siblings and hooks tells you whether it is reachable.
auditing-smart-contract-access-control - the split partner: if the fix is to add or repair an
authorization check rather than reorder effects or add a mutex, adjudicate it there, not here.hunting-defi-economic-and-oracle-flaws - the economic-invariant sibling; a read-only reentrancy that
feeds a manipulated value into a pricing decision hands off to that skill.detecting-race-conditions - the general concurrency analogue; reentrancy is the on-chain form of acting
on state between a read and its commit.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
reentrancy, smart-contract-security, solidity, evm, auditing
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