The Adminable
contract allows the current admin to transfer admin rights to a new address using the transferAdmin
function. However, this function lacks a two-step procedure, which can lead to potential security risks and operational issues.
The Adminable::transferAdmin
function is used to transfer the admin role from the current admin to the new admin:
And the function directly updates the admin
address with the new one provided as input argument. But a copy-paste error or a typo in the address of the new admin can end up bricking protocol functionality and leaving the protocol without admin.
Also, there is a test that shows the succefully transfer of admin rights to the zero address in the test file transferAdmin.t.sol
:
I know that checking the zero address is invalid according to the documentation, but this should be prevented because if admin rights are transferred to the zero address, the protocol will remain adminless.
The current admin might accidentally transfer admin rights to an incorrect address without any confirmation step, leading to potential loss of control over the contract.
Manual Review
Implement a two-step procedure for transferring admin rights. The process typically involves:
Initiation: The current admin initiates the transfer by specifying the new admin address.
Confirmation: The new admin address must confirm the transfer within a certain period.
By separating the initiation and confirmation steps, the risk of accidental transfers is significantly reduced. The current admin cannot inadvertently transfer the role without the new admin's confirmation.
Another solution is to use the Ownable2Step
from Openzeppelin.
https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity
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.