Submitted by Cyfrin, also found by Cyfrin
During recollateralization/a switch basket/when the protocol collateral isnt sound, a user can have almost their entire redemption transaction hot swapped for nothing.
For example, trying to redeem 1M collateral for 1M rTokens could have the user end up with 0 collateral and 0 rTokens, just by calling the redeem function at the wrong time.
Example:
We provide the proof of code in proof of code section.
This relies on a validator being malicious with for-profit motives. It would be pretty easy for them to setup a bot looking for this exact scenario though and just staying dormant till the time is right. If they get to order the transactions, they can make a fat profit from the victim.
If the backingManger has too many excess assets, it will flash issue as many RTokens as possible to even the collateral to RTokens.
The RedemptionBatterys currentCharge function is dependent on the total supply of RTokens. So if the total supply is raised, you can redeem way more than you should be able to.
(This also is true for issuance.)
So if I see a tx where a collateral is about to be disabled, I can chain it with the refreshbasket TX myself.
The redeem function has this check:
Which checks if the collateral is good, but NOT if the protocol is fullyCollateralized. Since we chain the disabled asset with the refreshBasket TX, the backup collateral kicks in, and the collateral status becomes SOUND. However, normally, wed have 0 of the new collateral and any redemptions would fail, since there isnt anything to give back.
So, if you send a tiny tiny bit of the new collateral to the protocol, the protocol will process the redemption and give them their prorata share of the collateral, which right now is almost 0, but still burn all the rToken being redeemed.
RToken.sol
And we calculate how much they get back like so. We see how much $ we currently have in the basket, and hand back those amounts accordingly. Since we have almost no money, we are going to give them almost nothing for their rTokens.
And just like that, a seemingly innocuous redemption transaction was a trap the whole time. The next step would be to go through the rest of the process to see how much our evil user profited (from running the auctions), as they need to be a whale to inflate the RToken supply. However, weve seen attacks like this, and one could consider it a highly profitable trading strategy. If they buy up majority shares in the RToken, or, they coordinate with most of the StRSR token holders they could advertise and honey pot people to do redemptions whenever a switchBasket is coming. Spread FUD like you need to redeem otherwise youll lose money! and its the redeeming that actually steals their money.
Hardhat
Disallow issuance/redemptions while the protocol is undercollateralized.
See wardens original submission for full details.
0xean (judge) decreased severity to Medium and commented:
tbrent (Reserve) confirmed and commented:
tbrent (Reserve) mitigated:
Status: Not fully mitigated. Full details in reports from 0xA5DF, HollaDieWaldfee, and AkshaySrivastav. Also included in Mitigation Review section below.
