NFTBridge
60,000 USDC
View results
Submission Details
Severity: low
Invalid

UUPSProxied::_authorizeUpgrade - Use of onlyOwner Functions Can Be Lost

Summary

In the UUPSOwnableProxied.sol, ownership management is handled using the Ownable contract from OpenZeppelin. However, using the renounceOwnership function can lead to a loss of control over functions protected by the onlyOwner modifier, such as _authorizeUpgrade. Once ownership is renounced, the contract irrevocably loses the ability to perform any owner-specific operations, which poses potential security risks.

Vulnerability Details

The Ownable contract from OpenZeppelin includes the renounceOwnership function, which allows the current owner to relinquish ownership, effectively setting the owner to the zero address. If renounceOwnership is called on the UUPSOwnableProxied contract, the contract will lose the ability to perform any operations restricted by the onlyOwner modifier. This has security implications, especially for critical functions like _authorizeUpgrade.

  • Code snippet

/**
* @notice Only owner should be able to upgrade.
*/
function _authorizeUpgrade(address) internal override onlyOwner {}
/**
* @notice Ensures unsupported function is directly reverted.
*/
fallback() external payable {
revert NotSupportedError();
}
/**
* @notice Ensures no ether is received without a function call.
*/
receive() external payable {
revert NotPayableError();
}

Impact

Severity: Low

If the renounceOwnership function is utilized, the contract will permanently lose the ability to execute functions that are protected by the onlyOwner modifier. This loss of functionality is crucial for ensuring upgrades and changes in response to bug fixes or protocol updates. However, this situation is avoidable with proper administration, making the risk low.

Tools Used

  • Manuel review

Recommendations

Disable or Omit renounceOwnership Function:

  • To ensure continuous administrative control for critical functions, it is advisable to disable or entirely omit the renounceOwnership function in the contract.

function renounceOwnership() public override onlyOwner {
revert("Renouncing ownership is disabled.");
}

Implement Secure Transfer Ownership:

  • Implement a robust transferOwnership mechanism that allows transferring ownership to a trusted address but prevents irrevocable loss of ownership control.

function transferOwnership(address newOwner) public override onlyOwner {
require(newOwner != address(0), "New owner is the zero address");
_transferOwnership(newOwner);
}

Multi-Signature Wallet:

  • Consider using a multi-signature wallet for the ownership of the contract to reduce centralization risk and enhance the security of critical administrative functions.

Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational / Gas

Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.

Support

FAQs

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