Approval Exploit
- Category
- Security and Custody
- Level
- Professional
Simple definition
Using a token in most apps means granting a contract permission to move it. That permission stays after the trade, and a malicious contract can use it later to take the balance.
Professional definition
A loss arising from the token-approval model rather than from a stolen key. To let a contract spend your tokens you first approve an allowance; if that allowance is unlimited and the approved contract is malicious or later compromised, it can transfer the token at any time with no further action from you.
Technical definition
An allowance is state stored inside the token contract: holder, spender, amount. Nothing expires it. A single swap that granted an unlimited allowance leaves a standing permission over the whole balance of that token, bounded only by what the address still holds. Approvals are per token and per spender, so a working wallet accumulates dozens of forgotten ones. All the mitigations are on the holder's side: approve only the amount needed, read what a signature grants before confirming, and review and revoke standing allowances, which costs a transaction fee.
Academic definition
A risk class arising from persistent delegated spending permissions in token standards, in which a previously granted allowance remains exercisable independently of the transaction that created it.
Mechanism
Tokens are balances inside their own contract, so another contract cannot move them without a recorded permission. The model is a convenience: approve once, trade many times. The cost is that permission and use are separated in time, so the moment of risk is not the moment of the trade, and nothing reminds the holder that the permission is still live.
In practice
- Who uses it
- Anyone trading on a decentralised exchange, borrowing, minting or farming; and the wallet and interface designers who present these requests.
- Why it matters
- Most drained wallets still held their keys. The loss came from a permission the owner granted, and reviewing allowances removes that exposure cheaply.
- Limitations
- Revoking costs a fee and must be done per token and per spender. It cannot recover what a live allowance has already moved, and the next approval restarts the exposure.
Common mistakes
- Granting an unlimited allowance when one trade needs a fixed amount.
- Approving from the address that holds the whole balance.
- Never reviewing old approvals after trying a new protocol.
Examples
A swap needs 500 units of a stablecoin, but the interface asks for an unlimited approval. The amount at risk is not 500; it is every unit that address holds now or later, until the allowance is set to zero.
- Trade size = 500 units
- Allowance granted = unlimited
- Balance on that address today = 500 units; six months later = 20,000 units
- Exposure is min(allowance, balance), and the allowance does not bind
- Exposure today = 500 units
- Exposure six months later = 20,000 units
A fixed approval of 500 would have capped exposure at 500 for that spender. Revoking sets the allowance to zero and is a normal transaction with a fee.
A contract behaves correctly for months, then its admin key is compromised and its logic is changed. Every unlimited allowance ever granted to it is now a standing permission in the attacker's hands.
Related terminology
- related
- Smart Contract Phishing Smart Contract Audit Honeypot Decentralised Exchange Lending Protocol Operational Security Crypto Wallet Hardware Wallet Key Rotation
Private Key
Here no key was stolen. The owner granted a permission, and the permission did the work, so rotating keys without revoking allowances fixes nothing.
Sources
IOSCO · recommendations on smart-contract and user-interface risks in DeFi
https://www.iosco.org/library/pubdocs/pdf/ioscopd754.pdf URL verified
BIS Quarterly Review · 2021-12 · discussion of code and governance risk in decentralised finance
https://www.bis.org/publ/qtrpdf/r_qt2112b.pdf URL verified
CFTC · patterns by which victims are induced to authorise transfers
https://www.cftc.gov/LearnAndProtect/digitalassetfrauds URL verified
Editorial status
Flagged by the editor as uncertain on a linguistic, mathematical or regulatory point.
