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

`Dussehra::killRavana` can be called multiple times, allowing an organizer to receive all of the collected fees.

Vulnerability Details

The killRavana function can be called multiple times by protocol users in a given time frame. Each time the function is called, the event organizer receives half of all fees collected. So after just two consecutive calls to killRavana (assuming the selected ram does not call Dussehra::withdraw after the first call to the killRavana function), the organizer would receive all the fees collected.

Impact

The organizer can receive all the collected fees, leaving the selected ram user without the ability to withdraw his rewards. This would break the protocol invariant.

Tools Used

manual review, VSC

Recommendations

Consider implementing an access control mechanism using the KillRavanaOnlyOnce modifier in Dussehra::killRavana. This action would also prevent a possible reentrancy attack in Dussehra::killRavana, which would allow an organizer to steal all entry fees, in case the organizer address is a smart contract.

............
+ modifier KillRavanaOnlyOnce() {
+ require(!IsRavanKilled, "Ravan is already dead!");
+ _;
+ }
- function killRavana() public RamIsSelected {
+ function killRavana() public RamIsSelected KillRavanaOnlyOnce {
if (block.timestamp < 1728691069) {
revert Dussehra__MahuratIsNotStart();
}
if (block.timestamp > 1728777669) {
revert Dussehra__MahuratIsFinished();
}
IsRavanKilled = true;
uint256 totalAmountByThePeople = WantToBeLikeRam.length * entranceFee;
totalAmountGivenToRam = (totalAmountByThePeople * 50) / 100;
(bool success, ) = organiser.call{value: totalAmountGivenToRam}("");
require(success, "Failed to send money to organiser");
}
Updates

Lead Judging Commences

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

isRavanKilled is not checked

Support

FAQs

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