20,000 USDC
View results
Submission Details
Severity: medium
Valid

Ownership transfer

Summary

Lack of address check in transferOwnership

Vulnerability Details

function transferOwnership(address _owner) public virtual onlyOwner {
owner = _owner;
emit OwnershipTransferred(msg.sender, _owner);
}

Impact

In this function you can accidentally send wrong address of _owner and lost control and ownership of the whole project.

Tools Used

Manual

Recommendations

I would recommend you to use Ownable2Step contract of OpenZeppelin or add check for _owner like this`
require(_owner != address(0))
If you will add this require it will not cover all cases of sending wrong _owner address. I would highly recomment to use Ownable2Step because 2nd part must approve transfer of ownership.

Support

FAQs

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

Give us feedback!