Basket.sol#auctionBurn
calculates ibRatio
wrong
#144
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
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
0x0x0x
Vulnerability details
The function is implemented as follows:
When
handleFees
is called,totalSupply
andibRatio
changes accordingly, but fornewIbRatio
calculation tokens minted inhandleFees
is not included. Therefore,ibRatio
is calculated higher than it should be. This is dangerous, since last withdrawing user(s) lose their funds with this operation. In case this miscalculation happens more than once,newIbRatio
will increase the miscalculation even faster and can result in serious amount of funds missing. At each timeauctionBurn
is called, at least 1 day (auction duration) of fees result in this miscalculation. Furthermore, all critical logic of this contract is based onibRatio
, this behaviour can create serious miscalculations.Mitigation step
Rather than
uint256 newIbRatio = ibRatio * startSupply / (startSupply - amount);
A practical solution to this problem is calculating
newIbRatio
as follows:The text was updated successfully, but these errors were encountered: