It is possible to call RapBattle::goOnStageOrBattle() consecutively using the same rapper NFT to perform a battle and avoid potential battle losses.
Neither the external function goOnStageOrBattle() nor the internal function _battle() ensures a rapper NFT cannot battle against itself.
An attacker could front-run an undesired opponent by calling RapBattle::goOnStageOrBattle() again when the current defender is one of their rapper NFTs and battle with themselves.
In order to observe the behavior explained above, add the following test to test/OneShotTest.t.sol:
And run it with forge test -vvvv --mt testBattleMyself. Observe that it is possible to battle using the same NFT as defender and challenger.
Manual analysis and Foundry.
Consider adding a check to the _battle() function to make sure tokenIDs cannot battle against themselves.
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.