Closed code423n4 closed 1 year ago
https://github.com/code-423n4/2023-06-lukso/blob/9dbc96410b3052fc0fd9d423249d1fa42958cae8/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol#L66-L82 https://github.com/code-423n4/2023-06-lukso/blob/9dbc96410b3052fc0fd9d423249d1fa42958cae8/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol#L126-L131
The transferOwnership function did not check if the newOwner address is 0, resulting in unexpected behavior.
https://github.com/code-423n4/2023-06-lukso/blob/9dbc96410b3052fc0fd9d423249d1fa42958cae8/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol#L66-L82 function transferOwnership( address newOwner ) public virtual override(OwnableUnset, ILSP14Ownable2Step) onlyOwner { _transferOwnership(newOwner);
address currentOwner = owner(); emit OwnershipTransferStarted(currentOwner, newOwner); newOwner.tryNotifyUniversalReceiver( _TYPEID_LSP14_OwnershipTransferStarted, "" ); require( currentOwner == owner(), "LSP14: newOwner MUST accept ownership in a separate transaction" ); }
https://github.com/code-423n4/2023-06-lukso/blob/9dbc96410b3052fc0fd9d423249d1fa42958cae8/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol#L126-L131 function _transferOwnership(address newOwner) internal virtual { if (newOwner == address(this)) revert CannotTransferOwnershipToSelf();
_pendingOwner = newOwner; delete _renounceOwnershipStartedAt; }
vscode
add check
Other
Withdrawn by ziyou-
Lines of code
https://github.com/code-423n4/2023-06-lukso/blob/9dbc96410b3052fc0fd9d423249d1fa42958cae8/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol#L66-L82 https://github.com/code-423n4/2023-06-lukso/blob/9dbc96410b3052fc0fd9d423249d1fa42958cae8/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol#L126-L131
Vulnerability details
Impact
The transferOwnership function did not check if the newOwner address is 0, resulting in unexpected behavior.
Proof of Concept
https://github.com/code-423n4/2023-06-lukso/blob/9dbc96410b3052fc0fd9d423249d1fa42958cae8/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol#L66-L82 function transferOwnership( address newOwner ) public virtual override(OwnableUnset, ILSP14Ownable2Step) onlyOwner { _transferOwnership(newOwner);
https://github.com/code-423n4/2023-06-lukso/blob/9dbc96410b3052fc0fd9d423249d1fa42958cae8/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol#L126-L131 function _transferOwnership(address newOwner) internal virtual { if (newOwner == address(this)) revert CannotTransferOwnershipToSelf();
Tools Used
vscode
Recommended Mitigation Steps
add check
Assessed type
Other