WEBVTT

00:00.000 --> 00:01.360
All right, everybody.

00:02.360 --> 00:03.400
Welcome.

00:03.560 --> 00:06.400
Thank you for attending my talk, Hacking Cryptocurrencies.

00:07.040 --> 00:08.760
My name is Mark Nesbitt.

00:08.760 --> 00:11.400
I'm an application security engineer at Coinbase.

00:12.380 --> 00:22.020
In the blockchain village at DEF CON, you all probably know Coinbase, but for those who may be unfamiliar, Coinbase is a digital currency wallet and platform where merchants and consumers can transact with cryptocurrency.

00:22.460 --> 00:30.560
Some of my recent priorities at my job have been security support for systems that integrate with cryptocurrency networks, for instance, our hot wallets.

00:31.040 --> 00:35.180
And second has been security assessments and mitigations for supported digital assets.

00:35.180 --> 00:41.860
As you may know, Coinbase is adding a large number of assets to the platform, and we review each and every one of them for its security qualities.

00:45.120 --> 00:47.320
I'm going to have two main sections to this talk.

00:47.320 --> 00:51.180
First, I'm going to talk about what I mean by hack when I say hacking cryptocurrencies.

00:51.880 --> 00:55.320
Second section, I'm going to talk about 51% double spending attacks.

00:55.320 --> 00:57.960
I'm going to walk through some real world examples of this.

00:57.960 --> 01:03.420
And then I'm going to talk about some observed patterns and characteristics of the attacks and the attackers that we've been able to uncover.

01:04.660 --> 01:06.920
First, what do we mean by hack?

01:07.980 --> 01:11.320
With every new technology, a new exploit vector is born.

01:11.360 --> 01:20.060
New processor developments, like speculative execution or out of order execution, were exciting boosts to processor speed and also enabled the famous specter and meltdown vulnerabilities.

01:20.460 --> 01:21.580
Blockchains are no different.

01:21.580 --> 01:24.840
They represent a new technology, which means there are new ways to hack.

01:24.840 --> 01:26.480
I'll explain one of them here.

01:27.160 --> 01:30.400
Most everyone here is likely familiar with the CIA framework for security.

01:30.400 --> 01:33.600
C for confidentiality, I for integrity, and A for availability.

01:34.020 --> 01:39.140
Examining a system for these three properties can give a great start into understanding the security and threats against the system.

01:39.840 --> 01:42.800
I'll describe how 51% attacks work in a bit more detail.

01:42.800 --> 01:49.480
But for the time being, it's important to realize that a cryptocurrency is a network of nodes that communicate to one another according to a protocol.

01:49.580 --> 01:54.020
The nodes on the network store a copy of the blockchain, which is a public shared database.

01:54.100 --> 01:58.120
And the network protocol allows nodes to communicate state information about the blockchain.

01:59.620 --> 02:04.100
Nearly every blockchain has an authorization model based on public key cryptography.

02:04.100 --> 02:09.060
The state of data in the blockchain can usually only be updated when the proper digital signature is provided.

02:09.140 --> 02:12.160
An example of this would be sending bitcoins from one person to another.

02:12.160 --> 02:16.460
The sender must authorize this state change by signing the send transaction.

02:16.460 --> 02:21.400
A wallet is an example of software that performs this action, meaning that it's built on top of the blockchain.

02:21.640 --> 02:24.700
Wallets hold private keys and can submit transactions to the blockchain.

02:24.980 --> 02:32.720
As you could realize, because the blockchain is a shared public database, anyone can choose to build a wallet application on top of a blockchain, so there are a wide variety of wallets.

02:32.740 --> 02:35.300
They have their own CIA to examine.

02:35.580 --> 02:39.540
Many of the hacks you hear about in the media are a failure of confidentiality in the parts of wallets.

02:39.540 --> 02:41.940
Peter mentioned that just a few minutes ago in his talk.

02:42.580 --> 02:49.340
If the private keys are leaked, anyone can authorize transactions for actions controlled by those keys.

02:51.600 --> 02:54.400
Another interesting wallet failure mode is integrity failure.

02:54.400 --> 02:55.620
Peter also mentioned this.

02:55.620 --> 03:02.320
If an attacker can manipulate the recipient of a transaction prior to signing, there's no need for the attacker to have access to the private keys.

03:02.320 --> 03:05.200
All of this is pretty standard application security work.

03:05.200 --> 03:07.940
There's a lot of history in how to secure these types of systems.

03:07.940 --> 03:12.920
A large component of my 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:23.340
But this talk is not about wallets.

03:23.340 --> 03:26.760
I'm talking about hacking cryptocurrency itself, a new vector.

