Function RapBattle.goOnStageOrBattle
allows users to battle with themselves which leads to the impossibility of losing and griefing other users.
Function goOnStageOrBattle
in contract RapBattle
if defender != address(0)
do not check that defenderTokenId
not equal _tokenId
.
1 Attacker call RapBattle.goOnStageOrBattle
and became a defender
2 User call RapBattle.goOnStageOrBattle
with intent to be a challenger
3 Attacker monitoring the mempool for user's call and frontrun it with the same rapper
4 Attacker becomes challenger
and win battle no matter as defender
or challenger
5 User transaction is succeeds but he has become a defender
and his Credibility
tokens and OneShot
NFT is stuck on RapBattle
contract until someone calls RapBattle.goOnStageOrBattle
.
Lack of check that defenderTokenId
not equal challenger _tokenId
leads to the possibility of a battle with themselves and griefing other users without putting at risk attacker Credibility
token.
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.