Centralization risks: owner can freeze withdraws and use timelock to steal all funds
The protocol's owner has broad powers, including the ability to freeze withdrawals by withholding signed prices, and can use these powers to drain all funds from the StableVault. An attacker who compromises the owner's wallet could steal all user funds.
0xA5DF Follow with 0xSmartContract, francoHacker and 32 others
Originally disclosed on Code4rena
Submitted by 0xA5DF, also found by 0xSmartContract, francoHacker, rbserver, kwhuo68, yjrwkk, 0xNazgul, peanuts, wait, ladboy233, hansfriese, philogy, Mukund, 0xA5DF, 141345, carlitox477, Madalad, jadezti, cccz, SmartSek, chaduke, hihen, gz627, 0xbepresent, Ruhum, 8olidity, Faith, imare, HE1M, 0xdeadbeef0x, aviggiano, JohnnyTime, orion, Englave, and gzeon
The project heavily relies on nodes/oracles, which are EOAs that sign the current price.
Since all functions (including withdrawing) require a recently-signed price, the owner(s) of those EOA can freeze all activity by not providing signed prices.
I got from the sponsor that the owner of the contract is going to be a timelock contract. However, once the owner holds the power to pause withdrawals - that nullifies the timelock. The whole point of the timelock is to allow users to withdraw their funds when they see a pending malicious tx before it’s executed. If the owner has the power to freeze users’ funds in the contract, they wouldn’t be able to do anything while the owner executes his malicious activity.
Besides that, there are also LP funds, which are locked to a certain period, and also can’t withdraw their funds when they see a pending malicious timelock tx.
Impact
The owner (or attacker who steals the owner’s wallet) can steal all user’s funds.
Proof of Concept
-
The fact that the protocol relies on EOA signatures is pretty clear from the code and docs
-
The whole project relies on the ‘StableVault’ and ‘StableToken’
- The value of the ‘StableToken’ comes from the real stablecoin that’s locked in ‘StableVault’, if someone manages to empty the ‘StableVault’ from the deposited stablecoins the ‘StableToken’ would become worthless
-
The owner has a few ways to drain all funds:
-
Replace the minter via
StableToken.setMinter(), mint more tokens, and redeem them viaStableVault.withdraw() -
List a fake token at
StableVault, deposit it and withdraw real stablecoin -
List a new fake asset for trading with a fake chainlink oracle, fake profit with trading with fake prices, and then withdraw
- They can prevent other users from doing the same by setting
maxOiand opening position in the same tx
- They can prevent other users from doing the same by setting
-
Replace the MetaTx forwarder and execute tx on behalf of users (e.g. transferring bonds, positions and StableToken from their account)
-
Recommended Mitigation Steps
-
Rely on a contract (chainlink/Uniswap) solely as an oracle
-
Alternately, add functionality to withdraw funds at the last given price in case no signed data is given for a certain period
- You can do it by creating a challenge in which a user requests to close his position at a recent price, if no bot executes it for a while it can be executed at the last recorded price.
-
As for LPs’ funds, I don’t see an easy way around it (besides doing significant changes to the architecture of the protocol), this a risk LPs should be aware of and decide if they’re willing to accept.
TriHaz (Tigris Trade) acknowledged, but disagreed with severity and commented:
We are aware of the centralization risks. Owner of contracts will be a timelock and owner will be a multi sig to reduce the centralization for now until it’s fully controlled by DAO.
Alex the Entreprenerd (judge) decreased severity to Medium and commented:
Missing setFees, but am grouping generic reports under this one as well.
Also missing changes to Trading Extension and Referral Fees.
This report, in conjunction with #648 effectively covers all “basic” admin privilege findings. More nuanced issues are judged separately.
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 owner has unchecked privileges such as setting the minter, listing tokens, and controlling the price oracle, combined with the ability to freeze withdrawals by not providing signed prices.
What the attacker needed
Owner is malicious or compromised; owner can withhold signed prices
The fix
The protocol should rely solely on a decentralised oracle such as Chainlink or Uniswap, and add a fallback mechanism to withdraw funds at the last given price if no signed data is provided for a certain period; for LP funds, the risk should be acknowledged.
How it was found
- The owner replaces the minter via StableToken.setMinter(), mints more tokens, and redeems them via StableVault.withdraw().
- The owner lists a fake token at StableVault, deposits it, and withdraws real stablecoin.
- The owner lists a new fake asset for trading with a fake chainlink oracle, fakes profit with trading with fake prices, and then withdraws.
- The owner prevents other users from doing the same by setting maxOi and opening a position in the same transaction.
- The owner replaces the MetaTx forwarder and executes transactions on behalf of users, e.g. transferring bonds, positions and StableToken from their account.
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.
In this system, a privileged account (the owner) can stop users from taking their money out and can also perform actions that empty the pool of deposited funds. If that account is stolen or misused, everyone's money is at risk. This is a centralisation risk because too much power sits with one party.
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.