This contracts claimAllRewards function is vulnerable to reentrency attacks.
Steps to Reproduce:
-Deploy mysterybox.sol with 50 ETH
-Change wallet address
-Deploy exploit.sol
-BuyBox with 100000000 GWEI
-openBox (until you receive a reward OR buy multiple boxes and open multiple)
-After you have a reward then click claimAllRewards
(You should now see everything from the mysterybox contract has been transfered to your malicious contract)
POC:
Total contract loss
Loss of customer funds
Loss of public trust
Remix IDE Desktop
The problem is a result of sending the funds and then updating the state.
Steps to mitigate:
-Create new variable with the same value as the users rewards.
-Reset the user rewards variable to zero
-If the transfer of rewards fails or reverts then copy the value from the new variable back to the old (now empty)variable
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.