The MysteryBox contract contains a critical vulnerability in the changeOwner function that allows any address to take control of the contract by changing its owner without authorization.
The changeOwner function lacks proper access control checks. Any external address can call this function and change the contract owner, completely undermining the contract's governance model.
Vulnerable Code:
(MysteryBox.sol#111-113)
This function allows any address to change the contract owner without any restrictions.
This vulnerability has a critical impact on the security and integrity of the entire contract. An attacker could take full control of the contract.
slither .
INFO:Detectors:
Function MysteryBox.changeOwner(address) (MysteryBox.sol#111-113) is a non-protected setter owner is written
Reference: https://github.com/pessimistic-io/slitherin/blob/master/docs/unprotected_setter.md
forge foundry
forge test --match-test testChangeOwnerWeakAccessControl -vvvv
Implement proper access control on the changeOwner function, restricting it to the current owner only.
Consider using OpenZeppelin's Ownable contract for standardized ownership management.
Add events to log ownership changes for transparency.
Implement a two-step ownership transfer process for additional security.
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.