/auditsentry:reentrancyfrom auditsentry
Detects reentrancy vulnerabilities in Solidity/Vyper: classic, cross-function, cross-contract, and read-only reentrancy. Analyzes external calls, ERC hooks, and view-function stale state reads.
Ships in auditsentry. 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.
Trigger on any of:
call, delegatecall, staticcall, transfer, sendsafeTransferFrom / onERC721Received / onERC1155Received callbackstokensReceived / tokensToSend hooksfunction withdraw() external {
uint256 amt = balance[msg.sender];
(bool ok,) = msg.sender.call{value: amt}(""); // ← external call
require(ok);
balance[msg.sender] = 0; // ← state update AFTER call
}
Signal: state mutation after external call. CEI (Checks-Effects-Interactions) violated.
Two functions sharing state where one calls externally and the other reads/mutates the same state. Attacker re-enters via the second function.
Contract A updates state, calls B; B calls back into a different contract C that reads A's stale state.
Victim contract reads getReserves() / getPrice() from a pool mid-callback, before the pool finalizes its state. Example: Curve pools, Balancer vaults, Uniswap V2 mid-removeLiquidity.
// Pool callback hits this view function before pool state is consistent.
function priceOf(address token) external view returns (uint256) {
return pool.getVirtualPrice(); // ← stale during reentrant call
}
_safeTransfer calls onERC721Received on the recipient — if recipient is a contract, it can re-enter.
| Pattern | Severity | Notes |
|---|---|---|
| Funds-draining classic reentrancy | Critical | Direct loss of funds, no preconditions |
| Cross-function with shared balance state | High | Requires specific call sequence |
| Read-only reentrancy on price/oracle read | High | Common pattern, often missed |
Reentrancy gated by onlyOwner / trusted role | Medium | Centralization-bounded |
| ERC-777 hook with no state-after-call writes | Low | Defense-in-depth issue |
| Single-actor self-reentrancy with no value flow | Info |
nonReentrant modifier (ReentrancyGuard from OpenZeppelin). Add per-function.withdraw_admin_fees lock, Balancer's ensureNotInVaultContext.nonReentrant from a known-good library and only calls trusted contracts is generally safe — note it but don't flag as Critical.transfer (2300 gas) blocks classic reentrancy but is brittle on L2s with higher base gas costs — flag as a separate issue, not as reentrancy resolved.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub iktok90-design/ai-smart-contract-auditor --plugin auditsentry45 skills in this plugin
/access-controlDetect missing or incorrect access control — missing modifiers, wrong role checks, privileged function exposure, public initializers, and role-escalation paths. Activate on any function that mutates state, transfers funds, mints tokens, sets admin parameters, upgrades implementations, or pauses/unpauses./approval-issuesDetect ERC-20 approval pitfalls — approve race (front-run), missing safeApprove, infinite approvals, approval-without-revoke, Permit2 misuse, max-approval to untrusted contracts. Activate on `approve`, `safeApprove`, `permit`, `forceApprove`, `Permit2`, `IERC20.allowance`./caching-and-incrementalAlways-on meta-skill — cache audit results per file by content hash so unchanged files aren't re-analyzed on subsequent runs. Activate on every /audit, /quick-scan, /audit-changes invocation.Other plugins' skills for the same job