Contract Name: MysteryBox
Severity: High
Reported Issue: Unauthorized Owner Change Exploit
The changeOwner()
function in the MysteryBox
smart contract allows any user to change the contract's ownership to themselves without any access control. This is a critical vulnerability as an attacker can take over the entire contract, including the ability to withdraw funds, manipulate rewards, and modify contract state.
The lack of ownership verification allows any caller to replace the current owner with their own address, effectively taking control of the contract.
An attacker can exploit this vulnerability by simply calling the changeOwner()
function and passing their own address as _newOwner
. Once they are the new owner, they can withdraw all funds, modify contract settings, and disrupt the intended operation of the contract.
Full contract takeover: The attacker can claim ownership and access all functions restricted to the contract owner, such as withdrawing funds and managing rewards.
Financial loss: The attacker can drain the contract balance using the withdrawFunds()
function.
Disruption of contract logic: The attacker can modify rewards, box prices, and other key contract parameters.
Add access control to the changeOwner()
function, restricting its use to the current owner only.
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.