Skip to content
Access control Audit finding Intermediate

Registry.sol fails to deliver expected functionality

The proxy registry stored ownership data separately from the proxy, so ownership transfers were not reflected in the registry. This could let a new owner lose access to vault funds while the old owner retained privileged access to automation configuration.

byndooa Follow

Originally disclosed on Code4rena

*Submitted by byndooa, also found by arcoun, cccz, Lambda, and thebensams*

[https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxyFactory.sol#L40-L58](https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxyFactory.sol#L40-L58)

[https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxyRegistry.sol#L39-L59](https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxyRegistry.sol#L39-L59)

### Impact

The description of Registry.sol is following:

/// Deploys new proxies via the factory and keeps a registry of owners to proxies. Owners can only /// have one proxy at a time. But it is not. There are multiple problems:

1. Proxy owner can change and will not be registered
2. There many ways for an owner to have many proxies:
3. A few other proxy owners transferOwnership() to one address.
4. Registry tracks last deployments and does not guarantee ownership.
5. Factory.sol allows calling deployFor() to anyone, without any checks and registrations.

### Proof of Concept

[https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxyFactory.sol#L40-L58](https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxyFactory.sol#L40-L58)

[https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxyRegistry.sol#L39-L59](https://github.com/code-423n4/2022-08-mimo/blob/eb1a5016b69f72bc1e4fd3600a65e908bd228f13/contracts/proxy/MIMOProxyRegistry.sol#L39-L59)

### Tools Used

Hardhat

### Recommended Mitigation Steps

Delete `Proxy.transfetOwnership()`.

Disallow anyone to call `deploy()` and `deployFor()` in `Factory()`.

**[RnkSngh (Mimo) confirmed and commented](https://github.com/code-423n4/2022-08-mimo-findings/issues/78#issuecomment-1210585639):**

> We agree that this is an issue and intend to fix this.

**[gzeoneth (judge) increased severity to High and commented](https://github.com/code-423n4/2022-08-mimo-findings/issues/78#issuecomment-1221553605):**

> I believe this is High Risk due to the unexpected ownership behavior.

**[m19 (Mimo) commented](https://github.com/code-423n4/2022-08-mimo-findings/issues/78#issuecomment-1223658600):**

> While the Registry indeed does not work as advertised, I am not sure if high risk is the correct here? As per [the definition](https://docs.code4rena.com/awarding/judging-criteria#estimating-risk) “Assets can be stolen/lost/compromised directly (or indirectly if there is a valid attack path that does not have hand-wavy hypotheticals).” I don’t think that applies here.
>
>
>
> We also see no way `Proxy owner can change and will not be registered` actually can happen which would be the only scenario there is a loss of funds.

**[gzeoneth (judge) commented](https://github.com/code-423n4/2022-08-mimo-findings/issues/78#issuecomment-1223956313):**

> I am quite sure asset can be lost if the owner cannot do owner stuff and a non-owner can do owner stuff. Also see related PoC in e.g. [#154](https://github.com/code-423n4/2022-08-mimo-findings/issues/154), [#67](https://github.com/code-423n4/2022-08-mimo-findings/issues/67), [#69](https://github.com/code-423n4/2022-08-mimo-findings/issues/69)

**[m19 (Mimo) commented](https://github.com/code-423n4/2022-08-mimo-findings/issues/78#issuecomment-1224011441):**

> @gzeoneth Thanks, I get it now, [#154](https://github.com/code-423n4/2022-08-mimo-findings/issues/154) describes it much better. Yes, this is definitely a high-risk issue then.

**horsefacts (warden) reviewed mitigation:**

> **Status:** �
 Resolved

> **Finding:** Wardens identified that both `MIMOProxy` and `MIMOProxyRegistry` stored proxy ownership data, but ownership transfers were not propagated from `MIMOProxy` to the `MIMOProxyRegistry`. This would cause new owners to lose access to vault funds and old owners to retain privileged access to automation configuration.

> **What changed:** The Mimo team removed the `owner` state variable and `transferOwner` function from `MIMOProxy`. Additionally, they removed `MIMOProxyRegistry` altogether and moved its functionality to `MIMOProxyFactory`. Ownership data is now stored only in `MIMOProxyFactory`, and all ownership transfers must now be performed by calling `MIMOProxyFactory#transferOwnership` rather than interacting with `MIMOProxy`.

> `MIMOProxyFactory` now stores [a mapping](https://github.com/mimo-capital/2022-08-mimo/blob/4e579420ecbe3fc3e770996610e6ab66b0c8d15b/contracts/proxy/MIMOProxyFactory.sol#L20) of proxy address to `ProxyState`, a struct that includes the current owner address. The `claimOwnership` function updates both [the owner address](https://github.com/mimo-capital/2022-08-mimo/blob/4e579420ecbe3fc3e770996610e6ab66b0c8d15b/contracts/proxy/MIMOProxyFactory.sol#L105) and the [current proxy](https://github.com/mimo-capital/2022-08-mimo/blob/4e579420ecbe3fc3e770996610e6ab66b0c8d15b/contracts/proxy/MIMOProxyFactory.sol#L104) when a new user accepts ownership. A [unit test](https://github.com/mimo-capital/2022-08-mimo/blob/4e579420ecbe3fc3e770996610e6ab66b0c8d15b/test/01_unit/proxy/MIMOProxyFactory.test.ts#L89) demonstrates this behavior.

> An [integration test](https://github.com/mimo-capital/2022-08-mimo/blob/51a3092e4dd62f36de8fb16d15f5dec756cc9ae0/test/02_integration/proxy/MIMOProxyGuard.test.ts) demonstrates that proxy permissions are cleared after ownership transfers.

> In its authorization check in the `execute` function, `MIMOProxy` [reads from the proxy factory](https://github.com/mimo-capital/2022-08-mimo/blob/4e579420ecbe3fc3e770996610e6ab66b0c8d15b/contracts/proxy/MIMOProxy.sol#L38) to determine the [current owner address](https://github.com/mimo-capital/2022-08-mimo/blob/4e579420ecbe3fc3e770996610e6ab66b0c8d15b/contracts/proxy/MIMOProxy.sol#L41). Client contracts [MIMOEmptyVault](https://github.com/mimo-capital/2022-08-mimo/blob/5186ef4be23f9dda81c8474096edb1f0594d70c3/contracts/actions/MIMOEmptyVault.sol#L74), [MIMOLeverage](https://github.com/mimo-capital/2022-08-mimo/blob/5186ef4be23f9dda81c8474096edb1f0594d70c3/contracts/actions/MIMOLeverage.sol#L79), [MIMORebalance](https://github.com/mimo-capital/2022-08-mimo/blob/5186ef4be23f9dda81c8474096edb1f0594d70c3/contracts/actions/MIMORebalance.sol#L76), [MIMOAutoAction](https://github.com/mimo-capital/2022-08-mimo/blob/5186ef4be23f9dda81c8474096edb1f0594d70c3/contracts/actions/automated/MIMOAutoAction.sol#L37), and [MIMOManagedAction](https://github.com/mimo-capital/2022-08-mimo/blob/5186ef4be23f9dda81c8474096edb1f0594d70c3/contracts/actions/managed/MIMOManagedAction.sol#L36) now read the current proxy from `MIMOProxyFactory`.

> **Why it works:** Since `MIMOProxyFactory` is now the single source of truth for `MIMOProxy` ownership, this data cannot fall out of sync across contracts. Since client contracts call `MIMOProxyFactory#getCurrentProxy`, they will correctly read the current proxy address.

---

The original report as published on Code4rena, by byndooa. 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 ownership state was duplicated in two contracts and transfers were not synchronised between them.

Impact

A new owner could lose access to vault funds and the old owner could retain privileged access to automation configuration.

What the attacker needed

Ownership transfer occurs; proxy and registry both deployed

The fix

The team removed the duplicate ownership state and registry, making the factory the single source of truth for ownership and routing all transfers through it.

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 smart contract kept two separate records of who owns each proxy: one in the proxy itself and one in a registry. When ownership changed in the proxy, the registry was not updated, so the two records disagreed. This meant the real new owner could be locked out of funds while the previous owner still had control over automated settings.

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 from Mimo DeFi 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.