permit2-patterns

Solid

Detect Permit2 / EIP-2612 lifecycle bugs — signature lifecycle, allowance transfer vs signature transfer confusion, nonce reuse, deadline manipulation, witness-data misuse. Activate on `permit`, `permitTransferFrom`, `IPermit2`, `SignatureTransfer`, `AllowanceTransfer`, `PermitWitnessTransferFrom`, `PermitBatchTransferFrom`.

AI & Automation 38 stars 5 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 82/100

Stars 20%
53
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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...

Details

Author
iktok90-design
Repository
iktok90-design/ai-smart-contract-auditor
Created
1 weeks ago
Last Updated
2 days ago
Language
JavaScript
License
MIT

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category