/auditsentry:permit2-patternsfrom auditsentry
Detects Permit2 / EIP-2612 lifecycle bugs in Solidity smart contracts: signature replay, allowance vs signature transfer confusion, nonce reuse, deadline manipulation, and witness-data misuse.
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.
EIP-2612 (permit) — token-native gasless approval, per-token nonce.
Permit2 (Uniswap) — canonical contract bridging legacy ERC20s into the permit world; two APIs:
IPermit2.permitTransferFrom, permitWitnessTransferFrom, permitpermitTransferFrom without amount check (CRITICAL)permit2.permitTransferFrom(permit, transferDetails, owner, signature);
// uses `transferDetails.requestedAmount` — caller-controlled
Caller can request permit.permitted.amount (the max), regardless of intent. App must enforce the actual transfer amount.
permitWitnessTransferFrom includes a user-signed witness blob. App must validate it matches the intended action; otherwise sig can be reused with different context.
SignatureTransfer is one-shot. AllowanceTransfer is persistent with nonce + expiration. Mixing → over-approval or replay.
Some implementations using AllowanceTransfer don't increment nonce after consumption.
Permit sigs without deadline are bearer instruments forever.
try IERC20Permit(token).permit(...) {} catch {}
token.transferFrom(...); // ← if permit fails, falls back to stale allowance
Acceptable IFF the app then validates allowance is sufficient.
Submitting permit in one tx then transferFrom in another lets a searcher front-run the permit and grief.
Some EIP-2612 impls cache DOMAIN_SEPARATOR in constructor. Post-chain-fork, this is wrong. Re-derive based on block.chainid. See [[signature-replay]].
DAI uses a non-standard permit signature (allowed-bool, no amount). Apps that hit DAI with standard EIP-2612 ABI will revert.
USDC uses transferWithAuthorization / receiveWithAuthorization instead of permit on most chains. Apps assuming permit-on-USDC break.
Custom permit impls that use a global nonce instead of per-signer nonce → cross-signer collision.
Permit2 uses a bitmap for nonces (word index + bit). Custom forks sometimes simplify this and break.
| Pattern | Severity |
|---|---|
permitTransferFrom with caller-controlled requestedAmount | Critical |
| AllowanceTransfer not invalidating nonce on one-shot use | High |
| Sig without deadline | High |
| Cached DOMAIN_SEPARATOR not fork-aware | High |
| Witness ignored in permitWitnessTransferFrom | High |
| Failed permit swallowed, allowance not re-checked | Medium |
| Permit + tx unbundled (MEV grief) | Medium |
| DAI/USDC-specific sig variant mishandled | High |
| Global nonce instead of per-signer | High |
transferDetails.requestedAmount <= permit.permitted.amount AND matches intent.permit + consuming op in one tx.DOMAIN_SEPARATOR when chainId changes.IERC20Permit.permit(...) directly and don't trust the result are typically fine.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