permit2-patternslisted
Install: claude install-skill iktok90-design/ai-smart-contract-auditor
# Permit2 / EIP-2612 detection
## Background
EIP-2612 (`permit`) — token-native gasless approval, per-token nonce.
Permit2 (Uniswap) — canonical contract bridging legacy ERC20s into the permit world; two APIs:
- **SignatureTransfer** — one-shot, sig consumed atomically.
- **AllowanceTransfer** — persistent allowance with nonce + expiration.
## When this applies
- Routers, swap aggregators, vaults using Permit2 / EIP-2612 for gasless approve flows
- Custom permit implementations
- Apps calling `IPermit2.permitTransferFrom`, `permitWitnessTransferFrom`, `permit`
## Detection patterns
### Permit2 `permitTransferFrom` without amount check (CRITICAL)
```solidity
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.
### Witness data ignored (HIGH)
`permitWitnessTransferFrom` includes a user-signed `witness` blob. App must validate it matches the intended action; otherwise sig can be reused with different context.
### SignatureTransfer vs AllowanceTransfer confusion (HIGH)
SignatureTransfer is one-shot. AllowanceTransfer is persistent with nonce + expiration. Mixing → over-approval or replay.
### Allowance not invalidated after one-shot use (HIGH)
Some implementations using AllowanceTransfer don't increment nonce after consumption.
### Missing deadline (HIGH)
Permit sigs