The MysteryBox::changeOwner function is publicly accessible, allowing anyone to take ownership of the contract. Since the contract's critical functions—setting the price of boxes, adding rewards, and withdrawing funds—are intended for the owner only, this vulnerability poses a significant risk.
The changeOwner function lacks access control, enabling unauthorized users to change the contract's ownership.
Anyone can take ownership of the contract, granting them the ability to modify prices, add new rewards, and withdraw funds.
VSCodium
Manual review
Implement an access control modifier to the changeOwner function to restrict ownership changes.
Additionally, update the test function in TestMysteryBox.t.sol to include access control checks:
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.