The Dussehra::killRavana function can be exploited by calling it multiple times within the valid time window, leading to the unintended transfer of funds to the organiser multiple times. This depletes the contract's balance, potentially leaving insufficient funds for the selected Ram to withdraw their rightful share.
Dussehra::killRavana function allows to kill Ravana and transfers 50% of all entrance fees to organiser. Problem is that Dussehra::killRavana function can be called twice in row, and second call will again send 50% of all entrance fees to organiser, which means contract will be empty (or almost empty). Then if selected Ram wants to call Dussehra::withdraw function, it will not be able to withdraw because there is no enough funds in Dussehra contract for selected Ram.
Two players mint their Ram NFTs.
After some time organiser calls ChoosingRam::selectRamIfNotSelected function and selects one of player as selected Ram.
Random caller calls Dussehra::killRavana function.
Random caller again calls Dussehra::killRavana function.
Assert that Dussehra contract is empty.
Selected Ram calls Dussehra::withdraw function, and it reverts.
Place the following test into Dussehra.t.sol.
If Dussehra::killRavana function is called twice in row by any random caller, selected Ram will not be able to withdraw his reward. In that case all entrance fees will go to organiser.
Manual review
Add modifier RavanNotKilled to Dussehra::killRavana function to prevent that function can be called twice.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.