Missing zero address check can cause initialize to be called more than once
The initialize function in AccountantDelegate.sol only checks that state variables are not zero, so if it is first called with zero addresses, it can be called again. An attacker with admin privileges could reinitialize the contract and change critical variables, potentially breaking all accounting.
Submitted by oyc_109
There is potential to call initialize() on AccountantDelegate.sol more than once because the require statement only checks if the state variables != address(0)
If initialize() was called the first with these parameters as address(0x0), then initialize can be called again
Recommended Mitigation Steps
The require statement should also check if the parameters != zero address, similar to the check performed in TreasuryDelegate.sol
Or use openzepplen initializable.
nivasan1 (Canto) acknowledged and commented:
This will be a function called by admin (Governance), as such, it is the community’s responsibility to review the parameters of the inititalize method.
Alex the Entreprenerd (judge) commented:
In contract to CantoV1, in this version of the code the
initializercan be called multiple times.This is contingent on the admin calling it, however the impact of changing any variable will most likely be complete breaking of all accounting (an exception may be a complete fresh start).
Given in the code in scope, and the conditionality (admin privilege), I believe Medium Severity to be appropriate.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The initialize function's guard only checks that state variables are not the zero address, allowing re-initialization if they were initially set to zero.
Impact
If the admin calls initialize again, changing any variable will most likely completely break all accounting, though this requires admin privileges.
What the attacker needed
Admin privileges (governance)
The fix
The require statement should also check that the parameters are not zero addresses, or use OpenZeppelin's initializable.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Smart contracts often have an initialize function that sets up important settings once. This contract's check was flawed: it only verified that the settings were not zero, so if they were set to zero initially, the function could be run again. That means someone with special access could reset the contract's settings later, which could disrupt how it tracks balances.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.