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:
- Set the
alchemistcontract 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. - Steal last auction funds. WETH approval is given to the
alchemistcontract every timeregister_depositis 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_issuedvalue when thedepositUnderlying()function is called
- contract returns a no-op + arbitrary
- settle the last auction (assuming it hasn't been)
- pull auction funds from approval given
- set the alchemist contract to a malicious implementation
- 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
ownerrole with 2-step transfer process + event emissions msg.senderis the initialowner- 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
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
- An operator sets the alchemist contract to a malicious address.
- The malicious contract returns a no-op and arbitrary shares_issued when depositUnderlying is called.
- The operator settles the last auction if it hasn't been settled.
- The operator pulls the auction funds using the approval given to the alchemist contract.
- 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.