Dutch 2
Description¶
Looks like someone is auctioning a lot of tokens, but they are encrypted. Might be a good idea to bid...
Solution¶
- There are some quote tokens and base tokens locked in the auction contract. The objective of the challenge is to drain the quote tokens in the auction contract
-
Any user can create an auction. The auction has several stages and the
checkState
modifier checks the current state of an auction based on the block timestamp and specific variables -
The auction creator can take out the bidders' quote tokens via finalize(). Meanwhile, the finalize() function can set the quoteLowest of an auction, which will affect the determination of the auction state, to a user-provided value. Invoke finalize() function with
quote
parameter set totype(uint128).max
allows sellers to keep the auction inReveal
stage and withdraw quote tokens again -
To exploit the vulnerability, the quote amount and base amount of a bid should be chosen carefully. If the auction has only one bid,
amountQuote * type(uint128).max / amountBase
needs to be equal toquote * type(uint128).max / base
. To keep it simple,base
can be also set totype(uint128).max
, and the bidder quote amount should be equal to the base amount
Exploitation¶
- If no new blocks are mined,
block.timestamp
will not be updated in the local simulation - Use
--slow
flag to send transactions one by one, and prevent local simulation for thesecond()
function from reverting via onchain simulation
Flag¶
OZCTF{sT4T3_g0T_T0o_C0nFuS3D_f0R_tH3_4uCt10n}