Erc721 Erc1155 Eip712 Permit Security
Uniswap Permit2 Security Audit: AllowanceTransfer vs SignatureTransfer & Witness Phishing
Deploying at canonical address 0x000000000022D473030F116dDEE9F6B43aC78BA3 across 30+ EVM chains, Permit2 unifies gasless approvals while creating a high-value phishing target.

Over 75% of legacy ERC-20 contracts (USDT, WETH9, BNB, LINK) predate EIP-2612 and lack native permit functions—historically forcing DEX swappers to broadcast an expensive approve(router, type(uint256).max) transaction to every new router version! Uniswap's immutable Permit2 singleton (0x000000000022D473030F116dDEE9F6B43aC78BA3) solves this permanently: once a wallet grants a one-time ERC-20 approval to Permit2, any integrated protocol—from the Uniswap v4 singleton to multi-chain DEXs in our marketplaces directory like 9mm Pro and Astroport—can request gasless EIP-712 approvals!
Yet as highlighted in our EIP-712, Permit2 & proxy security master guide, concentrating universal ERC-20 allowances inside Permit2 means a single phished off-chain PermitBatch signature lets a drainer contract sweep multiple pre-approved tokens in one transaction without the victim paying gas!
Two Distinct Modules Inside Permit2: AllowanceTransfer vs SignatureTransfer#
Auditors and institutional wallet policy engines strictly separate Permit2's two inheritance modules, which carry radically different post-signature blast radii:
AllowanceTransfer(Persistent Packeduint160Sub-Allowances): Packs(uint160 amount, uint48 expiration, uint48 nonce)into a single 256-bit storage slot per(owner, token, spender). SigningPermitSingleorPermitBatchsets a persistent allowance onPermit2untilexpiration—meaning ifspenderis a malicious EOA or upgradeable contract, it can drain up toamountrepeatedly untilexpiration!SignatureTransfer(Zero-Storage One-Time Execution + Unordered Bitmap Nonces): Stores zero persistent spender allowance! Instead,permitTransferFromverifies the signature, flips 1 bit insidenonceBitmap[owner][wordPos](256 independent parallel nonces per storage word!), transfers at mostpermitted.amountinside that single transaction, and permanently consumes the signature!
Why Protocol Routers MUST Use permitWitnessTransferFrom!#
Suppose an aggregator router deploys swapWithPermit2(PermitTransferFrom permit, bytes sig, address recipient, uint256 minOut) using basic permitTransferFrom without a Witness! Watch the fatal Frontrun Griefing / Theft Bug:
- Alice signs a
PermitTransferFromnamingspender = AggregatorRouterfor100,000 USDCand submitsswapWithPermit2(..., recipient = Alice)to the public mempool. - Because
recipientandminOutwere NOT hashed inside Alice's Permit2 signature, an MEV bot extracts Alice's(permit, sig)from the mempool and frontrunsAggregatorRouter.swapWithPermit2(permit, sig, recipient = Attacker, minOut = 0)!msg.senderinsidePermit2is stillAggregatorRouter, soPermit2happily transfers Alice's100,000 USDCand sends the output straight to the Attacker!
Mandatory Audit Rule: Any shared router or Reactor accepting user-supplied Permit2 signatures must call permitWitnessTransferFrom, passing witness = keccak256(abi.encode(ORDER_TYPEHASH, recipient, outToken, minOut, ...)) so Permit2 verifies recipient inside the user's ECDSA signature!
Security Comparison: ERC-20 approve vs EIP-2612 vs Permit2 Modes#
| Approval Mechanism | Works on Legacy USDT / WETH? | Post-Swap Lingering Risk | Frontrun Parameter Binding | Emergency Revocation |
|---|---|---|---|---|
Legacy ERC-20 approve(MAX) | Yes (Requires separate gas tx) | 100% Balance forever | None | Per-token approve(spender, 0) |
| EIP-2612 `permit` | No (~25% of tokens supported) | High if value = MAX signed | None (Spender not bound to order!) | Per-token approve(spender, 0) |
Permit2 AllowanceTransfer | 100% ERC-20s (post 1x setup) | Bounded by uint48 expiration | Spender-only (Dangerous if EOA!) | 1-tx Permit2.lockdown |
Permit2 WitnessTransfer | 100% ERC-20s (post 1x setup) | 0.00% (Consumed instantly) | 100% Cryptographically Bound! | invalidateUnorderedNonces |
Bitwise Unordered Nonce Bitmap Math & lockdown Recovery#
How does Permit2 pack 256 independent nonces into a single storage slot so a user can sign 10 open limit orders concurrently without sequential head-of-line blocking?
- Given uint256 nonce:
- wordPos = uint248(nonce >> 8) [Upper 248 bits select storage mapping key]
- bitPos = uint8(nonce & 0xff) [Lower 8 bits select bit index 0..255 inside word]
- bitMask = (1 << bitPos)
- Atomic Replay Check + Update (1 Cold/Warm SSTORE):
- oldWord = nonceBitmap[owner][wordPos]
- flipped = oldWord ^ bitMask [XOR toggles target bit]
- require(flipped & bitMask != 0, "InvalidNonce") [Reverts if bit was ALREADY 1!]
- nonceBitmap[owner][wordPos] = flipped
- Worked Wallet Incident Response (User suspects 5 open off-chain limit signatures leaked on Word 0):
- Instead of 5 separate cancel transactions, user calls Permit2.invalidateUnorderedNonces(0, type(uint256).max)
- => Sets all 256 bits of Word 0 to 1 in ONE ~24,500-gas tx (plus lockdown([TokenSpenderPair]) to zero AllowanceTransfer)!
Wallet Firewalls Against Permit2 Phishing Kits (Inferno / Pink Drainer)#
Modern institutional wallets and browser extensions block 99% of Permit2 drainer kits by checking eth_getCode(spender): legitimate DeFi protocols never set an Externally Owned Account (EOA, code.length == 0) as Permit2.spender! Compare classic ERC-20 permit quirks next in EIP-2612 deadline & ecrecover malleability risks and EIP-712 domain replay defenses inside our EIP-712, Permit2 & Proxy Security hub.
Frequently asked questions
Why do crypto drainer kits target Permit2 signatures so heavily?
Millions of wallets have already granted unlimited ERC-20 approvals to the canonical Permit2 contract; tricking a victim into signing one free off-chain PermitBatch message lets the attacker sweep up to dozens of tokens in one tx.
What happens if a DEX router uses permitTransferFrom without a witness struct?
Plain permitTransferFrom only checks that msg.sender matches the signed router address—not who called the router! Anyone watching the mempool can extract the signature and call the router first with their own recipient address.
How do unordered nonces in Permit2 differ from EIP-2612 sequential nonces?
EIP-2612 increments nonces sequentially (0, 1, 2), so canceling or filling order #2 fails until #0 and #1 execute; Permit2 splits uint256 into a 248-bit word index and 8-bit flag, allowing 256 independent concurrent orders per slot.
How do I revoke compromised Permit2 sub-allowances in an emergency?
Call Permit2.lockdown(TokenSpenderPair) directly on 0x000000000022D473030F116dDEE9F6B43aC78BA3 to instantly zero out compromised AllowanceTransfer spenders, or revoke the underlying ERC-20 approval to Permit2.
Publication record
- Published
- November 13, 2026
- Updated
- November 14, 2026
- Author
- Dr. Devon Kurosawa, PhD
- Review
- Review not recorded
- Automated fact check
- Passed in the stored pipeline record
- Source URLs
- 3 recorded
AI assistance recorded: anthropic/claude-opus-4.6. This field does not establish human review or source verification.
Academic & Institutional Attribution
Cite This Research & Embed Live Data Card
Standard academic & institutional research paper citation format.
Dr. Devon Kurosawa, PhD. (2026, November 14). Uniswap Permit2 Security Audit: AllowanceTransfer vs SignatureTransfer & Witness Phishing. NFTVenue Ledger. https://nftvenueledger.com/protocols/uniswap-permit2-allowance-transfer-witness-phishing-auditsRegulatory Directory Cross-Reference
Referenced Institutions & Regulatory Registries
Top Regulated Institutions in This Coverage Slice
Primary Tier-1 Supervisory Registries
Related Erc721 Erc1155 Eip712 Permit Security & Institutional Briefings
Explore Erc721 Erc1155 Eip712 Permit Security Hub (20) →Erc721 Erc1155 Eip712 Permit Security
EIP-712 Typed Signatures, Permit2 Allowances, NFT Royalties & Proxy Timelocks: 2026 Security GuideErc721 Erc1155 Eip712 Permit Security
EIP-2612 ERC-20 Permit Audits: ecrecover Zero-Address, s-Malleability & Griefing FrontrunsErc721 Erc1155 Eip712 Permit Security
ERC-721 & ERC-1155 setApprovalForAll Security: Operator Blast Radius & Conduit IsolationErc721 Erc1155 Eip712 Permit Security
Seaport v1.6 Protocol Architecture: Conduits, Hook Zones & Bulk Order Merkle TreesErc721 Erc1155 Eip712 Permit Security
ERC-2981 NFT Royalty Signaling vs ERC-721C Programmable Transfer-Validator EnforcementErc721 Erc1155 Eip712 Permit Security
ERC-1967 Transparent vs EIP-1822 UUPS Proxies: Storage Slots & Uninitialized Logic ExploitsErc721 Erc1155 Eip712 Permit Security
EIP-2535 Diamond Multi-Facet Proxies: Selector Routing, DiamondStorage & Arbitrary DelegatecallErc721 Erc1155 Eip712 Permit Security
TimelockController & Multisig Governance Security: Delay Floors, Signer Ops & Guardian VetoesCross Chain Bridge Validator Exploits
ZK-SNARK Light-Client Bridges: Ethereum Sync Committee Proofs, Circuit Bugs & Multi-Prover DefenseCross Chain Bridge Validator Exploits
Circle CCTP Burn-and-Mint Architecture vs Lock-and-Mint Wrapped Bridge ContagionCross Chain Bridge Validator Exploits
Uniswap v3 Geometric-Mean TWAP Oracles: Tick-Accumulator Math & PoS Multi-Block Manipulation CostCross Chain Bridge Validator Exploits
Pull-Based Low-Latency Oracles (Pyth & Chainlink Data Streams): Confidence Intervals & Staleness Guards
NFTVenue Ledger Data, Benchmarks & Contributor Records
CC BY 4.0 Open Data
Open Institutional Datasets (CSV / JSON) →
Download desk-compiled quantitative series & schemas.
2026 Reference Matrix
2026 Institutional Benchmarks & Thresholds →
Statutory capital, clearing, margin & rate conventions.
Editorial Records
Authors & Review Records →
View named contributors where those records are available.
Complete Index
Master Research & Dossier Archive →
Browse all published briefings by topic pillar & date.
