The changeOwner
function does not validate the new owner's address before assigning it. Specifically, it does not check whether _newOwner
is the zero address (0x0000000000000000000000000000000000000000
). This introduces a critical vulnerability where an owner can accidentally or maliciously assign the ownership to the zero address, which would result in the contract becoming irreversibly ownerless. As a result, further control over the contract could be lost, potentially halting critical administrative functions.
The changeOwner
function in the contract does not implement a validation check for the input parameter _newOwner
. Specifically, the function allows setting the owner
to any address, including the zero address (0x0000000000000000000000000000000000000000
). This absence of validation introduces the following risks:
Root Cause:
The changeOwner
function directly assigns _newOwner
to the owner
variable without verifying if _newOwner
is the zero address. As a result, ownership could inadvertently or maliciously be transferred to an invalid address, causing a loss of control over the contract.
Risks:
Irreversible Loss of Control: If the owner
is set to the zero address, all administrative functionalities that rely on the owner will no longer be accessible. This effectively locks the contract in an unusable state, with no way to regain ownership or manage key functions.
Potential Denial of Service (DoS): Any administrative or sensitive functions that rely on the owner
being valid, such as fund transfers, upgrading contract logic, or managing critical resources, will be permanently disabled.
Security Implications: Attackers or careless users could deliberately or mistakenly exploit this vulnerability to render the contract unusable.
Affected Components:
The vulnerability directly affects the changeOwner
function, but its impact extends to any functionality requiring the owner
to manage the contract.
Other administrative functions dependent on a valid owner (e.g., updating contract parameters, transferring funds) are also indirectly affected.
Attack Scenarios:
Accidental Assignment: The current owner mistakenly sets the ownership to address(0)
due to a user error, rendering the contract permanently ownerless.
Malicious Exploitation: An attacker or malicious user could exploit this by intentionally passing address(0)
to lock the contract, especially if the contract has public or externally accessible functions that call changeOwner
.
Loss of Contract Ownership: Once the ownership is transferred to the zero address, no further ownership-related actions can be executed by any account. The contract becomes orphaned, losing control over key administrative tasks.
Denial of Service (DoS): If the contract has admin-restricted functions, their execution will be permanently disabled.
Implement a zero-address check to prevent the owner from being set to address(0)
. The function should revert if _newOwner
is the zero address:
Mitigated Code:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.