ERC20 Permit Explained in Detail
ERC20 permit replaces an on-chain approve() call with a signed message. The signature authorizes a spender, amount, deadline, and token domain. A relayer or spender can then submit the permit on-chain.
Most permit implementations follow EIP-2612 and EIP-712.
Smart contract example
permit(owner, spender, value, deadline, v, r, s);
After a valid permit, allowance(owner, spender) should equal the approved value and the owner's nonce should increase.
ERC20 Permit in Auditing
Permit is a signature-based authorization path. If the digest, nonce, deadline, or signer recovery is wrong, an attacker may create approval-phishing paths or replay allowances. Those mistakes show up in phishing attacks and replay attacks. Permit changes how approval is submitted, but auditors must still review the underlying ERC-20 approval race condition.
Auditors treat permit as both ERC20 approval logic and cryptographic authorization logic.
Red flags in code
-
The signature does not bind spender, value, deadline, token, chain, or owner.
-
Nonce handling allows replay.
-
Expired permits are accepted.
-
Raw
ecrecoveraccepts zero address or malleable signatures. -
Domain separator handling is wrong across forks or deployments.
How to test or review it
-
Submit a valid permit and check allowance plus nonce increment.
-
Replay the same permit and expect failure.
-
Mutate spender, value, owner, deadline, chain, and token domain.
-
Test expired signatures and malformed signatures.
-
Compare the digest against known EIP-712 expectations.
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.
Nonce
A nonce is a value used once, commonly to prevent replay of signatures, orders, permits, withdrawals, or messages.
Permit Signature
A permit signature authorizes an on-chain action through signed data instead of a direct transaction from the signer.
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.
Phishing Attacks
Phishing attacks targeting smart contract users and teams: common social-engineering vectors, wallet risks, and practical prevention controls.
Smart Contract Audit Checklist
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 ERC-20 Permit (EIP-2612) into exploit labs, code review habits, and report-writing practice.
Start the free trial or see the full smart contract auditing course.