-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double allowance spending when using the approve() function. #102
Comments
Caution users to use increaseAllowance() then. |
raymondfam marked the issue as low quality report |
raymondfam marked the issue as primary issue |
kirk-baird marked the issue as unsatisfactory: |
@kirk-baird I considered the explanation provided in the PoC is self-explanatory about the issue I'm reporting, but, pls, let me know what do you think it was missing in the report |
Hi @stalinMacias this issue was not marked as low quality due to the writing style or PoC. I found these sufficient quality. It's marked as low-quality due to the issue itself. Double spending on |
@kirk-baird Thanks for the explanation, will take this into account for future submissions |
Lines of code
https://github.com/code-423n4/2023-09-ondo/blob/main/contracts/usdy/rUSDY.sol#L276-L279
Vulnerability details
Impact
Proof of Concept
If an owner wants to set the allowance of an spender to a new value (either remove or add more) and uses the
rUSDY:allowance()
function, it needs to send the value of theamount
parameter set to the exact new allowance that the owner grants to the spender.Let's take as example: UserA (owner) granted 1000 allowance to UserB (spender), and after some time, the owner decides to decrease the total allowance of UserB down to 250.
The spender realizes about the tx of the owner to decrease its allowance and frontruns that tx by sending a tx to spend all the existing allowance, so it transfersFrom the owner the currentAllowance, which is 1000.
After the spender tx was executed, the tx of the owner to decrease the spender's allowance is executed, and now the spender has been granted with another 250 extra allowance.
Now the spender goes ahead and sends another tx to spend the just recent increased allowance, and spends another 250 tokens from the owner.
Tools Used
Manual Audit
Recommended Mitigation Steps
Assessed type
ERC20
The text was updated successfully, but these errors were encountered: