The $80M Tragedy of Errors
I'm certain that @Orbit_Chain's hack is due to two reasons:
#1. Weak Validation in the "withdraw" Function
The function does not adequately validate the token parameter, nor does it ensure that the withdrawal amount (uints[0]) is available in the vault. This allows for potential exploitation where unauthorized tokens can be withdrawn.
The withdraw function does check signatures, chain IDs, used withdrawals, etc., to validate the request. But it missing some critical checks:
-- There is no check on the token parameter passed. An exploiter can specify any token address they want to withdraw
-- There is no check that the uints[0] (amount) matches the actual vault balance of that token
-- It directly transfers out tokens based on the parameters supplied without verifying if the 'msg.sender' actually has the right to withdraw that token and the amount. Anyone can call and pass any token to withdraw
This vulnerability doesn't just open the door for a single instance of exploitation but can be repeatedly abused, potentially draining the vault of various tokens, which is what happened as $30M USDT, $10M DAI, and $10M USDC), 231 wBTC (~$10M), and 9,500 ETH (~$21.5M) were exploited. (Links in the comments)
It also does not check whether Vault balances >= withdrawal amounts for that token. This, in turn, allows overdrawing arbitrary amounts of any token. This means the access controls and vault balance protections are bypassed entirely.
#2. Insufficient Signature Validation in "_validate" Function
This function does not check whether the signatures are directly associated with the specific withdrawal details, nor does it ensure that the number of valid signatures meets the required threshold.
The '_validate' function also has two main flaws:
-- It does not actually validate signatures match the withdrawal data. It only checks that the signers are valid owners. This allows the exploiter to construct fake signatures using any owner private keys.
-- It counts valid signatures without checking if the final count reaches the required threshold. This allows withdrawals with less signatures than expected.
The transfer happens based purely on unvalidated external input. This allows exploiter to create and withdraw payload packets with:
-- Any token addresses
-- Any withdrawal amounts
-- Any recipient addresses
And steal funds without proper authorization or balances.
So I'm assuming that the combination of these two flaws would have let an exploiter create fake signatures for a withdrawal transaction using a small number of compromised owner keys. So there might be some private key compromises here.
This is how it could have happened (Refer to the diagram below):
1. The exploiter obtains a few private keys of the contract owners. Complete compromise isn't necessary due to the weak signature validation.
2. The exploiter creates a withdrawal request with:
- A token address that the exploiter targets.
- A withdrawal amount that may exceed the contractโs balance for that token.
- A recipient address controlled by the exploiter.
3. The exploiter uses the compromised keys to sign the withdrawal request. The _validate function verifies the signatures but does not link them to the specific details of the withdrawal request, nor does it enforce the signature count threshold.
4. Given the lack of proper validation in both the withdraw and '_validate' functions, the contract processes the withdrawal, transferring the specified tokens to the exploiter's address.
5. The exploiter successfully withdraws an arbitrary amount of tokens, possibly more than what is stored in the vault, to any recipient address they choose, thereby draining assets from the contract without proper authorization or balance checks.
I'm speculating here on the basis of most convictions I have. But let's wait for a detailed post-mortem.
However, a private key compromise is highly likely.
One question I would ask the Orbit Team:
Were there not any alert triggers on abnormal withdrawal destinations or amounts?