Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: high
Valid

Anybody can call changeOwner function and be the owner.

Summary

changeOwner function has no guard, as a result any body can call changeOwner function and pass his address to make himself the owner.

Vulnerability Details

function changeOwner(address _newOwner) public {
owner = _newOwner;
}

Impact

A malicious can make himself the owner by calling changeOwner function and withdraw all funds from the contract.

Tools Used

Manual Review

Recommendations

add guard to the changeOwner function.

function changeOwner(address _newOwner) public {
require(msg.sender == owner, "Only current owner can make new owner");
owner = _newOwner;
}
Updates

Appeal created

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Anyone can change owner

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.