<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by DaveChappell on Medium]]></title>
        <description><![CDATA[Stories by DaveChappell on Medium]]></description>
        <link>https://medium.com/@DaveChappell_83345?source=rss-3c0e9b166c38------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8KZMgTGKzpQZeN4KD4FIYw.jpeg</url>
            <title>Stories by DaveChappell on Medium</title>
            <link>https://medium.com/@DaveChappell_83345?source=rss-3c0e9b166c38------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 18:22:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@DaveChappell_83345/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Detailed Analysis of the $300M Ethereum Wallet Breach]]></title>
            <link>https://medium.com/@DaveChappell_83345/detailed-analysis-of-the-300m-ethereum-wallet-breach-83d41fe36dd0?source=rss-3c0e9b166c38------2</link>
            <guid isPermaLink="false">https://medium.com/p/83d41fe36dd0</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[ethereum-breach]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[parity-wallet]]></category>
            <dc:creator><![CDATA[DaveChappell]]></dc:creator>
            <pubDate>Mon, 20 Nov 2017 14:57:23 GMT</pubDate>
            <atom:updated>2017-11-20T16:15:03.889Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s a development/testing/deployment process problem</p><p>On November 7, 2017, the cryptocurrency world was rocked by the news of a breach of Ethereum wallets, where users of the Parity Multisig Wallet collectively lost an estimated $150M to $300M in Ether. Initially dubbed as an Ethereum Hack, this news sparked controversy over the maturity and security of the Ethereum network, which at the time had the 2nd largest market cap of cryptocurrency, 2nd only to #bitcoin. What really happened?</p><p>As it turns out, this was not a bug or a breach of the Ethereum network. It was a problem related to an implementation of a particular cryptocurrency wallet provider known as Parity. Through a detailed analysis, this article will show that it was not even a bug in the wallet code, but a problem with the process that occurred during the last deployment of the Parity wallet code.</p><h3>Whats Happening</h3><p>In short, a self-described newbie, who goes by the name of devops199, claims to have been randomly invoking code functions on arbitrary smart contracts deployed on the Ethereum blockchain, and inadvertently disabled the Parity wallet, thus rendering all funds held by all users of the Parity Multisig wallet since July 20 2017 inaccessible. He then followed up by logging a bug in github and claiming ignorance –</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*reDO9gLQtBbaBAXU." /></figure><p>which is the equivalent of saying this -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/0*JwNuxXWoz3kJSL9H." /></figure><p>So, henceforth devops199 will now be referred to as devopsUrkel. Irrespective of devopsUrkel’s intent, the question has been flying around twitter and chat rooms all through the crypto community — Was this a blatant bug in the Parity wallet code? I would argue no; that the code works as designed, and this was a problem with the deployment process. We will examine this in detail, but first a little background primer on Ethereum and smart contracts:</p><h3>What is Ethereum?</h3><p>Ethereum is a blockchain network, similar in concept to the blockchain that supports #bitcoin. While Ethereum has its own cryptocurrency known as Ether, which has a value in its own right and can be traded on exchanges, its main purpose is to serve as a general purpose decentralized ledger for any type of business transaction or data. The rules governing the transaction can be codified in the blockchain itself using a concept known as smart contracts. In a concept also known as “gas”, Ether is used in small units of payment “WEI” as a means for paying a transaction fee for executing business logic in a smart contract. This transaction payment system is intended to discourage spammers and freeloaders from clogging up the Ethereum network with trivial use cases, keeping it available for serious participants only.</p><h3>How do Smart Contracts Work?</h3><p>Smart contracts are made possible through the use of a scripting language that executes in the Ethereum Virtual Machine (EVM). Think of the EVM as an execution environment for code that is location independent and can run anywhere on the Ethereum network. The scripting language built into the Ethereum core is Solidity. Solidity borrows its syntax from Javascript and Python, so if you are familiar with either of those languages you should be able to pick it up fairly easily.</p><p><strong>Shared Library code</strong></p><p>Ethereum supports the notion of a library of shared code. A library is a special type of contract that doesn’t itself necessarily embody an instance of an individual contract, but rather is shared code that can be called by other smart contracts. This is useful but also key to how devopsUrkel was able to disable all the Parity wallets. All instances of the Parity Wallet on the Ethereum blockchain all pointed to an instance of the Parity library contract that implemented core functionality of the wallet. DevopsUrkel was able to kill() that library contract, thus rendering all wallets that used that library unable to retrieve the funds held in the wallet.</p><h3>What Happened</h3><p>DevopsUrkel was able take ownership of the Parity Wallet shared library and then call the library’s kill() method. How could this happen? As we will examine, the code was written to protect itself from being killed by someone other than an owner, and also to protect itself from having its ownership being taken over. However, and this is a big however, the “bug” that was exploited was that it allowed an owner to get set the first time calling it. The only way that devopsUrkel could have taken ownership is if the Parity wallet contract was deployed without an initial owner. So, is that a bug in the code, or a bug in the deployment process? One could argue that the code for the shared Parity Wallet library code is working as designed, and it was intended that the owner be set by whoever deployed the code for the Parity wallet library on the Ethereum blockchain. Yet for whatever reason that didn’t happen. The library code was put out there and left defenseless due to failing to do the next step to initialize the owner.</p><h3>Examining the code</h3><p>DevopsUrkel called 2 important methods on the Parity wallet library contract : initWallet() and kill()</p><p>Upon inspection of the initWallet() code, we see the following:<br>// throw unless the contract is not yet initialized.<br>modifier only_uninitialized { if (m_numOwners &gt; 0) throw; _; }<br>// constructor — just pass on the owner array to the multiowned and<br>// the limit to daylimit</p><p>function initWallet(address[] _owners, uint _required, uint _daylimit) <strong>only_uninitialized</strong> {<br> initDaylimit(_daylimit);<br> initMultiowned(_owners, _required);<br>}</p><p>Note the modifier <strong>only_uninitialized</strong>:<br> if (m_numOwners &gt; 0) throw;</p><p>In Solidity a modifier is a way of adding additional constraints to the execution of a function. In this case it guards against an attacker calling this to reset the owners, and that is good. It is designed to raise an error and abort the calling of the rest of the code in the method if the owners have already been set. However, if m_numOwners is zero because it had never been initialized, then the execution continues as normal, in this case setting the owner of the contract to the address that belongs to devopsUrkel.</p><p>Now consider the code for kill():<br>// kills the contract sending everything to `_to`.<br>function kill(address _to) <strong>onlymanyowners</strong>(sha3(msg.data)) external<br>{<br> suicide(_to);<br>}</p><p>This function appears to be guarded against the very attack that took place. The existence of a onlymanyowners modifier implies that that this code can only be called if there are multiple owners signing off on the execution of it. However upon examination, this is a bit of a misnomer; it really only aborts if the owner of the current message is not in the owner list. Therefore one owner, such as the blockchain address belonging to devopsUrkel, is sufficient to execute the function.</p><p>modifier onlymanyowners(bytes32 _operation) {<br> if (confirmAndCheck(_operation))<br> _;<br>}</p><p>function confirmAndCheck(bytes32 _operation) internal returns (bool) {<br> // determine what index the present sender is:<br> uint ownerIndex = m_ownerIndex[uint(msg.sender)];<br> // make sure they’re an owner<br> <strong>if (ownerIndex == 0) return;<br> </strong>…<br>}</p><p>Could this have been prevented through a better development and deploy process? In this postmortem report, which confirms my view, the purveyors of this wallet code insist that it had been vetted profusely through peer review, and also suggest that this may have slipped through some cracks due to some refactoring to convert this code into a shared library that happened after the code reviews were performed <a href="https://paritytech.io/blog/security-is-a-process-a-postmortem-on-the-parity-multi-sig-library-self-destruct.html">— https://paritytech.io/blog/security-is-a-process-a-postmortem-on-the-parity-multi-sig-library-self-destruct.html</a></p><p>So, in conclusion, this was not a bug in Ethereum, or even a bug in the wallet code. It was bug in the process.</p><p>Hindsight is 20/20, but one could easily imagine a good QA person finding this problem with a reasonable set of negative testing prior to going to production. One thing I learned a long time ago is that any change, not matter how small, can introduce new bugs.</p><p><strong>Can We Still Blame Ethereum?</strong></p><p>Sure we can! There are those who feel that even though this is clearly a bug in the Parity Wallet, it is largely in part to the design of Ethereum. Solidity is a full turing complete programming language, which means you can do anything with it. That sounds great to many, but some would argue that this gives developers too much rope to hang themselves with. In future posts, we will explore other nascent smart contract languages that may offer smarter constraints to help protect against this sort of thing.</p><p><strong>Mitigation Strategy</strong></p><p>So how do those folks get their money back? This is a difficult situation, since the nature of Blockchain is that it should be a permanent ledger that is immutable, where transactions and contracts can refer to other contracts that are further down in the chain. In this case, all the instances of the Parity Multisig wallet in the blockchain are pointing at one shared library that was triggered to self-destruct. There is no provision in the design of the Ethereum blockchain, or in smart contracts implemented in Solidity, to reinsert something new into an existing block. People are talking about a hard fork, but a hard fork that does what exactly?</p><p>Keep an eye on this space. I will be tracking this and writing updates as they occur.</p><p><em>The author would like to thank</em><a href="https://twitter.com/christo4ferris"><em> @christo4ferris</em></a><em> and</em><a href="https://twitter.com/SirLensALot"> <em>@SirLensALot</em></a><em> for their review comments.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83d41fe36dd0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>