Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

## H - 1: User able to enter battle as both challenger and defender

Description :

Due to no check on who is entering the battle, a user is able to play as both : defender and challenger.

Impact :

Someone can exploit this to constantly have their nfts battling which lets others unable to battle.

Proof of Concept :

Add the following test and it will pass:

function testSamedefenderandchallenger() public mintRapper {
vm.startPrank(user);
oneShot.approve(address(rapBattle), 0);
// rapper entering as defender
rapBattle.goOnStageOrBattle(0, 0);
oneShot.mintRapper();
oneShot.approve(address(rapBattle), 1);
// rapper entering as challenger
rapBattle.goOnStageOrBattle(1, 0);
vm.stopPrank();
}

Recommended Mitigation

Add the following check in rapBattle.goOnStageOrBattle :

else {
+ require(defender != msg.sender, "RapBattle: You cannot battle yourself");
_battle(_tokenId, _credBet);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.