8 ms·
So here's what happened: Parity used to have a normal multisig wallet, where every user deploys their own contract and each one is a full copy of the code. The
by DennisP 9y ago
So here's what happened: Parity used to have a normal multisig wallet, where every user deploys their own contract and each one is a full copy of the code.
They decided it'd be nice if people could have a lower transaction fee when they deployed a new wallet. So they made one master contract that has all the code. Now when you deploy a new wallet, what you actually deploy is a stub that forwards function calls to the master contract, using a "delegatecall" which lets the master execute its functions in the context of the stub contract.
However, they didn't think through how they might want to change the master contract code in this new situation. In particular, they didn't remove the selfdestruct function. Self destruct is perfectly sensible when it's your own contract that you're not using anymore, but it's not so great when it's shared code used by lots of people.
They also forgot to initialize a function setting contract ownership. Someone came along and made themselves the owner, then called the selfdestruct. They posted about it on github, apparently unaware of the full impact of what they'd just done, which was to destroy the code used by all the stub contracts deployed since July 20. Now those stubs no longer have access to functions for withdrawing the ETH they contain.
This master/stub design was also the root cause of Parity's previous multisig hack. Apparently they didn't get a clue and pay for a fresh round of external audits, which I think would have easily caught this problem. In fact, at the end of a post-mortem of the previous hack, published on July 20, they complained that they lacked funds for such things:
https://paritytech.io/blog/the-multi-sig-hack-a-postmortem.html https://paritytech.io/blog/the-multi-sig-hack-a-postmortem.h...
- mbrock 9y agoI work for a firm that does Ethereum audits and we would have demanded a complete restructuring of Parity's multisig and major simplification.
- DennisP 9y agoI also do Ethereum audits, and I agree. Parity's code is way too complicated for a contract like this.
- bitcoinmoney 9y agoI don't do ethereum audits but isn't the right thing to do here is to write your own wallet contract and have someone audit it? geeezzz people storing 10M$ ethers.. This is the analogous to the case of storing 1 million dollars in a vault with a 1$ lock.
- DennisP 9y agoI'd rather use a contract that has been around for a while storing major funds, which has several public, current audits. The Ethereum Foundation has a multisig which has been holding their funds for years, that's probably a good choice. Parity's audit was done before they made a major architectural change. I do think there's a need for a much simpler standard multisig than the ones being used now.
- VoR0220 9y agoThat requires getting an ed25519 implementation in there with the ability to multisig into contracts. That's what a standard would be if there was to be one.
- DennisP 9y agoBy "simpler multisig" I just meant a normal multisig contract with less functionality, where the keys still separately call contract functions and update state. True multisig transactions like you're talking about are supposed to become possible with the next Ethereum upgrade.
- insulanian 9y agoCan you PM me the contact? We're looking for auditors for our code.
- insulanian 9y agoCan you PM me the contact? We're looking for auditors for our code.
- ChuckMcM 9y agoThank you, nice concise explanation. In an enterprise or company, when it is growing from startup to market gorilla, there are often tales of screw ups like this that happened to some poor sysadmin or programmer. And the company develops a sort of genetic memory of what not to do. Like children, companies that learn the 'dangerous' things early before they can do real harm, grow up to be less likely to do something really stupid later in their existence. But I don't know what vector could be used to pass this sort of cultural knowledge between ethereum contract writers from generation to generation. It needs a 'book of sins' that everyone can read and contribute to in order to insure that new contracts won't suffer the problems of the early ones.
- DennisP 9y agoOne effort along these lines is the Consensys best practices document: https://consensys.github.io/smart-contract-best-practices/ https://consensys.github.io/smart-contract-best-practices/
- ChuckMcM 9y agoThat looks like it is headed in the right direction. I observe that in companies there are stories (often with particpant's names) which exemplify bad practices. Part of the motivation to do better seems to come from not wanting to be the person in one of these stories.
- Arnavion 9y ago>They posted about it on github, apparently unaware of the full impact of what they'd just done Ref: https://github.com/paritytech/parity/issues/6995 https://github.com/paritytech/parity/issues/6995
- doubleorseven 9y agoThank you for that. Just to make one thing clear, the person who destroyed the contract was after people's money. He posted a list of contract addresses in the github issue, most of them look like ICO wallets, with a transaction made the time before he destroyed the contract. The transaction was from him to his wallet trying to drain the wallets. After he failed to he went to the destroy function thinking it will propagate to the wallets and moving the funds to him ( this part is just a theory ) or he is just a jerk who wanted to see the world burn.
- charlesdm 9y agoFrankly, the fact whether or not it was malicious doesn't matter. The original developers fucked up, and there is no genuine excuse for that (regardless of the fact whether or not he was able to steal those funds). This probably could have been fixed with basic testing.
- vesinisa 9y agoThis I don't understand about Ethereum. Just look at all the companies like Microsoft or Apple with millions to spare, or massive community efforts like Linux kernel, either with no shortage of means and resources to make their systems resistant to simple programming bugs. But history clearly shows that no amount of processes, audits, static analysis or eyepairs help: bugs just keep on being found where ever security folks look for them, and the harder they look, the more they find. Upside is, these systems can be patched, which is comforting as clearly there just is no bug-free code. Yet, people keep on pouring millions of dollars worth of virtual tokens to these experimental blockchain systems that are fundamentally designed so that any bug of certain class means the money is forever, irreversibly lost - as if these crypto contracts were some mythical new breed of software written by infallible Gods.
- zanny 9y agoThis is why Rust is so promising. The problem at Apple / MS / Linux / etc is they are massive houses built on bare foundations. Everything traces its roots back to C, and back to exploitative vulnerabilities in the code. Rust itself is not close to safe since it depends on LLVM which itself can be a source of myriad bugs related to C++. But its proving in my experience to be a much more practical foundation, and going forward there is a lot of value in that.
- anonymous5133 9y agoWell written. This is why HN is the place to be.