Skip to content
Access control Audit finding Intermediate

anyone can create a vault by directly calling the factory

The vault factory contract lacked permission control, allowing anyone to deploy a vault. This could cause the government's attempt to register the asset to revert, and the protocol would still recognise the unauthorised vault as valid.

jonah1005 Follow

Originally disclosed on Code4rena

Submitted by jonah1005

Impact

In MochiVaultFactory.sol#L26-L37, there’s no permission control in the vaultFactory. Anyone can create a vault. The transaction would be reverted when the government tries to deploy such an asset.

As the protocol checks whether the vault is a valid vault by comparing the contract’s address with the computed address, the protocol would recognize the random vault as a valid one.

I consider this is a medium-risk issue.

Proof of Concept

Here’s a web3.py script to trigger the bug.

vault_factory.functions.deployVault(usdt.address).transact()
## this tx would be reverted
profile.functions.registerAssetByGov([usdt.address], [3]).transact()

Recommended Mitigation Steps

Recommend to add a check.

require(msg.sender == engine, "!engine");

ryuheimat (Mochi) confirmed

The original report as published on Code4rena, by jonah1005. 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 vault factory's deploy function lacked an access control check, so any address could call it.

Impact

An attacker could create an unauthorised vault that the protocol treats as valid, and the government's asset registration would revert.

What the attacker needed

None

The fix

The factory should require that the caller is the engine contract.

How it was found

  1. Call the vault factory's deploy function directly with a token address.
  2. The transaction succeeds and creates a vault.
  3. The government then tries to register the same asset, but that transaction reverts.

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.

A vault factory is a smart contract that creates new vaults. Because it had no check on who could call it, any user could create a vault. The system then treated that vault as legitimate, which could block the official registration process.

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 jonah1005

View all

39 more disclosed reports, best first.

More from Mochi contest

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.