/auditsentry:approval-issuesfrom auditsentry
Detects ERC-20 approval vulnerabilities in Solidity: approve race, infinite approvals, Permit2 misuse, and lingering allowances. Activates on approve/safeApprove/permit calls.
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.
approve / safeApprove / forceApprove sitepermit (EIP-2612, DAI-style, Permit2)token.approve(spender, X); // later
token.approve(spender, Y); // ← spender can front-run and drain X+Y
Use forceApprove(spender, Y) (OZ ≥4.9), or decreaseAllowance / increaseAllowance, or zero-first.
approve instead of safeApprove on non-standard tokens (HIGH)USDT requires approve-to-zero before approve-to-X. Use OZ forceApprove.
token.approve(router, type(uint256).max); // ← router is upgradeable, future impl can drain
Mitigate with allowance-per-action.
Vault → strategy infinite approval; if strategy is upgradeable or has a bug, vault funds drainable.
Permit2 signatures are bearer instruments — anyone with the sig can transfer. If the signed payload is logged or leaked, funds are drainable until the nonce is invalidated. Add a deadline.
permit then ignore failure (MEDIUM)try IERC20Permit(token).permit(owner, spender, ...) {} catch {}
token.transferFrom(owner, ...); // ← if permit fails, uses any stale allowance
Caller can grief by front-running permit. Acceptable IFF you then check the allowance is sufficient.
Some tokens treat approve(0, x) as a no-op or revert. Use the documented revoke method.
token.safeApprove(target, amount);
target.swap(...);
// ← allowance lingers; if `amount` was max, target keeps power
Set to 0 after each action, or use a single-tx wrapper.
Deployer can deploy attacker-controlled implementation that consumes the approval.
| Pattern | Severity |
|---|---|
| Persistent infinite approval to upgradeable router | High |
Approve race ignored, no forceApprove / increaseAllowance | High |
| USDT-style approve without zero-reset | High |
| Vault → strategy infinite allowance with mutable strategy | High |
| Permit2 with no deadline | High |
| Permit failure swallowed, allowance not re-checked | Medium |
| Lingering allowance after one-shot router action | High |
forceApprove for setting; safeIncreaseAllowance for top-ups.safeApprove(target, 0) to reset.approve returning bool always-true is well-known and safe.What SKILL.md sets; muted values are Claude Code's defaults
45 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./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./centralization-riskDetect centralization and trust-assumption risks — admin powers, single-key risk, missing timelocks, upgrade authority, treasury keys, pause permanence, blacklisting authority, oracle authority. Activate on `onlyOwner`, `onlyRole`, `AccessControl`, upgrade authorizations, pause/unpause functions, mint/burn caps, treasury/fee setters./confidence-scoringAlways-on meta-skill — for every finding produced, attach a confidence level (HIGH/MEDIUM/LOW) and a reasoning trace. Activate on every /audit, /audit-deep, /audit-changes, /audit-live, /quick-scan invocation./cosmwasmDetect bug classes specific to CosmWasm (Rust) contracts — missing info.sender authorization in execute handlers, unbounded map iteration → gas/DoS, reply/submessage reply_id confusion, migrate admin backdoors, addr_validate vs raw string addresses, unchecked info.funds, Uint128 overflow, query reentrancy, and migration/version state. Activate on any `.rs` file with `use cosmwasm_std`, `#[entry_point]`, `ExecuteMsg`, `InstantiateMsg`, `QueryMsg`, `cw_storage_plus`, or `DepsMut`./cross-chain-messagingDetect cross-chain messaging bugs — replay protection gaps, untrusted-remote acceptance, default-config inheritance, validator-set misconfig, force-include vulnerabilities, chainId / domain-separator omissions. Activate on `_lzReceive`, `ccipReceive`, `handle` (Hyperlane), `receiveMessage`, `verifyVAA`, IRouterClient, IMailbox, EndpointV2, OApp/OFT, LayerZero / CCIP / Hyperlane / Wormhole / Axelar / Polyhedra integration code.npx claudepluginhub iktok90-design/ai-smart-contract-auditor --plugin auditsentryOther plugins' skills for the same job