Oracle timeout at rebalance will result in a sell-off of all RSRs at 0 price #15
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
M-06
rainout
Used to specify findings that came in during the rained-out audit
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/reserve-protocol/protocol/blob/c4ec2473bbcb4831d62af55d275368e73e16b984/contracts/p1/mixins/RecollateralizationLib.sol#L394-L413
Vulnerability details
When creating the trade for rebalance, the
RecollateralizationLibP1.nextTradePair
uses(uint192 low, uint192 high) = rsrAsset.price(); // {UoA/tok}
to get the rsr sell price. And the rsr assert is a pure Assert contract, whichprice()
function will just return (0, FIX_MAX) if oracle is timeout:The
trade.sellAmount
will be all the rsr in theBackingManager
andstRSR
:It will be cut down to a normal amount fit for buying UoA amount in the
trade.prepareTradeToCoverDeficit
function.But if the rsr oracle is timeout and returns a 0 low price. The trade req will be made by
trade.prepareTradeSell
, which will sell all the available rsr at 0 price.Note that the SOUND colls won't be affected by the issue because the sell amount has already been cut down by basketsNeeded.
Impact
Loss huge amount of rsr in the auction. When huge amounts of assets are auctioned off at zero, panic and insufficient liquidity make the outcome unpredictable.
Proof of Concept
POC git diff test/Recollateralization.test.ts
run test:
log:
Tools Used
Manual review
Recommended Mitigation Steps
Using lotPrice or just revert for rsr oracle timeout might be a good idea.
Assessed type
Context
The text was updated successfully, but these errors were encountered: