[00:00.000 --> 00:06.400] All right, everybody. Welcome. Thank you for attending my talk, Hacking Cryptocurrencies. [00:07.040 --> 00:11.400] My name is Mark Nesbitt. I'm an application security engineer at Coinbase. [00:12.380 --> 00:16.080] In the blockchain village at DEF CON, you all probably know Coinbase, but for those who may [00:16.080 --> 00:20.280] be unfamiliar, Coinbase is a digital currency wallet and platform where merchants and consumers [00:20.280 --> 00:25.600] can transact with cryptocurrency. Some of my recent priorities at my job have been security [00:25.600 --> 00:29.740] support for systems that integrate with cryptocurrency networks, for instance, our hot [00:29.740 --> 00:35.180] wallets. And second has been security assessments and mitigations for supported digital assets. [00:35.180 --> 00:38.500] As you may know, Coinbase is adding a large number of assets to the platform, [00:38.500 --> 00:41.860] and we review each and every one of them for its security qualities. [00:45.120 --> 00:48.980] I'm going to have two main sections to this talk. First, I'm going to talk about what I mean by [00:48.980 --> 00:54.000] hack when I say hacking cryptocurrencies. Second section, I'm going to talk about 51% [00:54.000 --> 00:57.960] double spending attacks. I'm going to walk through some real world examples of this. [00:57.960 --> 01:01.260] And then I'm going to talk about some observed patterns and characteristics of the attacks and [01:01.260 --> 01:06.920] the attackers that we've been able to uncover. First, what do we mean by hack? [01:07.980 --> 01:12.680] With every new technology, a new exploit vector is born. New processor developments, [01:12.680 --> 01:16.180] like speculative execution or out of order execution, were exciting boosts to processor [01:16.180 --> 01:21.140] speed and also enabled the famous specter and meltdown vulnerabilities. Blockchains are no [01:21.140 --> 01:24.840] different. They represent a new technology, which means there are new ways to hack. [01:24.840 --> 01:29.660] I'll explain one of them here. Most everyone here is likely familiar with the CIA framework for [01:29.660 --> 01:34.880] security. C for confidentiality, I for integrity, and A for availability. Examining a system for [01:34.880 --> 01:38.040] these three properties can give a great start into understanding the security and threats [01:38.040 --> 01:43.960] against the system. I'll describe how 51% attacks work in a bit more detail. But for the time being, [01:43.960 --> 01:47.800] it's important to realize that a cryptocurrency is a network of nodes that communicate to one [01:47.800 --> 01:51.920] another according to a protocol. The nodes on the network store a copy of the blockchain, [01:51.920 --> 01:56.160] which is a public shared database. And the network protocol allows nodes to communicate [01:56.160 --> 02:02.340] state information about the blockchain. Nearly every blockchain has an authorization model based [02:02.340 --> 02:06.980] on public key cryptography. The state of data in the blockchain can usually only be updated when [02:06.980 --> 02:10.880] the proper digital signature is provided. An example of this would be sending bitcoins from [02:10.880 --> 02:16.460] one person to another. The sender must authorize this state change by signing the send transaction. [02:16.460 --> 02:20.700] A wallet is an example of software that performs this action, meaning that it's built on top of the [02:20.700 --> 02:25.300] blockchain. Wallets hold private keys and can submit transactions to the blockchain. As you [02:25.300 --> 02:29.120] could realize, because the blockchain is a shared public database, anyone can choose to build a [02:29.120 --> 02:33.880] wallet application on top of a blockchain, so there are a wide variety of wallets. They have their own [02:33.880 --> 02:38.700] CIA to examine. Many of the hacks you hear about in the media are a failure of confidentiality in [02:38.700 --> 02:43.500] the parts of wallets. Peter mentioned that just a few minutes ago in his talk. If the private keys [02:43.500 --> 02:49.340] are leaked, anyone can authorize transactions for actions controlled by those keys. [02:51.600 --> 02:55.620] Another interesting wallet failure mode is integrity failure. Peter also mentioned this. [02:55.620 --> 02:59.960] If an attacker can manipulate the recipient of a transaction prior to signing, there's no need for [02:59.960 --> 03:04.440] the attacker to have access to the private keys. All of this is pretty standard application security [03:04.440 --> 03:08.920] work. There's a lot of history in how to secure these types of systems. A large component of my [03:08.920 --> 03:12.920] day-to-day work is doing that, ensuring confidentiality and integrity in these systems. [03:14.000 --> 03:18.020] For completeness, I've given two examples of availability failure that might happen. [03:18.020 --> 03:21.020] These aren't really hacks because the attackers don't really get the funds. [03:21.580 --> 03:25.800] But this talk is not about wallets. I'm talking about hacking cryptocurrency itself, [03:25.900 --> 03:29.040] a new vector. Let's see where the CIA framework can get us there. [03:30.660 --> 03:34.660] I define the blockchain as a shared database. Thus, it's entirely transparent, [03:34.660 --> 03:40.480] and there really isn't very much confidentiality. Jumping down to availability, this is also not [03:40.480 --> 03:45.620] going to be a focus because it's not a huge concern for anyone except for the protocol designers. [03:45.960 --> 03:49.080] These concerns matter. Concerns about the availability of blockchains have driven [03:49.080 --> 03:53.480] much of what's known as the scaling debate. If protocol design makes the resources required [03:53.480 --> 03:58.240] to run and participate in the network too expensive, it may impact the availability [03:58.240 --> 04:01.380] of the information, which could have many negative impacts on the network. [04:03.380 --> 04:07.740] Violating the integrity of a blockchain is what I want to talk about. It's a way to hack [04:07.740 --> 04:13.360] cryptocurrency. The integrity has recently become a bigger focus across the industry. [04:16.320 --> 04:20.060] As I mentioned before, I work for Coinbase, a major cryptocurrency exchange. [04:20.520 --> 04:25.260] Exchanges make an ideal target for all kinds of attacks, but especially 51% attacks, [04:25.260 --> 04:30.200] which I'll dive into in the second part. First off, exchanges hold a lot of cryptocurrency [04:30.200 --> 04:34.280] on behalf of their customers. That's an obvious enough reason for them to be good targets. [04:34.680 --> 04:38.260] There are other characteristics, though. For instance, liquidity and volume. [04:38.260 --> 04:42.000] Being able to trade one cryptocurrency into a different one can be very advantageous to an [04:42.000 --> 04:47.900] attacker. Speed. Exchanges often credit funds to attackers on a relatively short time frame [04:47.900 --> 04:52.380] and allow for nearly instant sends. An attack could therefore happen very quickly. [04:53.820 --> 04:58.460] Remote interaction. An attacker can execute many of these attacks from across the ocean, [04:58.460 --> 05:04.480] perhaps from North Korea. And in some cases, anonymity. I want to take a second to talk about [05:04.480 --> 05:07.940] this. Many popular media descriptions of cryptocurrency seem to describe it with some [05:08.860 --> 05:13.440] magical anonymity qualities, which it doesn't have. This is especially true if you have an [05:13.440 --> 05:17.560] authenticated session with an exchange such as Coinbase. Coinbase strives to be the most [05:17.560 --> 05:21.040] trusted exchange in the entire cryptocurrency industry. And as part of that, we're heavily [05:21.040 --> 05:25.120] regulated. And a large part of that regulation involves the lengths we go to ensure every [05:25.120 --> 05:29.840] customer on our platform has gone through KYC, AML. KYC, know your customer, so we know their [05:29.840 --> 05:34.100] identities. And that's important for AML, anti-money laundering. Any exchange that doesn't [05:34.100 --> 05:38.780] have these strict requirements would obviously be more attractive to potential attackers. [05:39.640 --> 05:45.660] So if you can find some sort of vulnerability, whether that's subverting a protocol or a more [05:45.660 --> 05:51.800] traditional wallet-style vulnerability, as I described earlier, this makes an exchange a [05:51.800 --> 06:01.250] great target. So 51% double spend attacks. As I mentioned before, a blockchain is a shared [06:01.250 --> 06:06.170] database stored by all nodes on the network and accessible to anyone. For this database to be [06:06.170 --> 06:10.490] useful, there must be a way to update it. Blockchains are append-only databases and are [06:10.490 --> 06:14.870] updated in batches of transactions. Each batch of transactions that's added to the blockchain [06:14.870 --> 06:21.430] is typically called a block. So you can visualize the blockchain like this with the expectation that [06:21.530 --> 06:26.650] a block n plus one would shortly be added. But that raises a question. Who defines block n plus [06:26.650 --> 06:30.630] one? The database is shared and distributed, so there must be some way of coming to consensus [06:30.630 --> 06:34.950] among the network participants about what constitutes this block. The answer to this [06:34.950 --> 06:38.690] question is it depends on the cryptocurrency. This is one of the major defining characteristics [06:38.690 --> 06:42.130] of cryptocurrencies, and a lot of new cryptocurrencies have innovative methods [06:42.130 --> 06:48.170] for adding to the blockchain. For instance, Ripple and Stellar have a concept of validator nodes that [06:48.170 --> 06:54.230] use a voting consensus protocol to determine which transactions are in this block. EOS goes through [06:54.230 --> 06:58.650] regular elections where these nodes are called block producers and they take turns defining the [06:58.650 --> 07:05.330] block. Tezos and Cosmos, the node chosen is based on its stake. It's a proof-of-stake network and [07:05.330 --> 07:11.810] stake is the proportion of network funds owned. Lastly, Bitcoin and Ethereum. The node that first [07:11.810 --> 07:17.710] successfully solves a cryptographic puzzle defines the block. This is known as proof of work. It's [07:17.710 --> 07:21.390] known as proof of work because the solution to the cryptographic puzzle has to be brute-forced, [07:21.390 --> 07:25.970] which takes considerable computational effort. This is called mining. Mining a block is when a [07:25.970 --> 07:30.890] node discovers the solution to the proof-of-work puzzle. Here's a key fact about proof-of-work [07:30.890 --> 07:36.190] networks. Anyone can bring their computation to the table and if they produce a valid block, they [07:36.190 --> 07:40.490] have extended the blockchain. Since this is a distributed and permissionless way of extending [07:40.490 --> 07:44.870] the blockchain, it's possible that the network will encounter multiple versions of the blockchain. [07:45.110 --> 07:49.510] To resolve these versions and reach consensus on a single version, the network deems the version [07:49.510 --> 07:55.130] with the most work to be the canonical blockchain. I'll explain what I mean by that. This diagram [07:55.130 --> 07:59.310] shows the blockchain tilted 90 degrees with the blocks separated. Block n plus one will be added [07:59.310 --> 08:04.210] on top of the other blocks. As before, each block contains some number of transactions. [08:04.890 --> 08:10.770] Suppose a node with its computational power solves the cryptographic puzzle, mines a block. [08:10.830 --> 08:14.530] It broadcasts the block that solves this puzzle to the network and all transactions in the block [08:14.530 --> 08:18.370] are added to the canonical history of transactions that is added to the blockchain. [08:19.630 --> 08:23.550] But suppose the second block is found simultaneously. How does the network decide [08:23.550 --> 08:27.970] which block contains the transactions that are to be added? The rule is that the nodes [08:27.970 --> 08:32.410] on the network define the series of blocks with the most work as the canonical history. [08:32.610 --> 08:36.310] So if either of the two blocks gets another block extending on top of it, [08:36.310 --> 08:40.370] there will be more accumulated work on that branch, which makes it the canonical blockchain. [08:41.890 --> 08:45.550] This means that there's never a case where a block is truly finalized on the chain. [08:45.630 --> 08:50.530] If enough work decides to extend from a different block, once that branch has outworked the rest of [08:50.530 --> 08:55.770] chain, it will be the canonical history. The situation on the slide is called a reorg, [08:55.770 --> 08:59.730] short for reorganization, and the grayed out blocks are known as orphan blocks, [08:59.730 --> 09:06.330] and they are not part of the blockchain. Let me repeat a key fact. Any actor that can outwork [09:06.330 --> 09:11.470] the rest of the network is the sole arbiter of which, among all possible valid transactions, [09:11.470 --> 09:16.110] are the ones that are added to the canonical history. So if there's any kind of network [09:16.110 --> 09:19.330] instability where blocks were not always immediately shared with the network after [09:19.330 --> 09:23.410] they were found, or if some actor was deliberately holding back blocks that had been discovered, [09:23.410 --> 09:26.770] we could see something like what's shown on this slide, where the blocks on the left are hidden [09:26.770 --> 09:30.790] from the network. But if they were shared and made public, the network would switch over to [09:30.790 --> 09:34.390] these blocks and define them as the canonical chain, orphaning all the blocks that were [09:34.390 --> 09:40.010] previously the most recent additions to the chain. Because of this potential for instability of the [09:40.010 --> 09:44.850] most recent blocks, anyone receiving a transaction should wait for several blocks to be found after [09:44.850 --> 09:48.690] the block that contained their transaction to lower the chance that the block containing their [09:48.690 --> 09:53.710] transaction will be orphaned. An analogy that I found interesting is that the most recent blocks [09:53.710 --> 09:57.970] are like recently fallen leaves in the fall. They can blow around and change and shift. After a while [09:57.970 --> 10:03.210] they might get waterlogged and not move very much, and after even longer they'll decompose into mud, [10:03.210 --> 10:08.450] clay, and eventually rock. You can adjust your risk by selecting the number of blocks [10:08.450 --> 10:12.910] that you wait until you consider a transaction finalized. This is known as the confirmation [10:12.910 --> 10:17.310] requirement, and each recipient of a transaction decides on their own level. [10:19.540 --> 10:23.380] So imagine we had the following situation where Coinbase supports a fictional coin, [10:23.380 --> 10:30.160] McCoin, abbreviated MUH. Suppose the confirmation requirement for MUH is three blocks. [10:30.400 --> 10:36.360] Coinbase also supports BTC, Bitcoin, and MUH trading. Any customer of Coinbase could have the [10:36.360 --> 10:41.720] following intention. Create a transaction T that sends coins from the customer's wallet to Coinbase. [10:41.720 --> 10:47.120] Wait for three blocks, after which Coinbase will consider the transaction finalized, and Coinbase [10:47.120 --> 10:52.820] will credit these funds to the customer's Coinbase account. Then the customer may want to sell the [10:52.820 --> 10:58.140] MUH for BTC and then send the BTC wherever they like, off-site, off the platform. This is a [10:58.140 --> 11:04.520] completely normal pattern of behavior for a customer to take. Let's imagine instead though [11:04.520 --> 11:09.400] that the customer is actually an attacker. An attacker with a special ability to outwork the [11:09.400 --> 11:14.640] rest of the network. The attacker creates transaction T, sending some amount of MUH [11:14.640 --> 11:19.160] onto Coinbase. Suppose T is quickly included in a block by some miner on the network. [11:21.360 --> 11:27.560] Simultaneously, the attacker will create a second transaction, T'. Notice that T' sends the same [11:27.560 --> 11:34.240] funds that were sent in T, addressed at A1. However, T' sends those funds to address A2. [11:34.660 --> 11:38.860] T and T' could never exist in the same blockchain together. As soon as one is included, [11:38.860 --> 11:42.840] the other would be an invalid transaction because the funds were already spent. [11:43.500 --> 11:48.860] The attacker begins to mine in secret and includes T' in the secret block, but not T. [11:49.220 --> 11:53.160] The space on the right with the gray background is local to the attacker and the network cannot [11:53.160 --> 11:57.680] see this block. Remember that we've assumed the attacker can outwork the rest of the network, [11:57.680 --> 12:01.920] meaning the attacker can produce blocks faster than the rest of the entire network. [12:03.640 --> 12:08.080] So in order to do anything with the MUH on Coinbase, it first needs to have three confirmations [12:08.080 --> 12:13.380] because that's what it takes to be credited. The attacker does not sit idly by and continues [12:13.380 --> 12:18.640] to secretly produce blocks. The network also produces blocks, but unknown to anyone, [12:18.640 --> 12:21.740] it's not keeping pace with the secret blocks produced by the attacker. [12:23.000 --> 12:27.500] Finally, the network produces the third block, three confirmations on the transaction. The [12:27.500 --> 12:31.580] attacker is now credited with the MUH and can sell it for BTC, which could then be sent off [12:31.580 --> 12:38.060] the Coinbase platform. So the BTC could be withdrawn. It's now in the attacker's control. [12:38.080 --> 12:41.800] Remember, nothing seen publicly thus far is anything out of the ordinary. [12:42.240 --> 12:47.380] But now the attacker can execute the attack. The attacker can reveal the blocks to the network. [12:47.420 --> 12:51.320] These blocks have more accumulated work than the existing top three blocks. So according to the [12:51.320 --> 12:56.740] network rules, a reorg will occur. The attacker's blocks now representing the canonical chain. [12:57.080 --> 13:01.720] The top three blocks that we've previously seen publicly now become orphan blocks. They're no [13:01.720 --> 13:05.420] longer part of the blockchain and the transactions defined in them are now no longer part of the [13:05.420 --> 13:10.620] canonical history. And notice the T was in those blocks, meaning that there's no longer a [13:10.620 --> 13:16.180] transaction to Coinbase in the blockchain anymore. But the BTC has already been withdrawn. There was [13:16.180 --> 13:22.340] a withdrawal, there was no deposit, aka a theft. The ability to do this is directly related to how [13:22.340 --> 13:26.180] difficult it is for an attacker to overpower the network. The more work being put into solving the [13:26.180 --> 13:31.160] proof of work puzzles on the network, the more difficult it will be for any one entity to marshal [13:31.160 --> 13:36.880] the resources and overwhelm the network. Note that the danger of this attack comes when you [13:36.880 --> 13:42.380] accept a deposit directly from the attacking entity. In this example, BTC was provided in [13:42.380 --> 13:46.860] exchange for MUH. If the attacker can't get something irrevocable in exchange for this [13:46.860 --> 13:51.660] vulnerable coin, the attack is invaluable. This is one of the reasons that an exchange is a great [13:51.660 --> 14:00.080] target for this attack, liquidity. The thing about 51% attacks is they're pretty obvious if you know [14:00.080 --> 14:05.320] what to look for. Each block in the blockchain is identified by its hash, providing a unique [14:05.320 --> 14:11.100] fingerprint. If the hash of block at height n changes from what it was before, that block was [14:11.100 --> 14:17.380] replaced with a new block. There must have been some kind of reorg. Small reorgs, shallow depth [14:17.380 --> 14:21.500] reorgs, happen on a regular basis. This is primarily driven by the fact that many nodes [14:21.500 --> 14:26.160] across the world are attempting to find blocks. There is some amount of latency in the network, [14:26.160 --> 14:29.620] so there will be race conditions where multiple blocks are found simultaneously and eventually [14:29.620 --> 14:38.000] only one will be in the blockchain. However, deeper reorgs do allow for attacks if they [14:38.000 --> 14:46.680] exceed the confirmation limit of the service. You can inspect a reorg to look for the presence of [14:46.680 --> 14:51.440] T and T prime. Two transactions are double spends if they send the same money but to different [14:51.440 --> 14:55.420] places. They can't exist in the chain together, but they might exist in competing branches of [14:55.420 --> 15:00.980] the chain. This is the smoking gun that a reorg is malicious. Money that was sent to one place [15:00.980 --> 15:07.680] is effectively clawed back when the new blocks are revealed. From the attacker's point of view, [15:07.680 --> 15:12.980] the attack has two components. One is the ability to form the secret chain, which requires majority [15:12.980 --> 15:19.540] hash power. Two, the ability to create transactions T and T prime. You're going to need some amount of [15:19.540 --> 15:24.940] the currency itself to do this, and the more coins you have, the bigger the impact of T and T prime. [15:26.540 --> 15:30.600] An attacker is also going to need to select a victim. Obviously, the victim must accept [15:30.600 --> 15:34.940] the currency, but the victim has to provide something of value that they cannot take back [15:34.940 --> 15:39.160] once they realize they've been attacked. So an attacker couldn't sell the coin for U.S. dollars [15:39.160 --> 15:43.720] and transfer the U.S. dollars to a bank account. Not only would that likely expose the attacker's [15:43.720 --> 15:48.280] identity, but the bank transfer can usually be reverted. Cryptocurrencies that aren't vulnerable [15:48.280 --> 15:53.160] to 51 percent attacks, however, cannot be reverted. This is another reason why cryptocurrencies [15:53.700 --> 15:59.000] exchanges make such good targets for 51 percent attacks. You can get cryptocurrency from them. [15:59.760 --> 16:03.920] Also notice that this attack can be repeated indefinitely until the victim takes defensive [16:03.920 --> 16:08.100] action, either by raising the confirmations required on their service or simply shutting [16:08.100 --> 16:14.480] down their interaction with this currency. We're going to walk through some real world examples [16:14.480 --> 16:22.900] of 51 percent double spending attacks. The one we'll go into most detail is the 51 percent attack [16:22.900 --> 16:28.160] on Ethereum Classic. In early January was when this happened, and because it's an asset that [16:28.160 --> 16:32.300] supports, we had monitoring systems in place which alerted in real time to the attack, [16:32.300 --> 16:36.260] allowing us to pause interaction with the blockchain. I'll talk about how this attack [16:36.260 --> 16:40.800] unfolded. The ETC network is minding its own business, mining blocks as usual, adding [16:40.800 --> 16:47.260] transactions to the blockchain. Then all of a sudden, seven new blocks show up out of nowhere, [16:47.260 --> 16:55.740] and these seven blocks don't extend from the most recent block, but dig down five blocks back, [16:55.740 --> 16:59.640] and it happens again. Six new blocks are fitting five previously discovered blocks. [17:00.440 --> 17:06.540] I called both of these events practice attacks, and the reason for that is because they were just [17:06.540 --> 17:11.160] reorgs. There was never a pair of transactions, T and T prime, where the same money was spent [17:11.160 --> 17:17.540] in one place in the first branch to a different place in the second branch. We hadn't observed [17:17.540 --> 17:21.820] reorgs of this depth ever on Ethereum Classic, and so it would have been premature to call these [17:21.820 --> 17:28.240] attacks. But once we were seeing these, we were alerted that something unusual was going on. [17:28.640 --> 17:35.200] And three hours later, there was a very deep reorg. 74 new blocks showed up all at once, [17:35.200 --> 17:42.480] orphaning 57 blocks. And in this reorg, there was a T and T prime, where the same money was [17:42.480 --> 17:48.460] spent first to one place and then to another. This was on a Saturday night. Our on-call [17:48.460 --> 17:53.560] engineers responded, validated the alert, and turned off ETC send and receive functionality. [17:55.720 --> 18:03.160] Ethereum Classic isn't the only successful 51% attack. It's the one we're most familiar with [18:03.160 --> 18:07.480] because it's the one we were closest to. But I'm going to talk about two others that we've looked [18:07.480 --> 18:12.780] into closely. BTG is Bitcoin Gold, and VTC is Vertcoin. But those aren't the only other two. [18:12.780 --> 18:19.940] There have been others as well. Some of the observed patterns we see from looking into [18:19.940 --> 18:25.820] these three different attacks. It's important to realize blockchains are public. This means [18:25.820 --> 18:30.100] that a 51% attack is a pretty noisy attack. It leaves all kinds of good data for understanding [18:30.100 --> 18:33.620] the attackers. I'm going to walk through just a few of the things that we've observed, but they [18:33.620 --> 18:37.980] really only scratch the surface of what you can learn about an attacker. These attacks leave [18:37.980 --> 18:41.880] such a trail of damage, you could say, behind them that I don't think it would be very long [18:41.880 --> 18:46.180] before we're very good at learning quite a bit about attackers of this sort. [18:48.080 --> 18:53.320] This chart shows all 17 of the reorgs that we were able to find in our research into the Bitcoin [18:53.320 --> 18:58.900] Gold attack, and how much Bitcoin Gold was taken in each one of them. Notice the first two [19:00.200 --> 19:07.100] didn't take anything. This is Vertcoin, VTC. The first five took nothing. [19:08.240 --> 19:13.720] And notice the first two in Ethereum Classic also took nothing. Remember what I said, [19:13.720 --> 19:19.140] the 51% attack has two parts. First, being able to build the secret chain, and then properly [19:19.140 --> 19:23.840] creating transactions TNT Prime. So what did the attackers do? They broke the problem down into [19:23.840 --> 19:27.700] those two steps, made sure they could build an attack chain before they worried about building [19:27.700 --> 19:35.240] TNT Prime. Even criminals need integration tests. Criminals are also not perfect. These are the [19:35.240 --> 19:40.200] same three charts as before, all in one slide. You may have noticed that there were gaps when [19:40.200 --> 19:44.380] I first showed these to you. They're a little harder to explain, I think. But as far as I can [19:44.380 --> 19:49.560] tell, the attackers did a bunch of work in these cases to reorg the chain, but they didn't put in [19:49.680 --> 19:54.000] a TNT Prime, so they didn't cash in on any double spending. For the first few attacks, it makes [19:54.000 --> 19:59.460] sense to assume that they're practicing. But once they've proven they can do that, these just look [19:59.460 --> 20:07.830] like mistakes to me. There's also an invest-exploit decision that an attacker has to make. Imagine [20:07.830 --> 20:11.510] yourself in the attacker's shoes, and you kind of have an interesting dilemma. Once you have the [20:11.510 --> 20:17.330] hash power to successfully attack the network, any additional resources you have should be directed [20:17.330 --> 20:24.130] towards owning the currency itself to amplify the impact of TNT Prime. In other words, the cost of [20:24.130 --> 20:28.840] the attack and the payoff of the attack are not functions of one another. So as an attack progresses, [20:29.230 --> 20:33.370] you're accumulating resources if you're being successful. Should you reinvest these, or should [20:33.370 --> 20:37.450] you take them off the table? You know how I said blockchains are very transparent. We can observe [20:37.450 --> 20:45.750] the decisions they made clear as day. In the Bitcoin Gold attack, and in the vast majority of [20:45.750 --> 20:50.850] the Vertcoin attack, attackers are mostly in exploit mode. They have X amount of coins, and every time [20:50.850 --> 20:56.470] they attack the network, they perform a double spend, they get X payoff. But in the Ethereum [20:56.470 --> 21:01.970] Classic attack, and oddly in these first three Vertcoin attacks, the attackers seem to be also in [21:01.970 --> 21:06.050] invest mode. This makes me think that the Ethereum Classic attackers may have been planning to [21:06.050 --> 21:10.730] continue attacking, because I would expect an optimal attack profile to include a period of [21:10.730 --> 21:15.610] invest, followed by a flat period of exploit. There's also something really interesting about [21:15.610 --> 21:21.290] the Ethereum Classic data. Notice how it steps up in pairs. The first double spend was for a tiny [21:21.290 --> 21:29.650] amount, also probably a test. You can see at number four and five, they're roughly the same size. [21:30.110 --> 21:35.170] But then the size roughly doubled for six and seven, almost doubled again for eight and nine, [21:35.170 --> 21:39.390] stepped up significantly for 10 and 12, with 11 looking like it may have been another mistake, [21:40.690 --> 21:45.550] and then doubled again for 13 and 15, with 14 being another possible mistake. [21:45.790 --> 21:49.430] It seems to me that the attacker was balancing investing and exploiting. Bigger and bigger [21:49.430 --> 21:54.030] payoffs every time, but you never know when the party is going to stop. And so you want to take [21:54.030 --> 22:00.720] money off the table while you do it. That's what this looks like to me. This is also really [22:00.720 --> 22:05.540] profitable for the attackers. You can see our estimates on how much the double spends were [22:05.540 --> 22:09.680] worth, and our estimates on how much the mining cost would have been to perform these attacks. [22:09.680 --> 22:14.880] You can see the profit margins. It's absurd. Our mining cost estimates were also fairly conservative. [22:15.780 --> 22:20.220] We're also not even factoring the money made from the mining reward. The attacker [22:20.220 --> 22:25.200] mined valid blocks. Those blocks come with a mining reward, just like regular miners would [22:25.200 --> 22:29.100] have gotten. I'm not even factoring that in. They're approximately on the same order of magnitude [22:29.100 --> 22:37.180] as the mining cost, however. But the mining reward and leftover coins from the attack do typically [22:37.180 --> 22:42.760] get sold, so attackers are cashing in on this. In the case of Bitcoin Gold, it looked like about 75% [22:42.760 --> 22:46.380] of the mining rewards were moved shortly after the attack, probably to an exchange, probably to [22:46.380 --> 22:50.220] liquidate them, probably so that they could have coins that were unaffiliated with the attack. [22:50.820 --> 22:55.100] In Vertcoin and Ethereum Classic, all mining rewards were moved very shortly after the attack. [22:58.180 --> 23:01.760] Analyzing the time of day that the attacks happen is another route to [23:01.760 --> 23:05.420] understand the attackers. I've mapped the times of the attacks on this slide. [23:06.300 --> 23:10.660] It's hard to draw meaningful conclusions from Bitcoin Gold and Vertcoin. There does seem to be [23:10.660 --> 23:15.720] some clustering, but it's not too dramatic and they do have pretty much 24-hour coverage during [23:15.720 --> 23:21.800] the attack. Ethereum Classic, however, obviously has a time of day pattern in the attack. And that [23:21.800 --> 23:26.100] one outlier that you see was actually the very first practice attack, so it's a different case [23:26.100 --> 23:31.400] anyway. If such a major pattern does emerge, I would consider there to be two major hypotheses [23:31.400 --> 23:35.840] about what could be driving it. The attacker's preferred waking hours or the time zone the [23:35.840 --> 23:40.440] attacker considers most damaging to the victim, probably at night. Also note that the Ethereum [23:40.440 --> 23:45.280] Classic attacks and most of the Vertcoin attacks happened over weekends, again, probably because [23:45.280 --> 23:51.360] that is when it is most difficult for an exchange to respond. When doing timing analysis, note that [23:51.360 --> 23:54.640] these attacks can sometimes take hours for the attacker to build the chain, meaning the attacker [23:54.640 --> 23:59.040] doesn't have the full luxury of choosing their timing and may be forced to work around the clock. [23:59.040 --> 24:04.240] As an example, the longest Bitcoin Gold attack chain was 27 blocks, which probably took them over [24:04.240 --> 24:09.720] four hours to mine. The longest Vertcoin attack chain was 310 blocks, which probably took them [24:09.720 --> 24:19.300] over 12 hours to mine. As I said earlier, the risk for 51% attacks is in accepting money directly [24:19.300 --> 24:23.560] from an attacker. An attacker will want to find an exchange where it's possible to hide their [24:23.560 --> 24:29.020] identity from the exchange. In the case of Bitcoin Gold, Bitcoin Gold was delisted from Bittrex [24:29.020 --> 24:33.780] shortly after the attack, and the Bitcoin Gold dev team put out a statement claiming that Bittrex [24:33.780 --> 24:38.860] was a victim of the attack, and that explained their delisting. I don't know who the victims [24:38.860 --> 24:43.520] were of the Vertcoin attack. In the case of Ethereum Classic, three exchanges all put out [24:43.520 --> 24:48.080] statements acknowledging that they were targets. KYC can help prevent an attack. [24:49.420 --> 24:54.540] Another pattern, the attacks stop after they're publicized. Cockroaches hate the light. [24:55.120 --> 24:59.200] Bitcoin Gold was a three-day attack. It was publicized on the third day. [25:00.780 --> 25:06.880] Vertcoin was nearly two months. The day it was publicized was the day of the last attack. [25:07.420 --> 25:13.100] And Ethereum Classic, also a three-day attack. The third day was the day it was publicized. [25:15.060 --> 25:17.960] The last pattern I want to talk about is also interesting. [25:18.640 --> 25:23.760] We've noticed that attackers commonly don't place their TNT Prime transactions in the optimal blocks. [25:23.760 --> 25:27.460] Consider the example of the very first Ethereum Classic double spend attack that I talked about [25:27.460 --> 25:36.720] before, where 74 blocks did the orphaning of 57 blocks. This would be the ideal block [25:37.280 --> 25:42.280] for an attacker to have placed their transaction T in. It's the deepest block that was orphaned, [25:42.280 --> 25:46.600] which would have given transaction T 57 confirmations at the time of the attack. [25:47.680 --> 25:52.760] Instead, T was placed 13 blocks higher, where it only had 44 confirmations at the time of the [25:52.760 --> 25:59.340] attack. Transaction T was not the deepest orphan block. That means the attacker did the amount of [25:59.340 --> 26:04.620] work required to orphan a transaction with 57 confirmations, but only for a transaction that [26:04.620 --> 26:09.180] had 44. This happens in the vast majority of the double spends that we've observed, which is [26:09.180 --> 26:16.060] frankly very puzzling. So let's review. I define hacking by attacking the integrity of the [26:16.060 --> 26:21.460] blockchain. New technologies, new ways to hack. I described a 51% double spend attack, then I [26:21.460 --> 26:25.460] walked through real world examples of these attacks, along with the patterns that we've [26:25.460 --> 26:37.920] observed. That concludes my talk. Does anyone have any questions? Yeah? [26:45.110 --> 26:47.190] I'm sorry, I can't quite hear you. [26:52.070 --> 26:56.470] Yeah, so I think, let me make sure I'm understanding your question correctly. [26:56.470 --> 26:59.730] When a block is orphaned, is that data lost? Is that what you're getting at? [27:09.570 --> 27:15.390] Yeah, a node will store that data on its own. So when a block is orphaned, the node in its [27:15.390 --> 27:19.570] database will say this is an orphan block, but it'll hold it. And so you can still query your [27:19.570 --> 27:23.070] node for that data. Your node had to be around at the time, because those blocks aren't being [27:23.070 --> 27:28.450] shared around on the network. But if your node saw it, your node has it. Yeah? [27:28.450 --> 27:33.710] So you mentioned that the payout for mining a block is a cost. [27:34.250 --> 27:40.530] It's not exactly, but I think they're probably close, especially in smaller market CapCoins, [27:40.530 --> 27:45.130] where general purpose hardware can be moved to arbitrage the mining reward. [27:49.290 --> 27:58.230] This is way more profitable. If someone is going to take a deposit for a very weak [27:58.230 --> 28:02.210] amount of confirmations and give you something incredibly valuable for it, [28:02.210 --> 28:09.250] it's just so trivial to claw back the original deposit. I don't really think they are. [28:12.830 --> 28:18.390] Yeah, well, yes, when they mine their blocks, those are just ordinary nodes. And the easiest [28:18.390 --> 28:22.370] way for them to do it is to not even modify the software, just disconnect it from the internet, [28:22.370 --> 28:26.770] mine your block, you create your transactions. And then once you look locally, you see that [28:26.770 --> 28:30.730] you've outpaced the main chain, you just connect to the internet and then the reorg will happen [28:30.730 --> 28:42.830] by itself. So Coinbase has never lost anything in this sort of attack. We've only seen one attack [28:42.830 --> 28:48.730] on an asset that we support, which was the Ethereum Classic attack. We noticed it immediately [28:48.730 --> 28:54.730] because we were monitoring for this and we immediately shut down. I can't remember the [28:54.730 --> 29:00.150] number, there are something like 15 of these reorgs with Ethereum Classic. The very first one [29:00.150 --> 29:04.330] that had a double spend, we alerted and we shut down. So all the subsequent ones, we're offline [29:04.330 --> 29:09.270] and they couldn't have attacked us. Yeah, but actually there are four different exchanges [29:09.270 --> 29:15.050] targeting the ETC 51%. And actually one of our customers was not that happy because [29:15.050 --> 29:21.010] the bank has sent the ETH. But really the question to you guys is, if you want to withdraw [29:21.010 --> 29:28.790] that fiat from Coinbase, it takes quite a bit, right? And literally, if I am the attacker, [29:28.790 --> 29:36.630] how would I cash out or move the fund so that I can cause damage to the exchange? I don't think [29:36.630 --> 29:42.070] that's the case for Coinbase, but under what scenario would that be a damage? [29:42.270 --> 29:46.870] So I'm not sure I understand your question. I think you're saying if there's a delay on [29:46.870 --> 29:50.870] withdrawing from the exchange, that makes it harder to attack the exchange. And you're definitely [29:50.870 --> 29:54.410] correct that if there is a delay in withdrawing the exchange, because then the attack could [29:54.410 --> 29:58.610] potentially be detected and before the funds left, you could put a hold on them. But that's not true [29:58.610 --> 30:03.670] in all cases. You can transfer onto an exchange, sell and transfer off. And that is a very common [30:03.670 --> 30:09.950] pattern without these long delays. It's one of the pain points for a lot of customers in the [30:09.950 --> 30:14.330] cryptocurrency industry. They don't want to sit and wait for five days for seemingly no reason. [30:14.470 --> 30:19.110] So it's a constant balance to get that number right. But the faster it is, [30:19.110 --> 30:30.820] the better the opportunity for an attacker. Any other questions? What's that? [30:36.070 --> 30:39.570] Once the attacker transfers out of Coinbase, it's out of our control. So then if they can [30:39.570 --> 30:43.530] claw back that original send, then they got away with it, essentially, [30:44.110 --> 30:48.610] which has never happened to Coinbase, just to be clear. Any other questions? [30:52.990 --> 30:54.650] All right. Thank you, everybody.