Skip to content
Access control Audit finding Intermediate

Broken Operator Mechanism: Just 1 malicious / compromised operator can permanently break functionality

The vault's operator access control allows any single operator to set the alchemist contract to an arbitrary address and remove all other operators, including themselves. This can permanently brick claiming and liquidation, lock token holders' funds, and steal pending auction funds.

hickuphh3 Follow with 0xSmartContract, ABA and 3 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2023-02-fair-funding-judging/issues/46

Found by

hickuphh3, 0xSmartContract, ABA, csanuragjain, weeeh_, rvierdiiev

Summary

Operator access control isn't sufficiently resilient against a malicious or compromised actor.

Vulnerability Detail

I understand that we can assume all privileged roles to be trusted, but this is about the access control structure for the vault operators. The key thing here is that you can have multiple operators who can add or remove each other. As the saying goes, "you are as strong as your weakest link", so all it required is for 1 malicious or compromised operator to permanently break protocol functionality, with no possible remediation as he's able to kick out all other honest operators, including himself

The vault operator can do the following:

  1. Set the alchemist contract to any address (except null) of his choosing. He can therefore permanently brick the claiming and liquidation process, resulting in the permanent locking of token holders' funds in Alchemix.
  2. Steal last auction funds. WETH approval is given to the alchemist contract every time register_deposit is called, and with the fact that anyone can settle the contract, the malicious operator is able to do the following atomically:
    • set the alchemist contract to a malicious implementation
      • contract returns a no-op + arbitrary shares_issued value when the depositUnderlying() function is called
    • settle the last auction (assuming it hasn't been)
    • pull auction funds from approval given
  3. Do (1) and remove himself as an operator (ie. there are no longer any operators), permanently preventing any possible remediation.

Impact

DoS / holding the users' funds hostage.

Code Snippet

https://github.com/sherlock-audit/2023-02-fair-funding/blob/main/fair-funding/contracts/Vault.vy#L292-L300 https://github.com/sherlock-audit/2023-02-fair-funding/blob/main/fair-funding/contracts/Vault.vy#L589-L614

Tool used

Manual Review

Recommendation

Add an additional access control layer on top of operators: an owner that will be held by a multisig / DAO that's able to add / remove operators.

Discussion

Unstoppable-DeFi

https://github.com/Unstoppable-DeFi/fair-funding/pull/10

HickupHH3

Fix looks good:

  • Introduced owner role with 2-step transfer process + event emissions
  • msg.sender is the initial owner
  • Operators can only be added / removed by owner

Non-zero add check isn't necessary IMO, since the zero add will then have to claim ownership. Can consider removing, but no harm leaving it either

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

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 operator role has too much power with no higher-level owner or multisig to override or remove a malicious operator.

Impact

A single malicious operator could permanently disable claiming and liquidation, locking token holders' funds, and could steal the last auction's funds.

What the attacker needed

Be an operator; last auction not yet settled

The fix

The fix was to add an owner role, held by a multisig or DAO, that is the only one able to add or remove operators.

How it was found

  1. An operator sets the alchemist contract to a malicious address.
  2. The malicious contract returns a no-op and arbitrary shares_issued when depositUnderlying is called.
  3. The operator settles the last auction if it hasn't been settled.
  4. The operator pulls the auction funds using the approval given to the alchemist contract.
  5. The operator removes all other operators, including themselves, leaving no operators.

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 is a smart contract that holds funds. Operators are special users who can change settings. The problem is that any one operator can change a critical setting to a bad address and then remove all other operators, so nobody can fix it afterwards.

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 hickuphh3

View all

43 more disclosed reports, best first.

More from Fair Funding by Alchemix & Unstoppable

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.