RapBattle:goOnStageOrBattle()
allows anyone to use an NFT they do not own to become the challenger.
The vulnerability is caused by the fact that both RapBattle::goOnStageOrBattle()
and RapBattle::_battle()
do not require the challenger to prove he's actually the owner of the NFT with tokenId
passed as a parameter.
This way, anyone can use an NFT they do not own (maybe with an higher stats compared to their) to become the challenger.
Anyone can falsely use another user's NFT to become the challenger.
Manual Review
Add the following test to demonstrate the issue:
Force the challenger to transfer his NFT so you can be sure that:
the NFT actually exists
the challenger actually owns the NFT
Alternatively, if you don't want to waste gas for the two additional transfers required for this first fix, you can just add the following checks inside goOnStageOrBattle
:
Note: if the _tokenId
do not exists ERC721::ownerOf()
will revert with ERC721NonexistentToken
Note: we can also assert before entering the battle that the challenger has enough cred tokens to pay if he loses. It isn't mandatory since the transaction will revert later even without it but, by checking before entering _battle()
, we can save some gas.
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.