A malicious user can front-run the approval of tokens from a victim's account, leading to the loss of partial funds for the victim.
If a user grants token approval to a malicious user and later tries to increase the approved token amount, the malicious user can front-run this transaction. By spending all the previously approved tokens before the new approval is confirmed, the malicious user can obtain extra tokens from the victim.
User A approves 10 USDz for User B.
User A wants to add 5 USDz to the approval, so they send a transaction to approve 15 USDz for User B.
User B front-runs this approval transaction by spending the 10 previously approved USDz before the new approval is processed.
Final state: User B has 10 USDz + 15 USDz = 25 USDz, effectively taking 10 extra USDz from User A.
This vulnerability leads to the loss of partial funds for the user.
Manual review.
Override the ERC20::_approve(address owner, address spender, uint256 value, bool emitEvent)
function to allow approvals only if the spender has no previously approved tokens:
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.