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.

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

Step 2: User deploys WalletLibrary Contract

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:

1

2

3

functionkill(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.