Disclosure: Codacy, the automated code reviews platform, has previously sponsored Hacker Noon. For Hacker Noon readers, they’re offering 15% off using this code: HACKERNOON.
170 million dollars lost in the blink of an eye. Until recently it would’ve been hard to imagine this could ever happen — this kind of money doesn’t just disappear overnight, and destroying it would take incredibly long.
But last week it did — though it wasn’t traditional money. With cryptocurrencies, making millions disappear now only takes one person and a couple of clicks.
On November 7th, a user of Ethereum wallet Parity stumbled upon a bug that allowed him to convert a contract that was governing multisignature wallets into a regular wallet address. This so-called smart contract was critical to make transactions to and from a set of wallets possible.
After converting the contract the user was able to make himself the owner. Stunned by what happened, he then inadvertently killed the contract, immediately rendering all associated wallets unusable. The user later reported the bug as a ticket on Parity’s GitHub However, without any way to access the Ether inside, millions of dollars were already locked inside hundreds of frozen wallets.
If you’re not an expert on crypto, all of this might sound a bit complicated. Let’s look at the situation from an easier to understand perspective:
Let’s say someone convinced a lot of people to put all of their money in a single box because it’s extra secure. Unfortunately no one knew that the box would burn down when it would be moved too much. Then your two-year-old brother finds the box, it quickly catches fire and all the money inside is gone within seconds.
According to Parity, however, there’s a small sidetone to the story — it says the money isn’t technically gone, it’s just frozen inside locked wallets. But if that’s the case, it seems like nobody is currently able to unfreeze the funds.
On November 8, the company released the results of a comprehensive audit revealing that the 578 frozen wallets held a total of 513,774.16 Ether, which amounts to roughly $170 million at the time of writing. In total, 573 people were affected by the incident — that’s a lot of people losing a lot of money.
There’s no quick and easy fix for this problem — because of the way the Blockchain works, the possibilities are very limited.
The most straightforward option would be to implement a hard fork. This effectively creates a new version of the Blockchain in which the incident never took place, immediately making all funds accessible again. Hard forks have previously been successful in returning lost funds, for example after a large-scale hack of decentralized venture capital fund the DAO in June 2016. To execute a hard fork, at least 51% of users on the network need to implement it, but it only took a month to convince enough people.
The problem is that pushing a hard fork today won’t be as easy — the Ethereum community has grown a lot since then, which means it’s much harder to get a majority to jump on the fork.
Another, arguably easier option would be to focus on an early proposal by Etherereum co-creator Vitalik Buterin. EIP156 describes a way for users to reclaim Ether stuck in frozen accounts. The proposal is still under review, however, making it unclear if it’ll ever end up being implemented by the core Ethereum developers.
It’s not the first time Parity is in hot water — a couple of months ago it became the target of a hacker who made off with $32 million dollars using an earlier vulnerability in the multisignature wallets. The fix for this introduced a new bug that eventually led to the freezing incident.
Cryptocurrencies have a lot of things going for them — they’re a great way to quickly send money to anyone in the world without having to depend on a bank. It’s even possible to do this without revealing your identity by using the right anonymization tools, which makes it easy to protect your privacy.
Unfortunately, this also creates fertile ground for hackers, who can silently siphon away funds to unidentifiable accounts. There’s a long list of high-profile cryptocurrency hacks, topped by the March 2014 breach of then-dominant exchange Mt. Gox. Over the course of several years, the attackers were able to make $473 million in Bitcoin disappear without leaving a trace.
While as of yet it’s still unclear if the wallet freeze was an accident or a deliberate move, it definitely reconfirms the vulnerability of cryptocurrencies. When crypto developers mess up by introducing a critical bug, it can eventually affect accounts holding real money.
To understand how all of this was able to happen, it’s important to explain the difference between Bitcoin and Ethereum. While Bitcoin is not much more than a way to exchange virtual currency, Ethereum also uses the underlying technology for something else. By making it possible for developers to build applications that run on the Blockchain, it’s more than just a way to pay people — it’s a global computing platform. Because Ethereum has more features than Bitcoin it’s generally seen as less secure, as it has more possible exploit sources.
Parity is a client built on top of Ethereum, which uses its own open-source codebase — the code that contained the bug that led to the frozen wallets. The company’s website prides itself with having a 100% reviewal rate by at least one expert developer. In this case that wasn’t enough.
The vulnerable part of the code had been deployed months ago, and somehow managed to escape code review by both the open source community and the Parity team. Thanks to simple human error, hundreds of millions of dollars are now stuck. All of this could’ve been avoided by doing proper code review, which would’ve caught the bug before inflicting irreversible damage.
Parity says it regularly employs external auditors to do formal audits of their smart contracts, but states that the solution to these kinds of problems isn’t doing more audits. Instead, it would make more sense to implement more formal procedures and tooling around the deployment, monitoring and testing of contracts. There’s some serious truth to this — using tools like automated code review can significantly decrease the chances of a development mishap.
By automatically identifying security issues and ensuring compliance, automatic code review makes it easier to write great-working code. By using these tools, developers can save up to 30–50% of their time that they would normally spend reviewing, while seeing their code quality steadily increase. Having an extra pair of eyes to look for errors can help a lot when trying to write great software.
People make mistakes, so it’s a good idea to double down on code review — especially when there’s lots of money involved. You’ll enjoy the peace of mind that comes from having a thoroughly reviewed codebase.
Read more articles on The Codacy Blog.
Create your free account to unlock your custom reading experience.