26236 - [SC - Insight] Malicious DeGate Operator EOA can irreversibly ...
Submitted on Nov 29th 2023 at 00:53:43 UTC by @ongrid for Boost | DeGate
Report ID: #26236
Report type: Smart Contract
Report severity: Insight
Target: https://etherscan.io/address/0x9C07A72177c5A05410cA338823e790876E79D73B#code
Impacts:
Irreversible stop of Exchange
Prevent new users from registering (Zero Knowledge Proof Circuit)
Permanent freezing of unclaimed rewards
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Contract fails to deliver promised returns, but doesn't lose value
Force DeGate into Exodus Mode
The account cannot be used (Zero Knowledge Proof Circuit)
Temporary freezing of funds: Minimum freezing of 15 days (Zero Knowledge Proof Circuit)
Description
Bug Description
The current ExchangeProxy at 0x9C07A72177c5A05410cA338823e790876E79D73B
is managed by LoopringIOExchangeOwner
0x9b93e47b7F61ad1358Bd47Cd01206708E85AE5eD, which is in turn controlled by an Externally Owned Account (EOA)
0xacD3A62F3eED1BfE4fF0eC8240d645c1F5477F82`. This setup poses significant security risks due to centralized control, allowing the key holder to unilaterally modify critical contract parameters and potentially shut down the system irreversibly.
Impact
Irreversible System Shutdown
The DeGate Operator, using an EOA, can entirely shut down the system. This can be executed by invoking Exchange.shutdown()
through LoopringIOExchangeOwner.transact(abiEncodedCall),
as demonstrated in the testExchangeShutdown
test case.
Unilateral Modification of Critical Platform Configuration Parameters
In the testSetMaxAgeDepositUntilWithdrawable
and testExchangeSetDepositParams
tests, it's shown how the operator can change key Exchange settings via the same call chain initiated from their EOA.
Risk Breakdown
Difficulty to Exploit: Easy
Recommendation
To mitigate centralized control risks, Exchange's ownership (not just the proxy facade but also the business logic) should be restructured:
Transfer Ownership to Multisig: Change the ownership of LoopringIOExchangeOwner to a Gnosis Multisig wallet, distributing control among multiple parties.
Consider Using Timelock: Use Timelock contract as the owner to introduce a delay in critical operations, enhancing transparency.
Proof of concept
I have created a forge test, functioning on an Ethereum mainnet fork using the addreses of the live contracts. The file demonstrating vulnerabilities is MaliciousOperatorStopsExchangeContract.t.sol