03:26.960 --> 03:29.040
Let's see where the CIA framework can get us there.

03:30.660 --> 03:33.080
I define the blockchain as a shared database.

03:33.080 --> 03:36.900
Thus, it's entirely transparent, and there really isn't very much confidentiality.

03:37.480 --> 03:45.620
Jumping down to availability, this is also not going to be a focus because it's not a huge concern for anyone except for the protocol designers.

03:45.960 --> 03:46.940
These concerns matter.

03:46.940 --> 03:51.060
Concerns about the availability of blockchains have driven much of what's known as the scaling debate.

03:51.600 --> 04:01.380
If protocol design makes the resources required to run and participate in the network too expensive, it may impact the availability of the information, which could have many negative impacts on the network.

04:03.380 --> 04:06.780
Violating the integrity of a blockchain is what I want to talk about.

04:06.880 --> 04:08.700
It's a way to hack cryptocurrency.

04:08.900 --> 04:13.360
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:27.040
Exchanges make an ideal target for all kinds of attacks, but especially 51% attacks, which I'll dive into in the second part.

04:28.320 --> 04:31.600
First off, exchanges hold a lot of cryptocurrency on behalf of their customers.

04:31.600 --> 04:34.280
That's an obvious enough reason for them to be good targets.

04:34.680 --> 04:36.440
There are other characteristics, though.

04:36.440 --> 04:38.260
For instance, liquidity and volume.

04:38.260 --> 04:42.800
Being able to trade one cryptocurrency into a different one can be very advantageous to an attacker.

04:43.380 --> 04:44.180
Speed.

04:44.480 --> 04:50.060
Exchanges often credit funds to attackers on a relatively short time frame and allow for nearly instant sends.

04:50.060 --> 04:52.380
An attack could therefore happen very quickly.

04:53.820 --> 04:55.140
Remote interaction.

04:55.140 --> 04:59.780
An attacker can execute many of these attacks from across the ocean, perhaps from North Korea.

05:00.520 --> 05:03.100
And in some cases, anonymity.

05:03.140 --> 05:04.800
I want to take a second to talk about this.

05:04.800 --> 05:12.040
Many popular media descriptions of cryptocurrency seem to describe it with some magical anonymity qualities, which it doesn't have.

05:12.100 --> 05:16.100
This is especially true if you have an authenticated session with an exchange such as Coinbase.

05:16.400 --> 05:20.080
Coinbase strives to be the most trusted exchange in the entire cryptocurrency industry.

05:20.140 --> 05:21.960
And as part of that, we're heavily regulated.

05:21.960 --> 05:27.920
And a large part of that regulation involves the lengths we go to ensure every customer on our platform has gone through KYC, AML.

05:28.100 --> 05:30.600
KYC, know your customer, so we know their identities.

05:30.680 --> 05:32.980
And that's important for AML, anti-money laundering.

05:33.120 --> 05:38.780
Any exchange that doesn't have these strict requirements would obviously be more attractive to potential attackers.

05:39.640 --> 05:52.620
So if you can find some sort of vulnerability, whether that's subverting a protocol or a more traditional wallet-style vulnerability, as I described earlier, this makes an exchange a great target.

05:55.630 --> 05:58.610
So 51% double spend attacks.

05:59.230 --> 06:04.230
As I mentioned before, a blockchain is a shared database stored by all nodes on the network and accessible to anyone.

06:05.050 --> 06:08.070
For this database to be useful, there must be a way to update it.

06:08.350 --> 06:12.590
Blockchains are append-only databases and are updated in batches of transactions.

06:12.710 --> 06:16.370
Each batch of transactions that's added to the blockchain is typically called a block.

06:17.310 --> 06:23.370
So you can visualize the blockchain like this with the expectation that a block n plus one would shortly be added.

06:24.050 --> 06:25.450
But that raises a question.

06:25.450 --> 06:27.310
Who defines block n plus one?

06:27.330 --> 06:33.990
The database is shared and distributed, so there must be some way of coming to consensus among the network participants about what constitutes this block.

06:34.030 --> 06:36.790
The answer to this question is it depends on the cryptocurrency.

06:36.910 --> 06:43.830
This is one of the major defining characteristics of cryptocurrencies, and a lot of new cryptocurrencies have innovative methods for adding to the blockchain.

06:44.630 --> 06:51.930
For instance, Ripple and Stellar have a concept of validator nodes that use a voting consensus protocol to determine which transactions are in this block.

06:52.630 --> 06:59.350
EOS goes through regular elections where these nodes are called block producers and they take turns defining the block.

06:59.830 --> 07:04.090
Tezos and Cosmos, the node chosen is based on its stake.

07:04.090 --> 07:07.710
It's a proof-of-stake network and stake is the proportion of network funds owned.

07:08.470 --> 07:10.710
Lastly, Bitcoin and Ethereum.

07:11.050 --> 07:14.890
The node that first successfully solves a cryptographic puzzle defines the block.

07:15.210 --> 07:16.830
This is known as proof of work.

07:17.330 --> 07:23.590
It's known as proof of work because the solution to the cryptographic puzzle has to be brute-forced, which takes considerable computational effort.

07:23.590 --> 07:24.730
This is called mining.

07:25.050 --> 07:28.370
Mining a block is when a node discovers the solution to the proof-of-work puzzle.

07:28.890 --> 07:31.750
Here's a key fact about proof-of-work networks.

07:32.010 --> 07:37.590
Anyone can bring their computation to the table and if they produce a valid block, they have extended the blockchain.

07:37.930 --> 07:44.870
Since this is a distributed and permissionless way of extending the blockchain, it's possible that the network will encounter multiple versions of the blockchain.

07:45.110 --> 07:52.610
To resolve these versions and reach consensus on a single version, the network deems the version with the most work to be the canonical blockchain.

07:52.610 --> 07:54.150
I'll explain what I mean by that.

07:54.350 --> 07:58.170
This diagram shows the blockchain tilted 90 degrees with the blocks separated.

07:58.170 --> 08:01.030
Block n plus one will be added on top of the other blocks.

08:01.090 --> 08:04.210
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:18.370
It broadcasts the block that solves this puzzle to the network and all transactions in the block are added to the canonical history of transactions that is added to the blockchain.

08:19.630 --> 08:22.270
But suppose the second block is found simultaneously.

08:22.690 --> 08:26.090
How does the network decide which block contains the transactions that are to be added?

08:26.870 --> 08:32.410
The rule is that the nodes on the network define the series of blocks with the most work as the canonical history.

08:32.610 --> 08:40.370
So if either of the two blocks gets another block extending on top of it, 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:53.010
If enough work decides to extend from a different block, once that branch has outworked the rest of chain, it will be the canonical history.

08:53.470 --> 09:01.550
The situation on the slide is called a reorg, short for reorganization, and the grayed out blocks are known as orphan blocks, and they are not part of the blockchain.

09:03.130 --> 09:04.770
Let me repeat a key fact.

09:04.770 --> 09:14.350
Any actor that can outwork the rest of the network is the sole arbiter of which, among all possible valid transactions, are the ones that are added to the canonical history.

09:14.910 --> 09:25.630
So if there's any kind of network instability where blocks were not always immediately shared with the network after they were found, or if some actor was deliberately holding back blocks that had been discovered, we could see something like what's shown on this slide,

09:25.630 --> 09:27.870
where the blocks on the left are hidden from the network.

09:27.870 --> 09:36.750
But if they were shared and made public, the network would switch over to these blocks and define them as the canonical chain, orphaning all the blocks that were previously the most recent additions to the chain.

09:37.870 --> 09:51.190
Because of this potential for instability of the most recent blocks, anyone receiving a transaction should wait for several blocks to be found after the block that contained their transaction to lower the chance that the block containing their transaction will be orphaned.

09:51.430 --> 09:55.650
An analogy that I found interesting is that the most recent blocks are like recently fallen leaves in the fall.

09:55.650 --> 09:57.510
They can blow around and change and shift.

09:57.510 --> 10:04.730
After a while they might get waterlogged and not move very much, and after even longer they'll decompose into mud, clay, and eventually rock.

10:04.730 --> 10:11.670
You can adjust your risk by selecting the number of blocks that you wait until you consider a transaction finalized.

10:11.690 --> 10:17.310
This is known as the confirmation requirement, and each recipient of a transaction decides on their own level.

10:19.540 --> 10:26.020
So imagine we had the following situation where Coinbase supports a fictional coin, McCoin, abbreviated MUH.

10:26.140 --> 10:30.160
Suppose the confirmation requirement for MUH is three blocks.

10:30.400 --> 10:34.580
Coinbase also supports BTC, Bitcoin, and MUH trading.

10:34.920 --> 10:37.660
Any customer of Coinbase could have the following intention.

10:37.660 --> 10:41.720
Create a transaction T that sends coins from the customer's wallet to Coinbase.

10:41.720 --> 10:51.080
Wait for three blocks, after which Coinbase will consider the transaction finalized, and Coinbase will credit these funds to the customer's Coinbase account.

10:51.080 --> 10:57.540
Then the customer may want to sell the MUH for BTC and then send the BTC wherever they like, off-site, off the platform.

10:57.540 --> 11:00.820
This is a completely normal pattern of behavior for a customer to take.

11:02.420 --> 11:06.640
Let's imagine instead though that the customer is actually an attacker.

11:06.680 --> 11:10.600
An attacker with a special ability to outwork the rest of the network.

11:11.100 --> 11:15.780
The attacker creates transaction T, sending some amount of MUH onto Coinbase.

11:15.780 --> 11:19.160
Suppose T is quickly included in a block by some miner on the network.

11:21.360 --> 11:24.980
Simultaneously, the attacker will create a second transaction, T'.

11:24.980 --> 11:30.200
Notice that T' sends the same funds that were sent in T, addressed at A1.

11:30.800 --> 11:34.240
However, T' sends those funds to address A2.

11:34.660 --> 11:37.420
T and T' could never exist in the same blockchain together.

11:37.420 --> 11:42.840
As soon as one is included, 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:54.440
The space on the right with the gray background is local to the attacker and the network cannot see this block.

11:54.920 --> 12:01.920
Remember that we've assumed the attacker can outwork the rest of the network, meaning the attacker can produce blocks faster than the rest of the entire network.

12:03.640 --> 12:10.000
So in order to do anything with the MUH on Coinbase, it first needs to have three confirmations because that's what it takes to be credited.

12:10.940 --> 12:15.060
The attacker does not sit idly by and continues to secretly produce blocks.

12:15.620 --> 12:21.740
The network also produces blocks, but unknown to anyone, it's not keeping pace with the secret blocks produced by the attacker.

12:23.000 --> 12:27.420
Finally, the network produces the third block, three confirmations on the transaction.

12:27.420 --> 12:32.860
The attacker is now credited with the MUH and can sell it for BTC, which could then be sent off the Coinbase platform.

12:33.440 --> 12:35.720
So the BTC could be withdrawn.

12:36.000 --> 12:38.060
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:44.660
But now the attacker can execute the attack.

12:44.760 --> 12:47.380
The attacker can reveal the blocks to the network.

12:47.420 --> 12:50.660
These blocks have more accumulated work than the existing top three blocks.

12:50.660 --> 12:53.920
So according to the network rules, a reorg will occur.

12:53.920 --> 12:56.740
The attacker's blocks now representing the canonical chain.

12:57.080 --> 13:01.340
The top three blocks that we've previously seen publicly now become orphan blocks.

13:01.340 --> 13:06.580
They're no longer part of the blockchain and the transactions defined in them are now no longer part of the canonical history.

13:07.220 --> 13:12.560
And notice the T was in those blocks, meaning that there's no longer a transaction to Coinbase in the blockchain anymore.

13:12.640 --> 13:15.260
But the BTC has already been withdrawn.

13:15.260 --> 13:19.300
There was a withdrawal , there was no deposit, aka a theft.

13:19.500 --> 13:24.320
The ability to do this is directly related to how difficult it is for an attacker to overpower the network.

13:24.320 --> 13:33.520
The more work being put into solving the proof of work puzzles on the network, the more difficult it will be for any one entity to marshal the resources and overwhelm the network.

13:34.420 --> 13:39.460
Note that the danger of this attack comes when you accept a deposit directly from the attacking entity.

13:39.500 --> 13:43.800
In this example, BTC was provided in exchange for MUH.

13:43.800 --> 13:49.780
If the attacker can't get something irrevocable in exchange for this vulnerable coin, the attack is invaluable.

13:49.920 --> 13:53.820
This is one of the reasons that an exchange is a great target for this attack, liquidity.

13:56.400 --> 14:01.120
The thing about 51% attacks is they're pretty obvious if you know what to look for.

14:01.760 --> 14:06.160
Each block in the blockchain is identified by its hash, providing a unique fingerprint.

14:07.260 --> 14:12.300
If the hash of block at height n changes from what it was before, that block was replaced with a new block.

14:12.300 --> 14:13.960
There must have been some kind of reorg.

14:15.400 --> 14:19.400
Small reorgs, shallow depth reorgs, happen on a regular basis.

14:19.400 --> 14:23.760
This is primarily driven by the fact that many nodes across the world are attempting to find blocks.

14:23.760 --> 14:31.400
There is some amount of latency in the network, so there will be race conditions where multiple blocks are found simultaneously and eventually only one will be in the blockchain.

14:32.260 --> 14:40.880
However, deeper reorgs do allow for attacks if they exceed the confirmation limit of the service.

14:43.540 --> 14:47.980
You can inspect a reorg to look for the presence of T and T prime.

14:48.380 --> 14:52.080
Two transactions are double spends if they send the same money but to different places.

