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

Users who update their values in `ChoosingRam::increaseValuesOfParticipants` become selected ram but are unable to call `Dussehra::killRavana`.

Summary Since the ChoosingRam::increaseValuesOfParticipants function doesn's update the state of isRamSelected the Dussehra::killRavana function is unable to be called even though the player has passed all checks to become the selectedRam.

Vulnerability Details (Proof Of Code)

Add the following to the Dussehra.t.sol test suite:

function testSelectedRamCantKill() public participants{
vm.startPrank(player3);
vm.deal(player3, 1 ether);
dussehra.enterPeopleWhoLikeRam{value: 1 ether}();
vm.stopPrank();
vm.startPrank(player4);
vm.deal(player4, 1 ether);
dussehra.enterPeopleWhoLikeRam{value: 1 ether}();
console.log();
vm.stopPrank();
vm.startPrank(player4);
choosingRam.increaseValuesOfParticipants(3, 1);
choosingRam.increaseValuesOfParticipants(3, 1);
choosingRam.increaseValuesOfParticipants(3, 1);
choosingRam.increaseValuesOfParticipants(3, 1);
choosingRam.increaseValuesOfParticipants(3, 1);
vm.stopPrank();
console.log(choosingRam.selectedRam());
vm.warp(1728691200 + 1);
vm.expectRevert();
vm.startPrank(player4);
dussehra.killRavana();
vm.stopPrank();
}

The console.log will show Player 4 as the selectedRam, yet they are unable to call Dussehra::killRavana

Impact

Users who have passed the checks in order to complete the event are unable to perform the actions as described in the documentation.

Tools Used

Manual Review,
Foundry,

Recommendations

Update the function to change the state of isRamSelected to true once a user has been chosen from the ChoosingRam::increaseValuesOfParticipants function.

+ isRamSelected = true;
ramNFT.updateCharacteristics(tokenIdOfChallenger, true, true, true, true, true);
selectedRam = ramNFT.getCharacteristics(tokenIdOfChallenger).ram;
}
+ isRamSelected = true;
ramNFT.updateCharacteristics(tokenIdOfAnyPerticipent, true, true, true, true, true);
selectedRam = ramNFT.getCharacteristics(tokenIdOfAnyPerticipent).ram;
}
Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

`isRamSelected` is not set

Support

FAQs

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