Skip to content
Misconfiguration Audit finding Intermediate

Pool designed to be upgradeable but does not set owner, making it un-upgradeable

The Pool contract is designed as an upgradeable proxy but lacks an initializer to set its owner, leaving the owner address as zero. As a result, the onlyOwner check in the upgrade authorization always reverts, making the contract permanently unupgradeable.

Trust Follow

Originally disclosed on Code4rena

Submitted by Trust, also found by 0xDecorativePineapple, adriro, bin2chen, fs0c, hihen, neko_nyaa, philogy, and wait

The docs state: ”The pool allows user to predeposit ETH so that it can be used when a seller takes their bid. It uses an ERC1967 proxy pattern and only the exchange contract is permitted to make transfers.”

Pool is designed as an ERC1967 upgradeable proxy which handles balances of users in Not Fungible. Users may interact via deposit and withdraw with the pool, and use the funds in it to pay for orders in the Exchange.

Pool is declared like so:

contract Pool is IPool, OwnableUpgradeable, UUPSUpgradeable {
	function _authorizeUpgrade(address) internal override onlyOwner {}
	...

Importantly, it has no constructor and no initializers. The issue is that when using upgradeable contracts, it is important to implement an initializer which will call the base contract’s initializers in turn. See how this is done correctly in Exchange.sol:

/* Constructor (for ERC1967) */
function initialize(
		IExecutionDelegate _executionDelegate,
		IPolicyManager _policyManager,
		address _oracle,
		uint _blockRange
) external initializer {
		__Ownable_init();
		isOpen = 1;
		...
}

Since Pool skips the __Ownable_init initialization call, this logic is skipped:

function __Ownable_init() internal onlyInitializing {
		__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
		_transferOwnership(_msgSender());
}

Therefore, the contract owner stays zero initialized, and this means any use of onlyOwner will always revert.

The only use of onlyOwner in Pool is here:

function _authorizeUpgrade(address) internal override onlyOwner {}

The impact is that when the upgrade mechanism will check caller is authorized, it will revert. Therefore, the contract is unexpectedly unupgradeable. Whenever the EXCHANGE or SWAP address, or some functionality needs to be changed, it would not be possible.

Impact

The Pool contract is designed to be upgradeable but is actually not upgradeable.

Proof of Concept

In the ‘pool’ test in execution.test.ts, add the following lines:

it('owner configured correctly', async () => {
	expect(await pool.owner()).to.be.equal(admin.address);
});

It shows that the pool after deployment has owner as 0x0000…00

Tools Used

Manual audit, hardhat

Recommended Mitigation Steps

Implement an initializer for Pool similarly to the Exchange.sol contract.

nonfungible47 (Blur) confirmed and commented:

initialize function was added to set the pool owner. The function is called when deploying the proxy.


The original report as published on Code4rena, by Trust. 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

The Pool contract inherits from OwnableUpgradeable but does not call __Ownable_init in an initializer, so the owner remains the zero address and onlyOwner checks always revert.

What the attacker needed

None

The fix

An initializer was added to set the pool owner, and it is called when deploying the proxy.

How it was found

  1. Deploy the Pool contract as an ERC1967 proxy.
  2. Call the owner() function on the deployed Pool contract.
  3. Observe that the returned owner is the zero address.

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.

This report is about a smart contract that is supposed to be upgradeable, meaning its code can be changed later. But because the contract never sets an owner during setup, the check that only the owner can approve upgrades always fails, so upgrades are impossible. The fix is to add an initializer that sets the owner, just like another contract in the same project does.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by Trust

View all

77 more disclosed reports, best first.

More from Blur Exchange contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.