14:52.080 --> 14:56.180
They can't exist in the chain together, but they might exist in competing branches of the chain.

14:56.340 --> 14:59.760
This is the smoking gun that a reorg is malicious.

14:59.760 --> 15:03.920
Money that was sent to one place is effectively clawed back when the new blocks are revealed.

15:05.840 --> 15:09.320
From the attacker's point of view, the attack has two components.

15:09.880 --> 15:14.020
One is the ability to form the secret chain, which requires majority hash power.

15:14.740 --> 15:18.200
Two, the ability to create transactions T and T prime.

15:18.300 --> 15:24.940
You're going to need some amount of 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:29.100
An attacker is also going to need to select a victim.

15:29.140 --> 15:36.720
Obviously, the victim must accept the currency, but the victim has to provide something of value that they cannot take back once they realize they've been attacked.

15:36.820 --> 15:38.920
So an attacker couldn't sell the coin for U.S.

15:38.920 --> 15:40.140
dollars and transfer the U.S.

15:40.140 --> 15:41.940
dollars to a bank account.

15:41.940 --> 15:46.420
Not only would that likely expose the attacker's identity, but the bank transfer can usually be reverted.

15:47.020 --> 15:51.460
Cryptocurrencies that aren't vulnerable to 51 percent attacks, however, cannot be reverted.

15:51.680 --> 15:57.020
This is another reason why cryptocurrencies exchanges make such good targets for 51 percent attacks.

15:57.020 --> 15:59.000
You can get cryptocurrency from them.

15:59.760 --> 16:09.960
Also notice that this attack can be repeated indefinitely until the victim takes defensive action, either by raising the confirmations required on their service or simply shutting down their interaction with this currency.

16:12.380 --> 16:17.500
We're going to walk through some real world examples of 51 percent double spending attacks.

16:18.220 --> 16:24.240
The one we'll go into most detail is the 51 percent attack on Ethereum Classic.

16:24.240 --> 16:34.580
In early January was when this happened, and because it's an asset that supports, we had monitoring systems in place which alerted in real time to the attack, allowing us to pause interaction with the blockchain.

16:34.960 --> 16:37.180
I'll talk about how this attack unfolded.

16:37.660 --> 16:42.340
The ETC network is minding its own business, mining blocks as usual, adding transactions to the blockchain.

16:44.360 --> 16:56.760
Then all of a sudden, seven new blocks show up out of nowhere, and these seven blocks don't extend from the most recent block, but dig down five blocks back, and it happens again.

16:56.760 --> 16:59.640
Six new blocks are fitting five previously discovered blocks.

17:00.440 --> 17:07.160
I called both of these events practice attacks, and the reason for that is because they were just reorgs.

17:07.160 --> 17:15.560
There was never a pair of transactions, T and T prime, where the same money was spent in one place in the first branch to a different place in the second branch.

17:16.480 --> 17:22.680
We hadn't observed reorgs of this depth ever on Ethereum Classic, and so it would have been premature to call these attacks.

17:22.820 --> 17:28.240
But once we were seeing these, we were alerted that something unusual was going on.

17:28.640 --> 17:32.540
And three hours later, there was a very deep reorg.

17:32.540 --> 17:37.000
74 new blocks showed up all at once, orphaning 57 blocks.

17:37.840 --> 17:46.200
And in this reorg, there was a T and T prime, where the same money was spent first to one place and then to another.

17:46.620 --> 17:48.040
This was on a Saturday night.

17:48.040 --> 17:53.560
Our on-call engineers responded, validated the alert, and turned off ETC send and receive functionality.

17:55.720 --> 18:01.880
Ethereum Classic isn't the only successful 51% attack.

18:01.880 --> 18:04.980
It's the one we're most familiar with because it's the one we were closest to.

18:05.420 --> 18:08.360
But I'm going to talk about two others that we've looked into closely.

18:08.360 --> 18:11.180
BTG is Bitcoin Gold, and VTC is Vertcoin.

18:11.180 --> 18:12.780
But those aren't the only other two.

18:12.780 --> 18:14.300
There have been others as well.

18:17.200 --> 18:21.900
Some of the observed patterns we see from looking into these three different attacks.

18:22.480 --> 18:24.720
It's important to realize blockchains are public.

18:25.440 --> 18:28.320
This means that a 51% attack is a pretty noisy attack.

18:28.320 --> 18:30.980
It leaves all kinds of good data for understanding the attackers.

18:31.140 --> 18:36.680
I'm going to walk through just a few of the things that we've observed, but they really only scratch the surface of what you can learn about an attacker.

18:36.680 --> 18:46.180
These attacks leave such a trail of damage, you could say, behind them that I don't think it would be very long before we're very good at learning quite a bit about attackers of this sort.

