Mystery Box

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

Lack of access control for `changeOwner`

Summary

Lack of access control for changeOwner allows anyone to transfer ownership and control of the contract.

Vulnerability Details

changeOwner function can be called by anyone, meaning anyone can take over the ownership of the contract.

Impact

Anyone can take over the ownership of the contract, so they can change prices and withdraw funds without any permission.

Tools Used

Manual review.

Recommendations

Restrict access to the changeOwner function so that only the current owner can call it:

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

Appeal created

inallhonesty Lead Judge about 1 year 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.

Give us feedback!