Normal ERC20 allowance patterns should prevent spenders from extracting more tokens than the owner intends to approve. The approve() function in Token-0x's public interface directly overwrites existing allowances without checking for partial spends, enabling a multi-step attack where spenders can extract additional tokens beyond any single approval limit.
The vulnerability occurs because approve() calls _approve() which unconditionally overwrites the storage slot without validating the current allowance state .
Likelihood:
Any token holder who approves a spender and later modifies that approval is vulnerable
DeFi protocols using allowance patterns (DEXes, lending markets, vaults) will encounter this in normal operation
The attack requires no special privileges beyond a valid initial approval
Impact:
Token holders can lose more tokens than they ever approved in a single transaction
Economic attacks on DeFi protocols that rely on allowance mechanisms for security
Undermines trust in allowance-based authorization systems
The test demonstrates how a spender can extract 70 tokens despite never receiving more than 50 tokens in any single approval:
Initial Approval: Owner approves spender for 50 tokens
Partial Spend: Spender uses 30 tokens, 20 tokens remain approved
Reapproval Attack: Owner sets new approval for 40 tokens, overwriting the 20 remaining
Double-Spend: Spender extracts 40 more tokens, totaling 70 tokens extracted
Implement the safe approval pattern that requires resetting allowances to zero before setting new values, preventing the reapproval attack vector.
Alternatively, implement the decrease/increase approval pattern used by OpenZeppelin:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.