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

Ravana can be killed by anyone and twice, stealing money to the selected Ram.

Description

Dussehra::killRavana allows the protocol to begin the end of the event, sending all of the fees to the organiser. Other half is distributed to selected Ram in an other function. Problem is that this function is callable by any one and multiple time (no check of the boolean isRavanKilled).

Problem is that if this function is call twice, all the fees will be send to the organiser. (50% + 50% = 100%)

Moreover, to follow the tradition, only selected Ram should kill Ravana (and maybe also the organiser if selected Ram do not want to do it).

@> function killRavana() public RamIsSelected {
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");
}

Risk

Likelyhood: High

  • Anyone can call the function twice

Impact: High

  • Loss of funds for selected Ram.

Recommended Mitigation

- function killRavana() public RamIsSelected {
+ function killRavana() public RamIsSelected {
+ require(!IsRavanKilled);
+ require(choosingRamContract.selectedRam == msg.sender || organiser == msg.sender);
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 over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

isRavanKilled is not checked

n0kto Submitter
over 1 year ago
bube Lead Judge
over 1 year ago
bube Lead Judge over 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.

Give us feedback!