← ClaudeAtlas

approval-issueslisted

Detect 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`.
iktok90-design/ai-smart-contract-auditor · ★ 37 · AI & Automation · score 80
Install: claude install-skill iktok90-design/ai-smart-contract-auditor
# Approval issues detection ## When this applies - Any `approve` / `safeApprove` / `forceApprove` site - `permit` (EIP-2612, DAI-style, Permit2) - Routers / aggregators that hold persistent approvals - Vaults that approve strategies to pull funds - Bridges / cross-chain approvers ## Detection patterns ### The classic ERC-20 approve race (HIGH) ```solidity 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`. ### Infinite approval to mutable contract (HIGH) ```solidity token.approve(router, type(uint256).max); // ← router is upgradeable, future impl can drain ``` Mitigate with allowance-per-action. ### Per-pull infinite approval (HIGH) Vault → strategy infinite approval; if strategy is upgradeable or has a bug, vault funds drainable. ### Permit2 sig stolen / replayed (HIGH) 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) ```solidity try IERC20Permit(token).permit(owner, spender, ...) {} catch {} token.transferFrom(owner, ...); // ← if permit fails, uses any stale allowance ``` Caller c