code-423n4 / 2022-12-tigris-findings

8 stars 4 forks source link

Centralization risks: owner can freeze withdraws and use timelock to steal all funds #377

Open code423n4 opened 1 year ago

code423n4 commented 1 year ago

Lines of code

https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/Trading.sol#L222-L230 https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/StableVault.sol#L78-L83 https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/StableToken.sol#L38-L46 https://github.com/code-423n4/2022-12-tigris/blob/496e1974ee3838be8759e7b4096dbee1b8795593/contracts/PairsContract.sol#L48

Vulnerability details

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

Recommended Mitigation Steps

GalloDaSballo commented 1 year ago

Will most likely make this the main Admin Privilege and bulk every other one under it

TriHaz commented 1 year ago

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.

c4-sponsor commented 1 year ago

TriHaz marked the issue as sponsor acknowledged

c4-sponsor commented 1 year ago

TriHaz marked the issue as disagree with severity

c4-judge commented 1 year ago

GalloDaSballo changed the severity to 2 (Med Risk)

c4-judge commented 1 year ago

GalloDaSballo marked the issue as primary issue

GalloDaSballo commented 1 year ago

Missing setFees, but am grouping generic reports under this one as well

GalloDaSballo commented 1 year ago

Also missing changes to Trading Extension and Referral Fees

GalloDaSballo commented 1 year ago

This report, in conjunction with #648 effectively covers all "basic" admin privilege findings, more nuanced issues are judged separately

c4-judge commented 1 year ago

GalloDaSballo marked the issue as satisfactory

c4-judge commented 1 year ago

GalloDaSballo marked the issue as selected for report