The contracts claimSingleReward is vulnerable to a reentrency attack that will drain the entire mysterybox balance in the contract.
Steps to reproduce:
-Deploy magicbox with 50 ETH
-Change wallet address
-Deploy Exploit.sol
-Deposit 10 ETH into exploit.sol
-Call buyandopen function multiple times
-Check testGetRewards to see if your reward is at the end of the array
-Check findMostValuableValue to validate
-Call Attack for Reentrency attack (Depending on reward size you may have to increase gas)
-Check balance of both contracts
(if the transaction was successful mysterybox balance will be zero and exploit will contain all of the holdings)
Remix POC:
Total contract value loss.
Loss of customer funds.
Loss of public trust.
Remix IDE Desktop
Create a new variable to store the reward values.
Reset the the users reward values
Send the reward.
If transaction fails or reverts then rewrite the rewards values from the new variable to the old one.
The issue is a product of sending before changing the state.
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.