https://github.com/Cyfrin/2024-09-mystery-box/blob/main/src/MysteryBox.sol#L92
claimSingleReward
allows a user (i.e., msg.sender
) to claim a specific reward from their list of rewards, the isue here is that The Ether transfer occurs before the state (rewardsOwned[msg.sender][_index]
) is updated, which could leave this function vulnerable to a reentrancy attack.
A malicious contract could re-enter the function before the reward is deleted, claiming rewards multiple times
manual review
The line delete rewardsOwned[msg.sender][_index];
is moved before the Ether is transferred using .call
.
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.