On 18th July 2024, WazirX, a prominent cryptocurrency exchange, experienced a catastrophic security breach resulting in a loss of over $235 million. The attack was meticulously planned and executed over 10 days, ultimately compromising their multisig wallet by upgrading it to a malicious implementation.
This detailed report provides an in-depth analysis of how the hack occurred, the specific vulnerability exploited, the current efforts by WazirX to resolve the situation, and how they could have prevented this from happening.
These were minted through the Gnosis Safe Proxy contract and sent to the attacker's wallet
At the time of writing, the attacker’s primary wallet holds $148,899,745.12 with major holding in 43.8k ETH. Rest of the altcoins are sold for ETH.
Another major account
holds $66,280,399.07 with 15.296k ETH
The attackers deployed a phishing smart contract designed to mimic a legitimate Safe Implementation Skeleton. This contract, although seemingly innocuous, contained malicious code aimed at exploiting the multisig wallet. The contract’s sole function was to divert funds from the multisig wallet to the attackers’ address.
It was deployed on July 10th at 07:37:47 UTC, 8 days before the final exploit, indicating that the whole exploit was well-panned from the start.
Multisig wallets typically require multiple signatures from authorized team members to approve transactions. The WazirX multisig wallet had 6 signatories: 5 from WazirX and 1 from Liminal. To exploit this, the attackers compromised the necessary private keys using a combination of methods:
Phishing for Signatures: The attackers tricked the remaining signers into approving transactions they believed to be legitimate. This was possibly executed through a compromised Liminal’s UI, which displayed seemingly legitimate transaction details. In reality, the attackers had swapped the actual contract with their phishing contract, designed to mimic a legitimate Safe Implementation Skeleton. This allowed them to gain the necessary approvals and siphon funds from the wallet.
To gather the necessary signatures without raising suspicion, the attackers initiated a fake USDT transfer. The USDT Transfer Attempt was crafted to fail but was designed to collect the required signatures.
The transaction failed, but the attackers obtained the signatures needed for their malicious transaction.
The multisig wallet was implemented using a proxy pattern. In this pattern, the multisig wallet (proxy) doesn't directly contain the actual business logic or code. Instead, it points to an implementation contract where the actual logic or code resides. The proxy has a storage slot that contains the address of the current implementation contract.
With the collected signatures, the attackers executed a delegate call from the multisig wallet to their malicious contract, altering the slot0 of the multisig proxy to point to the phishing contract address.
Delegate Call Data: 0x804e1f0a000000000000000000000000ef279c2ab14960aa319008cbea384b9f8ac35fc6
The first 4 bytes, 0x804e1f0a
, correspond to the function selector of the target contract's function that the delegate call is invoking. This is typically derived from the function's signature.
The remaining bytes, 000000000000000000000000ef279c2ab14960aa319008cbea384b9f8ac35fc6
, represent the parameter(s) passed to the function. In this case, the parameter is an address 0xef279c2ab14960aa319008cbea384b9f8ac35fc6
.
So, this delegate call data means the multisig contract is executing a function (identified by the selector 0x804e1f0a) on the phishing contract address 0xef279c2ab14960aa319008cbea384b9f8ac35fc6
, with this address as the parameter.
This delegate call changed the multisig wallet’s implementation to the malicious contract, redirecting all subsequent transactions.
Using tools like evm.storage, it was observed that the slot0 of the multisig proxy was changed from the standard Safe Implementation to the new phishing contract. This modification gave the malicious contract control over the multisig’s funds.
Once the multisig wallet was upgraded to the malicious contract, the attackers began to transfer all funds from the multisig wallet to their own wallet. Transactions involving significant amounts, such as 95 million worth of Shiba Inu ($SHIB) tokens, were executed.
From this point forward, every transaction to the Safe Multisig redirected a delegate call
to the new malicious implementation address. This allowed the attackers to continuously transfer funds from the multisig wallet.
The attack exploited a flaw in the multisig wallet’s contract upgrade mechanism. The attackers deployed a phishing smart contract that mimicked a legitimate Safe Implementation Skeleton, which is basically a template or base contract for the Gnosis Safe. This tricked the signers into approving it. This contract replaced the genuine implementation with a malicious version that redirected all subsequent transactions to the attackers.
By compromising the multisig signers through phishing tactics and a fake Liminal UI, the attackers gathered the necessary 4 signatures out of 6 to execute the malicious contract upgrade. Specifically, they directly compromised 2 WazirX signers and tricked 1 WazirX signer and the Liminal signer using the fake UI. Once the contract was swapped with their malicious version, the attackers gained control of the wallet, allowing them to transfer all the assets from the Multisig wallet to their own wallet.
Demixing the Tornado Cash transactions revealed matching deposits made the day before from another address.
WazirX emphasized their commitment to transparency and outlined the incident in detail:
Liminal clarified that their platform was not breached:
The WazirX multisig wallet required four out of six signers to approve transactions, with five signatories from WazirX and one from Liminal. The attackers managed to compromise two WazirX signatories directly. How they achieved this remains unclear—whether it was through a fake app wallet UI, insiders, or other methods is unknown. The third WazirX signer and the Liminal signer were compromised via a fake Liminal UI, which displayed legitimate transaction details while executing malicious contracts.
WazirX blames Liminal for the breach, while Liminal points the finger back at WazirX. If the Liminal signer hadn't been compromised, it would imply that all four compromised signers were from WazirX. This raises the critical, yet unanswered question: how did the attackers gain direct access to two WazirX signers?
The attack couldn't have succeeded without compromising the signers' EOAs and/or phishing for specific signatures. If the attackers had full access to all the signer keys, they likely wouldn't have executed the attack in this manner. This should concern anyone using multisigs, even with hardware wallets, as it shows the effort attackers are willing to exert.
Unlike many prior cases where keys were easily accessible, these attackers had to work to pull this off. One notable tactic was continuously withdrawing a low-volume token from the exchange to prompt the team to initiate transactions from their cold storage wallet.
There are several indicators suggesting the potential involvement of the Lazarus Group in this attack, although conclusive evidence is yet to be found.
0.034 BTC from one of the transactions was traced to the Coincheck exchange, which has previously been used by the Lazarus Group to launder stolen funds.
Another 0.0198 BTC transaction was traced to a darknet OTC service, often frequented by organized cybercriminal groups like the Lazarus Group. This provides a strong hint towards their involvement.
The attackers deployed the phishing contract on July 10th at 07:37:47 UTC, eight days before the final exploit, indicating careful planning and premeditation. This level of sophistication is characteristic of the Lazarus Group.
The Lazarus Group has a well-documented history of targeting cryptocurrency platforms and has been linked to multiple high-profile crypto heists. The tactics used in this attack, such as phishing for signatures and compromising multiple layers of security, are consistent with their modus operandi.
In light of the recent attack, there are several security measures that organizations can implement to mitigate risks associated with multisig wallets and smart contracts:
Implement robust key management practices, including the use of hardware wallets and multi-factor authentication (MFA). Key management should ensure that private keys are stored securely and accessed only by authorized personnel.
Conduct regular security audits using advanced tools to identify and address vulnerabilities in the smart contracts and wallet infrastructure. Audits from popular firms like QuillAudits should cover all aspects of the system, including the multisig wallet configurations and the underlying smart contracts.
Establish strict procedures for validating transactions before signing. Signers should be trained to verify transaction details independently, ensuring that the transaction data displayed on the interface matches the intended transaction.
Encourage and facilitate self-custody solutions for users. This empowers users to have direct control over their assets, reducing reliance on third-party custody services and enhancing overall security. Self-custody solutions, combined with user education on secure practices, can significantly mitigate the risk of centralized points of failure.
Get Pure Alpha Straight to Your Inbox. Miss this, and you’re missing out.
Insider Secrets - Delivered Right to You. Subscribe now.