In the rToken transfer functions, the amount supplied is divided by the liquidation index and then again divided by the liquidation Index in the _update function too. Thus whenever transfer/transferFrom is called for amount = amount, the amount is not transferred to the recipient. Only amount/liquidationIndex is transferred. In the stability pool during deposit, the transfer functions are used which allow malicious users to drain the funds.
Assume the following scenario:
user calls the deposit function with amount = 1e18.
the deposit function calls the transferfrom function which does amount.rayDiv(liquidationIndex) ~ 1e18/1e27 = 0
and then further in the update function again divided by the liquidationIndex and finally internally transferring 0 to the stability Pool.
But the stability Pool mints 1e18DeToken for the user and updates userDeposits with 1e18
The user then calls the withdraw function, which will get him RAAC tokens depending on his userDeposits which is 1e18.
This way by depositing 0 amount of RToken, the user can get an unlimited DeToken and RAACTokens.
Further as his DeToken balance increases by a lot (> 1e54) his withdraw calls will get him RTokens (transfer function wont round down to 0 since balance is > 1e54) and thus can drain the LendingPool contract too.
Note: there is a difference in the division in the transfer and transferFrom functions too (different liquidation Indices used, this will cause some other impacts too like user losing funds with each deposit+withdraw, but this is not included in the report since the fix for this is to remove all the divisions in the transfer functions which will elimiate all the bugs)
Loss of funds for other users and infinite supply of RAAC tokens thus infinite crvUSD from boost/guage etc.
manual review
make sure the balance of the stabilityPool is actually increasing, and also remove the divisions in the transfer functions in the RToken.
Note: this can be made into 2 bugs, 1 with fix being removing the divisions in the transfer functions and the other being ensuring the balance of the stabilityPool increases
(these are different issues since even after removing divisions in the transfer functions, the user can make the actual amount transferred = 0, because of the division in the update function which is important) I have included them in the same report since the attack paths are similar for both.Further anywhere the RAAC token is transferred this issue arises.
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.