Missing zero address check can set treasury to zero address
The initialize function of AccountantDelegate lacks a zero address check for the treasury parameter, so the treasury could be mistakenly set to the zero address. This could cause loss of funds if the treasury is set incorrectly.
Submitted by cryptphi
AccountantDelegate.initialize() is missing a zero address check for treasury_ parameter, which could maybe allow treasury to be mistakenly set to 0 address.
Proof of Concept
Recommended Mitigation Steps
Add a require() check for zero address for the treasury parameter before changing the treasury address in the initialize function.
Alex the Entreprenerd (judge) commented:
Because:
- The finding is technically correct
- The
treasuryvariable is only set on the initializer- An incorrect setting could cause loss of funds
I’m going to mark the finding as valid and of Medium severity.
In mentioning this report in the future, notice that the conditions that caused me to raise the severity weren’t simply the lack of a check, but the actual risk of loss of funds, and the inability to easily fix.
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
Likely the initialize function does not validate that the treasury_ parameter is not the zero address before assigning it.
Impact
If the treasury is set to the zero address, funds could be lost and the mistake may be difficult to fix.
What the attacker needed
None
The fix
Add a require() check that the treasury parameter is not the zero address before setting it in the initialize function.
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.
In smart contracts, the zero address is a special address that no one controls. If a contract sets an important address (like a treasury) to zero by mistake, any funds sent there are lost forever. This report says the code that sets the treasury address does not check for zero, so a mistake could lock funds.
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.