I hacked Parity Multisig Wallet — Ropsten Network

Nguyen Sy Thanh Son
TomoChain
Published in
3 min readNov 9, 2017

Parity MultiSig Wallet was hacked in 7 November 2017 (see the details here https://paritytech.io/blog/security-alert.html). The hack destroyed 1% of Ethereum’s valuation.

Today, I try to investigated the vulnerability and re-do exactly what hacker did with Parity Wallet’s smart contract.

There are two main steps I need to do:

  • Create Parity Multisig Wallet in Ropsten Testnet
  • Try to hack it

I recorded all steps I did in the video.

https://www.youtube.com/watch?v=qGWdBRU9-g0

At the first step, I red the source code of Multisig Wallet. Parity Multisig Wallet contains two main contracts — Wallet Contract and WalletLibrary Contract. Wallet Contract stores ETH, WalletLibrary contains functions to implement almost features of a multisig wallet.

After understanding a little bit, I tried to deploy the MultiSig Wallet to Ropsten Testnet using Remix IDE and Metamask

Now, I show you the steps to deploy the contracts.

Step 1: Installation

Open Metamask, select Ropsten Network, create two account (User Accout and Hacker Account) and get free ETH.

Open Remix IDE, select Solidity compiler version `soljson-v0.4.10+commit.f0d539ae.js`. Create file Wallet.sol and copy/paste the source code to the file.

Step 2: User deploys WalletLibrary Contract

On Metamask, select User Account. In Remix IDE, select WalletLibrary Contract and click create button to deploy. Waiting for the deployment finished.

After that, copy the address of WalletLibrary (with me, it is 0x6bc323538bad65bbde22f908f9a8f180ea4078fe) and paste it into line 448 in Wallet.sol file. This step means we link Wallet Contract to WalletLibrary Contract that we just deployed.

Step 3: User deploys Wallet Contract

Wallet Contract has some constructor parameters, so we need to complete it. In my case, it is ["0xd088d9c6abb936260BF4540026C8F0aDFfD09836"], 1, 1000. `0xd088d9c6abb936260BF4540026C8F0aDFfD09836` is User Account Address.

Now click create button to deploy the Wallet Contract. This contract is multi-signature wallet and store ETH.

Step 4: What hacker did?

This step, I will do things like Hacker did.

I open Metamask, select Hacker Account. I open Remix IDE, copy/paste the source code to Wallet.sol file. I do not need to deploy WalletLibrary contract again (Hacker was same). In Remix IDE, I select WalletLibrary Contract, and copy/paste the address of Wallet Library to address textbox and click address button. Now I have WalletLibrary Contract in my IDE.

Now, I run initWallet function

And run kill function.

So the WalletLibrary was died.

Conclusions

I think that hacker do not want to burn 500.000 ETH. He just want to send 500.000 ETH to his wallet, so he called kill function. Because I checked kill function source code:

function kill(address _to) onlymanyowners(sha3(msg.data)) external {
suicide(_to);
}

It means that if kill function is called, the contract will be died and send all the balance to his wallet. But he had a mistake. 500.000 ETH is not stored in WalletLibrary Contract, It is stored in Wallet Contract. So the result is 500.000 ETH was frozen, and he got nothing.

That is a bad day with Ethereum Community and hacker as well.

References

Parity Multisig Hacked. Again

Parity Multi-sig wallets funds frozen (explained)

See on my blog: https://sonnguyen.ws/hacked-parity-multisig-wallet-ropsten-testnet/

--

--