Function goOnStageOrBattle
in contract RapBattle
allows zero bets for users.
Function goOnStageOrBattle
in contract RapBattle
do not check _credBet
parameter that, along with the frontrun, leads to possibility for griefing attack.
RapBattle.defender
== address(0)
, no one in a battle right now.
1 User call goOnStageOrBattle
with some _credBet
greater than zero.
2 Attacker monitoring the mempool for user's goOnStageOrBattle
.
3 Attacker frontrun this transaction with their call goOnStageOrBattle
with parameter _credBet
equal 0.
4 User call will be reverted due to bet checking in RapBattle._battle
:
Attacker do not need to spend Credibility
tokens to griefing other users.
Manual review.
Make the following changes in RapBattle.sol
https://github.com/Cyfrin/2024-02-one-shot/blob/47f820dfe0ffde32f5c713bbe112ab6566435bf7/src/RapBattle.sol#L38C1-L52C6
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.