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

Users can call `Dussehra::enterPeopleWhoLikeRam` even after Ravan is killed and Mahurat is ended

Summary

Once the Ravan is killed, Mahurat is ended and ram calls withdraw then the contract should be left with no balance but new players can still call Dussehra::enterPeopleWhoLikeRam and their entryFee will be permanently stuck in the contract

Vulnerability Details

There are no checks which prevent users from calling Dussehra::enterPeopleWhoLikeRam after Ravan is killed and Mahurat is ended

PoC: can Enter Even If Ravan Is Killed And Mahurat Ends
function test_canEnterEvenIfRavanIsKilledAndMahuratEnds() public participants {
vm.warp(1728691200 + 1);
vm.startPrank(organiser);
choosingRam.selectRamIfNotSelected();
vm.stopPrank();
vm.startPrank(player2);
dussehra.killRavana();
vm.stopPrank();
vm.startPrank(player2);
dussehra.withdraw();
vm.stopPrank();
// ravan is killed and player2 withdraws
vm.warp(1728777600 + 1);
// mahurat ends
vm.startPrank(player3);
vm.deal(player3, 1 ether);
dussehra.enterPeopleWhoLikeRam{value: 1 ether}();
vm.stopPrank();
assertEq(address(dussehra).balance, 1 ether);
}

Impact

If Dussehra::enterPeopleWhoLikeRam is callable after Ravan is killed and Mahurat is ended then the entryFee paid by the player will be permanently stuck in the contract

Tools Used

  1. Manual Review

  2. Foundry

Recommendations

Adding checks to prevent users from calling Dussehra::enterPeopleWhoLikeRam after Ravan is killed and mahurat is ended mitigates this issue

make the following changes in Dussehra.sol

  1. Declare a new error error Dussehra__RavanIsKilled();

  2. In Dussehra::enterPeopleWhoLikeRam add the following check

function enterPeopleWhoLikeRam() public payable {
if (msg.value != entranceFee) {
revert Dussehra__NotEqualToEntranceFee();
}
+ if (IsRavanKilled == true) {
+ revert Dussehra__RavanIsKilled();
+ }
if (peopleLikeRam[msg.sender] == true) {
revert Dussehra__AlreadyPresent();
}
Updates

Lead Judging Commences

bube Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Invalid - enter people after event or after Ram is selected

It is the user's responsibility to check the date of the event.

Support

FAQs

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