When there is an excess amount calculated between the desired buffer (20% of totalDeposits) and the current buffer (crvUSD balances of the RToken), this amount is deposited into the Curve-crvUSD vault and the lending pool gets minted equivalent shares. These shares then can be burned in order to take back the underlying asset + gained yield. And upon withdrawal if there is an insufficient balance in the RToken, the vault acts as a liquidity provider and transfers the required amount. The problem is that upon withdrawal the user is allowed to specify value greater than his balance:
As can be seen the difference between the input-specified amount and the crvUSD balances of the RToken is transfered out from the Curve vault. This opens possibilities all the balance of the Curve vault being taken out and causing loss of yield to the protocol.
Consider the following scenario:
Curve vault has 1000 balance
RToken has 500
A user specifies to withdraw 1500
1500 - 500 = 1000 tokens will be transfered out from the Curve vault, which is all it's balance
Same applies for borrows
A malicious user can repeatedly make such calls, to keep Curve vault balance constantly 0, thus preventing the protocol from earning yield.
Note: if user specifies more than actually he has deposited, the tx will not revert, because the amount will be capped to his actual balance (implemented in Debt and R token)
Can purposely keep the Curve vault balances 0, thus preventing the protocol gaining yield.
Manual Review
Don't allow the user to specify an amount greater than his deposits
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.