AuctionEschapeHatch.sol#exitEarly updates state of the auction wrongly #268
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
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
Vulnerability
AuctionEschapeHatch.sol#exitEarly
takes as inputamount
to represent how much of theWhen the user exits an auction with profit, to apply the profit penalty less
maltQuantity
is liquidated compared to how much malt token the liquidated amount corresponds to. The problem isauction.amendAccountParticipation()
simply subtracts the malt quantity with penalty and fullamount
from users auction stats. This causes a major problem, since in_calculateMaltRequiredForExit
those values are used for calculation by calculating maltQuantity as follow:uint256 maltQuantity = userMaltPurchased.mul(amount).div(userCommitment);
The ratio of
userMaltPurchased / userCommitment
gets higher after each profit taking (since penalty is applied to substractedmaltQuantity
fromuserMaltPurchased
), by doing so a user can earn more than it should. Since after each profit taking users commitment corresponds to proportionally more malt, the user can even reduce profit penalties by dividingexitEarly
calls in several calls.In other words, the ratio of
userMaltPurchased / userCommitment
gets higher after each profit taking and user can claim more malt with less commitment. Furthermore after alluserMaltPurchased
is claimed the user can haveuserCommitment
left over, which can be used toclaimArbitrage
, when possible.Mitigation Step
Make sure which values are used for what and update values which doesn't create problems like this. Rethink about how to track values of an auction correctly.
The text was updated successfully, but these errors were encountered: