Closed code423n4 closed 1 year ago
raymondfam marked the issue as low quality report
raymondfam marked the issue as remove high or low quality report
raymondfam marked the issue as duplicate of #102
raymondfam marked the issue as low quality report
kirk-baird marked the issue as unsatisfactory: Invalid
Lines of code
https://github.com/code-423n4/2023-09-ondo/blob/main/contracts/usdy/rUSDY.sol#L276-L279
Vulnerability details
Impact
In case the user has already approved something, an attacker can frontrun a transaction using first what has already been approved and then the new value. For example: User Alice approved 5 tokens for user Bob to use, then decided to lower approval to 3, as a result Bob frontrun the transaction and withdraws 5 tokens, however after this transaction there are still 3 tokens left to be approved, which Bob also withdraws, so Bob withdrew 8 tokens instead of 3.
Proof of Concept
Tools Used
manual
Recommended Mitigation Steps
Add: Use only increaseAllowance and decreaseAllowance
Assessed type
MEV