18:48.080 --> 18:57.440
This chart shows all 17 of the reorgs that we were able to find in our research into the Bitcoin Gold attack, and how much Bitcoin Gold was taken in each one of them.

18:57.680 --> 19:01.780
Notice the first two didn't take anything.

19:02.960 --> 19:05.100
This is Vertcoin, VTC.

19:05.100 --> 19:07.100
The first five took nothing.

19:08.240 --> 19:12.300
And notice the first two in Ethereum Classic also took nothing.

19:12.740 --> 19:15.960
Remember what I said, the 51% attack has two parts.

19:16.040 --> 19:21.140
First, being able to build the secret chain, and then properly creating transactions TNT Prime.

19:21.260 --> 19:22.620
So what did the attackers do?

19:22.620 --> 19:28.820
They broke the problem down into those two steps, made sure they could build an attack chain before they worried about building TNT Prime.

19:28.820 --> 19:31.120
Even criminals need integration tests.

19:33.120 --> 19:34.900
Criminals are also not perfect.

19:34.940 --> 19:37.400
These are the same three charts as before, all in one slide.

19:37.880 --> 19:41.540
You may have noticed that there were gaps when I first showed these to you.

19:41.820 --> 19:43.680
They're a little harder to explain, I think.

19:43.680 --> 19:52.320
But as far as I can tell, the attackers did a bunch of work in these cases to reorg the chain, but they didn't put in a TNT Prime, so they didn't cash in on any double spending.

19:52.680 --> 19:55.580
For the first few attacks, it makes sense to assume that they're practicing.

19:56.220 --> 20:00.600
But once they've proven they can do that, these just look like mistakes to me.

20:03.650 --> 20:07.270
There's also an invest-exploit decision that an attacker has to make.

20:07.530 --> 20:10.750
Imagine yourself in the attacker's shoes, and you kind of have an interesting dilemma.

20:10.750 --> 20:22.030
Once you have the hash power to successfully attack the network, any additional resources you have should be directed towards owning the currency itself to amplify the impact of TNT Prime.

20:22.390 --> 20:26.870
In other words, the cost of the attack and the payoff of the attack are not functions of one another.

20:27.250 --> 20:32.150
So as an attack progresses, you're accumulating resources if you're being successful.

20:32.150 --> 20:34.690
Should you reinvest these, or should you take them off the table?

20:34.910 --> 20:36.910
You know how I said blockchains are very transparent.

20:36.910 --> 20:39.890
We can observe the decisions they made clear as day.

20:41.590 --> 20:48.650
In the Bitcoin Gold attack, and in the vast majority of the Vertcoin attack, attackers are mostly in exploit mode.

20:48.650 --> 20:54.410
They have X amount of coins, and every time they attack the network, they perform a double spend, they get X payoff.

20:55.490 --> 21:03.110
But in the Ethereum Classic attack, and oddly in these first three Vertcoin attacks, the attackers seem to be also in invest mode.

21:03.130 --> 21:13.330
This makes me think that the Ethereum Classic attackers may have been planning to continue attacking, because I would expect an optimal attack profile to include a period of invest, followed by a flat period of exploit.

21:13.870 --> 21:17.170
There's also something really interesting about the Ethereum Classic data.

21:17.530 --> 21:19.310
Notice how it steps up in pairs.

21:19.550 --> 21:23.410
The first double spend was for a tiny amount, also probably a test.

21:24.310 --> 21:29.650
You can see at number four and five, they're roughly the same size.

21:30.110 --> 21:45.550
But then the size roughly doubled for six and seven, almost doubled again for eight and nine, stepped up significantly for 10 and 12, with 11 looking like it may have been another mistake, and then doubled again for 13 and 15, with 14 being another possible mistake.

21:45.790 --> 21:48.890
It seems to me that the attacker was balancing investing and exploiting.

21:48.930 --> 21:53.050
Bigger and bigger payoffs every time, but you never know when the party is going to stop.

21:53.270 --> 21:55.530
And so you want to take money off the table while you do it.

21:55.570 --> 21:57.070
That's what this looks like to me.

21:59.580 --> 22:02.140
This is also really profitable for the attackers.

22:02.740 --> 22:09.680
You can see our estimates on how much the double spends were worth, and our estimates on how much the mining cost would have been to perform these attacks.

22:09.680 --> 22:11.100
You can see the profit margins.

22:11.100 --> 22:12.140
It's absurd.

22:12.160 --> 22:14.880
Our mining cost estimates were also fairly conservative.

22:15.780 --> 22:19.640
We're also not even factoring the money made from the mining reward.

