The RapBattle
contract is not checking whether the current challenger is the owner of the rapper NFT in use for a battle.
When entering a battle as a challenger, the code snippet inside the else
statement below is executed:
Notice that it it not checking the ownership of the rapper NFT nor transferring it from msg.sender
(contrary to what happens in the defender's logic above).
An attacker could call goOnStageOrBattle()
using a _tokenId
of a rapper NFT with good stats without actually owning it, increasing the chances of winning battles and earning CredToken
from it.
Manual analysis and Foundry.
It is recommended to check whether the challenger does own the _tokenId
and/or escrow it during the battle as shown below:
Proposed solution:
and
If the challenger does not own the rapper NFT with token ID _tokenId
, the call to goOnStageOrBattle()
will revert.
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.