https://github.com/Cyfrin/2024-09-mystery-box/blob/main/src/MysteryBox.sol#L79-L90
The MysteryBox::claimAllRewards function does not follow the CEIFREI-PI principles, and, as a result, enables participants to drain the contract balance.
In the current implementation of MysteryBox::claimAllRewards, rewards are transferred first, and only then is rewardsOwned[msg.sender] reset.
A malicious player who has participated in the prediction could have a fallback or receive function that triggers the MysteryBox::claimAllRewards function again, allowing them to claim multiple refunds. They could repeat this process until the contract’s balance is completely drained.
All the funds paid by players could be stolen by a malicious actor.
To resolve this issue, the MysteryBox::claimAllRewards function should update the rewardsOwned array before making any external calls.
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.