22:19.640 --> 22:22.480
The attacker mined valid blocks.

22:22.520 --> 22:25.700
Those blocks come with a mining reward, just like regular miners would have gotten.

22:25.700 --> 22:27.200
I'm not even factoring that in.

22:27.200 --> 22:30.640
They're approximately on the same order of magnitude as the mining cost, however.

22:34.020 --> 22:39.720
But the mining reward and leftover coins from the attack do typically get sold, so attackers are cashing in on this.

22:39.900 --> 22:50.220
In the case of Bitcoin Gold, it looked like about 75% of the mining rewards were moved shortly after the attack, probably to an exchange, probably to 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:02.900
Analyzing the time of day that the attacks happen is another route to understand the attackers.

23:02.900 --> 23:05.420
I've mapped the times of the attacks on this slide.

23:06.300 --> 23:09.920
It's hard to draw meaningful conclusions from Bitcoin Gold and Vertcoin.

23:09.920 --> 23:16.640
There does seem to be some clustering, but it's not too dramatic and they do have pretty much 24-hour coverage during the attack.

23:17.040 --> 23:21.440
Ethereum Classic, however, obviously has a time of day pattern in the attack.

23:21.520 --> 23:26.880
And that one outlier that you see was actually the very first practice attack, so it's a different case anyway.

23:27.260 --> 23:33.000
If such a major pattern does emerge, I would consider there to be two major hypotheses about what could be driving it.

23:33.000 --> 23:39.240
The attacker's preferred waking hours or the time zone the attacker considers most damaging to the victim, probably at night.

23:39.480 --> 23:48.440
Also note that the Ethereum Classic attacks and most of the Vertcoin attacks happened over weekends, again, probably because that is when it is most difficult for an exchange to respond.

23:49.460 --> 23:59.040
When doing timing analysis, note that these attacks can sometimes take hours for the attacker to build the chain, meaning the attacker doesn't have the full luxury of choosing their timing and may be forced to work around the clock.

23:59.040 --> 24:05.640
As an example, the longest Bitcoin Gold attack chain was 27 blocks, which probably took them over four hours to mine.

24:05.700 --> 24:11.420
The longest Vertcoin attack chain was 310 blocks, which probably took them over 12 hours to mine.

24:14.880 --> 24:20.500
As I said earlier, the risk for 51% attacks is in accepting money directly from an attacker.

24:20.600 --> 24:25.280
An attacker will want to find an exchange where it's possible to hide their identity from the exchange.

24:25.400 --> 24:37.500
In the case of Bitcoin Gold, Bitcoin Gold was delisted from Bittrex shortly after the attack, and the Bitcoin Gold dev team put out a statement claiming that Bittrex was a victim of the attack, and that explained their delisting.

24:37.880 --> 24:40.560
I don't know who the victims were of the Vertcoin attack.

24:40.600 --> 24:45.680
In the case of Ethereum Classic, three exchanges all put out statements acknowledging that they were targets.

24:45.680 --> 24:48.080
KYC can help prevent an attack.

24:49.420 --> 24:52.900
Another pattern, the attacks stop after they're publicized.

24:53.080 --> 24:54.540
Cockroaches hate the light.

24:55.120 --> 24:57.240
Bitcoin Gold was a three-day attack.

24:57.240 --> 24:59.200
It was publicized on the third day.

25:00.780 --> 25:03.560
Vertcoin was nearly two months.

25:03.740 --> 25:06.880
The day it was publicized was the day of the last attack.

25:07.420 --> 25:10.480
And Ethereum Classic, also a three-day attack.

25:10.480 --> 25:13.100
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:34.340
Consider the example of the very first Ethereum Classic double spend attack that I talked about before, where 74 blocks did the orphaning of 57 blocks.

25:35.060 --> 25:40.400
This would be the ideal block for an attacker to have placed their transaction T in.

25:40.400 --> 25:46.600
It's the deepest block that was orphaned, which would have given transaction T 57 confirmations at the time of the attack.

25:47.680 --> 25:53.540
Instead, T was placed 13 blocks higher, where it only had 44 confirmations at the time of the attack.

25:53.600 --> 25:56.700
Transaction T was not the deepest orphan block.

25:56.700 --> 26:05.420
That means the attacker did the amount of work required to orphan a transaction with 57 confirmations, but only for a transaction that had 44.

26:05.720 --> 26:10.840
This happens in the vast majority of the double spends that we've observed, which is frankly very puzzling.

26:12.760 --> 26:14.020
So let's review.

26:14.020 --> 26:16.740
I define hacking by attacking the integrity of the blockchain.

26:16.740 --> 26:18.820
New technologies, new ways to hack.

