Permit2 Explained in Detail
Permit2 is Uniswap's approval and signature transfer system. It lets users approve Permit2 once, then authorize token spends through structured signatures or managed allowances.
Auditors usually review the integration, not the Permit2 contract itself.
Smart contract example
A router may use Permit2 to pull tokens before executing a swap. The integration must bind the signature to the exact token, amount, owner, spender, recipient, deadline, and intended action.
If the protocol accepts a broad Permit2 approval but does not bind it to the expected swap, a malicious caller may redirect the spend.
Permit2 in Auditing
Permit2 concentrates approval power. A small integration mistake can make a user signature reusable or redirect tokens, so reviewers should treat it as both a signature and access control risk.
The key question is: does the signed intent match the action the contract actually performs?
Red flags in code
-
Permit2 spender is broader than necessary.
-
Recipient is caller-controlled or not included in the signed intent.
-
Token, amount, owner, or deadline is not checked against expected values.
-
witnessdata is missing when the action needs extra binding. -
Nonce handling assumptions are wrong.
-
Contract supports arbitrary Permit2 calls without a strict execution path.
-
UI or backend asks users for broad approvals when narrow signatures would work.
How to test or review it
-
Trace the full flow from user signature to token transfer.
-
Check who is approved as spender and who receives tokens.
-
Test replay, expired signatures, wrong token, wrong amount, wrong recipient, wrong caller, and reused nonce.
-
If
permitWitnessTransferFromis used, verify the witness includes the exact app-level action. -
Review EIP-712 and signature replay assumptions before trusting the integration.
-
Use the smart contract audit checklist to track spender, recipient, nonce, and deadline checks during review.
Keep learning this topic
EIP-712
EIP-712 is a standard for signing typed structured data so a signature is bound to a specific message type and domain.
Signature Replay
Signature replay happens when a valid signature can be reused more than once or reused in a different context than the signer intended.
Access Control Vulnerability
An access control vulnerability lets an unauthorized caller perform privileged actions such as moving funds, changing roles, upgrading contracts, or changing protocol settings.
Replay Attacks
See how this vulnerability appears in real smart contract audits.
Phishing Attacks
Phishing attacks targeting smart contract users and teams: common social-engineering vectors, wallet risks, and practical prevention controls.
Access Control Attacks
Access control attacks in Solidity: broken authorization patterns, privilege escalation paths, and secure role and ownership design.
Smart Contract Audit Checklist
Use this SCH tool to turn the concept into practical audit work.
Web3 Hacks Dashboard
Use this SCH tool to turn the concept into practical audit work.
Practice this in real audit scenarios
Definitions help, but auditors need reps. SCH turns concepts like Permit2 into exploit labs, code review habits, and report-writing practice.
Start the free trial or see the full smart contract auditing course.