MEV attack in MartenitsaVoting::announceWinner
- the attacker gets the reward or DoS the contract.
Just before the winner is announced, the attacker will buy the winning token by MartenitsaMarketplace::buyMartenitsa
and the token will be deleted from the tokenIdToListing
mapping. The attacker will make his transaction go before the announceWinner transaction.
Now the attacker has two choices:
List the token again in the MartenitsaMarketPlace
and then the HealthToken
reward will go to the attacker instead of the actual winner
Don't list the token again and DOS the MartenitsaVoting::announceWinner
. When MartenitsaMarketPlace::getListing
is called in MartenitsaVoting::accounceWInner
, the function will revert, because it expects that the token is listed for sale - require(listing.forSale, "Token is not listed for sale");
The attacker will get the reward instead of the actual winner or will DoS the MartenitsaVoting::announceWinner
.
The voting can't be started again because as it is stated in the README - The voting takes place only once.
Manual Review
Use Flashbots or change the rules that not only listed for sale tokens can participate in the vote.
The second option is recommended as this issue can happen also without MEV attack, though it is a bit harder to execute.
But if there is small amount of time until the deadline and there is a clear leader in the voting, the same thing can be achieved without MEV.
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.