Skip to content
Access control Audit finding Beginner

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.

cryptphi Follow

Originally disclosed on Code4rena

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

https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Accountant/AccountantDelegate.sol#L20

Recommended Mitigation Steps

Add a require() check for zero address for the treasury parameter before changing the treasury address in the initialize function.

nivasan1 (Canto) confirmed

Alex the Entreprenerd (judge) commented:

Because:

  • The finding is technically correct
  • The treasury variable 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.


The original report as published on Code4rena, by cryptphi. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by cryptphi

View all

7 more disclosed reports, best first.

More from Canto

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.