26:18.840 --> 26:26.100
I described a 51% double spend attack, then I walked through real world examples of these attacks, along with the patterns that we've observed.

26:27.240 --> 26:28.360
That concludes my talk.

26:28.360 --> 26:29.540
Does anyone have any questions?

26:37.380 --> 26:37.920
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:58.710
When a block is orphaned, is that data lost?

26:58.830 --> 26:59.730
Is that what you're getting at?

27:09.570 --> 27:12.210
Yeah, a node will store that data on its own.

27:12.210 --> 27:18.250
So when a block is orphaned, the node in its database will say this is an orphan block, but it'll hold it.

27:18.250 --> 27:20.230
And so you can still query your node for that data.

27:20.230 --> 27:24.210
Your node had to be around at the time, because those blocks aren't being shared around on the network.

27:24.210 --> 27:26.090
But if your node saw it, your node has it.

27:27.810 --> 27:28.450
Yeah?

27:28.450 --> 27:33.710
So you mentioned that the payout for mining a block is a cost.

27:34.250 --> 27:45.130
It's not exactly, but I think they're probably close, especially in smaller market CapCoins, where general purpose hardware can be moved to arbitrage the mining reward.

27:49.290 --> 27:51.790
This is way more profitable.

27:52.030 --> 28:06.370
If someone is going to take a deposit for a very weak amount of confirmations and give you something incredibly valuable for it, it's just so trivial to claw back the original deposit.

28:07.430 --> 28:09.250
I don't really think they are.

28:12.830 --> 28:17.890
Yeah, well, yes, when they mine their blocks, those are just ordinary nodes.

28:17.890 --> 28:24.450
And the easiest way for them to do it is to not even modify the software, just disconnect it from the internet, mine your block, you create your transactions.

28:24.450 --> 28:31.710
And then once you look locally, you see that you've outpaced the main chain, you just connect to the internet and then the reorg will happen by itself.

28:33.330 --> 28:41.090
So Coinbase has never lost anything in this sort of attack.

28:41.130 --> 28:47.470
We've only seen one attack on an asset that we support, which was the Ethereum Classic attack.

28:47.470 --> 28:51.950
We noticed it immediately because we were monitoring for this and we immediately shut down.

28:52.810 --> 28:58.910
I can't remember the number, there are something like 15 of these reorgs with Ethereum Classic.

28:58.910 --> 29:02.470
The very first one that had a double spend, we alerted and we shut down.

29:02.470 --> 29:06.010
So all the subsequent ones, we're offline and they couldn't have attacked us.

29:06.430 --> 29:11.850
Yeah, but actually there are four different exchanges targeting the ETC 51%.

29:11.850 --> 29:16.410
And actually one of our customers was not that happy because the bank has sent the ETH.

29:16.410 --> 29:25.170
But really the question to you guys is, if you want to withdraw that fiat from Coinbase, it takes quite a bit, right?

29:25.170 --> 29:36.110
And literally, if I am the attacker, how would I cash out or move the fund so that I can cause damage to the exchange?

29:36.110 --> 29:42.070
I don't think that's the case for Coinbase, but under what scenario would that be a damage?

29:42.270 --> 29:45.310
So I'm not sure I understand your question.

29:45.310 --> 29:50.390
I think you're saying if there's a delay on withdrawing from the exchange, that makes it harder to attack the exchange.

29:50.390 --> 29:57.850
And you're definitely correct that if there is a delay in withdrawing the exchange, because then the attack could potentially be detected and before the funds left, you could put a hold on them.

29:57.850 --> 29:59.130
But that's not true in all cases.

29:59.130 --> 30:02.410
You can transfer onto an exchange, sell and transfer off.

30:02.470 --> 30:06.870
And that is a very common pattern without these long delays.

30:07.770 --> 30:10.850
It's one of the pain points for a lot of customers in the cryptocurrency industry.

30:10.850 --> 30:14.330
They don't want to sit and wait for five days for seemingly no reason.

30:14.470 --> 30:17.790
So it's a constant balance to get that number right.

30:17.790 --> 30:21.050
But the faster it is, the better the opportunity for an attacker.

30:23.030 --> 30:24.370
Any other questions?

30:29.880 --> 30:30.820
What's that?

30:36.070 --> 30:38.930
Once the attacker transfers out of Coinbase, it's out of our control.

30:38.930 --> 30:46.610
So then if they can claw back that original send, then they got away with it, essentially, which has never happened to Coinbase, just to be clear.

30:47.270 --> 30:48.610
Any other questions?

30:52.990 --> 30:53.750
All right.

30:53.750 --> 30:54.650
Thank you, everybody.

