The randomValue
functionality in the mysterybox.sol
can be exploited and weaponized in this configuration. An attacker can create an external contract that will calculate the randomness value and only open a box when the value meets a high winning prize criteria.
Steps to reproduce:
-Deploy mysterbox.sol with 10 ETH
-Change wallet address
-deploy exploit poc
-buy one box from the exploit poc
-continually call play until you get a successful transaction (if the reward rate is too low then it will revert automatically)
this function will also autoclaim your rewards to the contract address
Other functionality:
If you want to ensure the randomness is being calculated properly I included a function called calculate which will show the current calculation when called.
Exploit POC:
-Unfair winning advantage
-Company loss of contract funds
-Loss of public/customer integrity
Remix IDE Desktop
Use an oracle that fetches a value from an external source instead of calculating randomness on chain.
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.