The spicy auction contract has offered some ways to recover tokens in case of emergency. The reccoverTokens
function allows the exector role to withdraw tokens from the contract. In case of the token is auction tokens, and the startAuction
function has been called, but during the cooldown period, according to the comments by devs, removeAuctionConfig
shall be called as a solution to cancel an auction. However, when auctions are cancelled, important state variables such as _totalAuctionTokenAllocation
is not updated, and will cause further calculation errors.
With the assumption of that the auction has been started, but on cooldown period, we can first look at the startAuction
function in SpicyAuction
contract:
As we can see, the total available tokens in the round of auction is calculated by the subtracting the "reserved amounts" from the current total balance. After passing various checks, the epochAuctionTokenAmount
is added to the global variable _totalAuctionTokenAllocation[auctionToken]
.
However, continue with the assumption, and some emergency case happens, the DAO decides to cancel the auction. Since the auction has been started, it would be the best to call removeAuctionConfig
function, where we can see, simply removes the entire struct value in the map:
This causes an issue, since _totalAuctionTokenAllocation[auctionToken]
is updated when auction is started, when the same auction is removed, and without even really starting, the total allocated tokens should also be deducted. As this value is also used to determine the auctioned amount for next round, this can cause bidders to get less than they actually can, and also a DoS in some cases.
For example, the math for updating allocated tokens is:
which is essentially:
This makes the allocated amount for potentially next round, to be larger than the current balance. When a started auction is cancelled, or has its config removed, the DAO decides to correctly set a new config and start it right away, but they would find their call to startAuction
always revert, as there will be not enough balance in the contract to cover the auction for this new config, despite the previous auction is cancelled, and the allocated amount should be subtracted.
This will cause bidders to get less auctioned tokens, and can also cause DoS if the DAO decides to start a new auction after removing a previous one.
Manual review.
When auction config is removed, also deduct the correspond allocation amount.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.