In VoterID.sol, ownership transfer is subject to a single-step process and can result in the ownership to be passed mistakenly to a random address, which would prevent some functions to be called.
Impact
Medium
Proof Of Concept
VoterID.sol:153: _owner_ = newOwner;
There is no zero-address check. If the owner were to accidentally pass the zero address as a parameter (or any random address), the _owner_ would get updated with that new address, and setTokenURI would not be able to be called anymore.
Tools Used
Manual Analysis
Recommended Mitigation Steps
use a two-step address change where the new owner must call a function to 'accept' the ownership of the contract.
Lines of code
https://github.com/code-423n4/2022-05-factorydao/blob/db415804c06143d8af6880bc4cda7222e5463c0e/contracts/VoterID.sol#L153 https://github.com/code-423n4/2022-05-factorydao/blob/db415804c06143d8af6880bc4cda7222e5463c0e/contracts/VoterID.sol#L162
Vulnerability details
SINGLE-STEP PROCESS FOR OWNERSHIP TRANSFER
In
VoterID.sol
, ownership transfer is subject to a single-step process and can result in the ownership to be passed mistakenly to a random address, which would prevent some functions to be called.Impact
Medium
Proof Of Concept
There is no zero-address check. If the owner were to accidentally pass the zero address as a parameter (or any random address), the
_owner_
would get updated with that new address, andsetTokenURI
would not be able to be called anymore.Tools Used
Manual Analysis
Recommended Mitigation Steps
use a two-step address change where the new owner must call a function to 'accept' the ownership of the contract.