Admin of the upgradeable proxy contract of Controller.sol can rug users
The Controller contract is an upgradeable proxy, so its admin can replace the implementation with malicious logic. That admin could then pull USDC from users' wallets up to their allowances and drain USDC held by the contract.
Submitted by WatchPug
Use of Upgradeable Proxy Contract Structure allows the logic of the contract to be arbitrarily changed.
This allows the proxy admin to perform malicious actions e.g., taking funds from users’ wallets up to the allowance limit.
This action can be performed by the malicious/compromised proxy admin without any restriction.
Considering that the purpose of this particular contract is for accounting of the Collateral and LongShortTokens, we believe the users’ allowances should not be hold by this upgradeable contract.
Proof of Concept
Given:
- collateral:
USDC
Rug Users’ Allowances
- Alice
approve()and_mintOptionsPosition()with1e8 USDC; - Bob
approve()and_mintOptionsPosition()with5e8 USDC; - A malicious/compromised proxy admin can call
upgradeToAndCall()on the proxy contract and set a malicious contract asnewImplementationand stolen all the USDC in Alice and Bob’s wallets;
Rug Contract’s Holdings (funds that belong to users)
A malicious/compromised proxy admin can just call upgradeToAndCall() on the proxy contract and send all the USDC held by the contract to an arbitrary address.
Severity
A smart contract being structured as an upgradeable contract alone is not usually considered as a high severity risk. But given the severe impact (all the funds in the contract and funds in users’ wallets can be stolen), we mark it as a High severity issue.
Recommended Mitigation Steps
Consider using the non-upgradeable CollateralToken contract to hold user’s allowances instead.
See also our Recommendation in issue #49.
0xca11 (Rolla) confirmed, resolved, and commented:
Resolved with the removal of the previous access control role-based system: RollaProject/quant-protocol#90.
alcueca (judge) decreased severity to Medium and commented:
Assets are not directly at risk, as a governance attack must happen first. Downgraded to medium.
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 design puts user token allowances and contract holdings behind an upgradeable proxy whose admin can change the implementation without restriction.
Impact
A malicious or compromised proxy admin could steal all USDC held by the contract and USDC from users' wallets up to their allowances; the judge downgraded this to medium because a governance attack must happen first.
What the attacker needed
Malicious or compromised proxy admin; users have approved USDC allowances; contract holds USDC
The fix
The issue was resolved by removing the previous access control role-based system, and the report recommends holding user allowances in a non-upgradeable contract.
How it was found
- Alice approves and mints an options position with 1e8 USDC.
- Bob approves and mints an options position with 5e8 USDC.
- A malicious or compromised proxy admin calls upgradeToAndCall to set a malicious implementation.
- The malicious implementation takes the USDC from Alice's and Bob's wallets.
- The admin can also send all USDC held by the contract to an arbitrary 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.
An upgradeable contract lets an admin swap the code behind a fixed address. Here the admin could point it at code that moves users' approved tokens and the contract's own funds. The report argues that because this contract only tracks balances, it should not hold those approvals.
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.