Open code423n4 opened 2 years ago
While this issue is correct and I think this is a safer way to handle the require(newRatio >= minIbRatio)
check, there are a few assumptions that are made. For example, it is assumed that the user bonds their tokens without checking minIbRatio
and a publisher is able to maliciously update minIbRatio
which must first go through timelock. Based on this, I'm more inclined to downgrade this to medium
severity as I think this more accurately reflects the threat model.
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-12-defiprotocol/blob/205d3766044171e325df6a8bf2e79b37856eece1/contracts/contracts/Auction.sol#L97-L102
In the current implementation,
newRatio
is calculated and compared withminIbRatio
insettleAuction()
.However, if
newRatio
is less thanminIbRatio
,settleAuction()
will always fail and there is no way for the bonder to cancel and get a refund.PoC
Given:
bondPercentDiv
= 400basketToken.totalSupply
= 40,000factory.auctionMultiplier
= 2factory.auctionDecrement
= 10,000basket.ibRatio
= 1e18endingWeights.minIbRatio
= 1.9 * 1e18bondForRebalance()
2,000
blocks after the auction started, paid100
basketToken for the bond;settleAuction()
, it will always fail becausenewRatio < minIbRatio
;bondBurn()
one day after,100
basketToken from Alice will been burned.Recommendation
Move the
minIbRatio
check tobondForRebalance()
: