Attack Vectors in Cryptocurrencies
The cryptocurrency markets have soared to values beyond what even the most optimistic and enthusiastic investors could have thought of. Bitcoin, Ethereum, and the so-called Altcoins towered in prices in recent months, albeit at a slower pace beginning this year. There’s no doubt about the potential of cryptos to transform monetary systems.
Whereas the potential of these cryptos to revolutionize the financial system is clear, cynics are quick to point out various attack vectors which can impede their adoption. In this chapter, we’ll explore various attack vectors in cryptocurrencies. While the majority of the attacks to be explored will be mostly hypothetical, you’ll realize that some of them are already affecting various cryptos.
Let’s dive in.
Classification of attacks
Attack vectors can be classified into 5 main categories:
- Double spending attacks;
- Mining pool attacks;
- Client-side security threats;
- Cryptocurrency related attacks;
- Attacks that slow down the cryptocurrency adoption;
#1: Double spending attacks
Bitcoin was the first cryptocurrency to resolve the problem of double-spending. Bitcoin solved the double spending hurdle by using Blockchain’s Proof-of-Work (PoW) algorithm which prevents users from copying or sending the same bitcoins to multiple parties in the network.
To understand how a double-spending attack can occur, let’s first explore how Bitcoin prevents it.
All cryptocurrencies usually maintain a chronologically-ordered and time-stamped Blockchain that has all the transactions from the start of its operation. In the case of Bitcoin, after roughly every 10 minutes, a new block is appended to the Blockchain. All the nodes in the Bitcoin ecosystem must store a copy of this global Blockchain.
Now let’s see how the Bitcoin network thwarts double spending:
Suppose you have 0.5BTC that you would like to send to Alice and Jane.
Obviously, you’ll make a 0.5BTC transaction to Alice for the first time. You’ll again sign and transfer the same 0.5BTC using another Bitcoin address to Jane. Here’s what will occur:
Both transactions will be presented as unconfirmed pools of transactions. However, only the first transaction will get more confirmations by miners and therefore be validated in the next block. Even though the second transaction to Jane will also get some confirmations, those confirmations will be fewer and therefore, it will not get validated.
But what happens when you send the same coins simultaneously to Alice and Jane?
In this instance, miners will simultaneously pull from the mining pool and whichever transaction that gets the maximum number of confirmations will be included in the next block while the other one will be rejected. In this case, a confirmation will be nothing more than just a new block being appended to the previous one.
If the block was successfully appended to your payment block, this implies that the block is valid since every block has a mathematical relationship with the previous one. Therefore, Alice and Jane have to wait for at least 6 confirmations to be sure that no one will reverse the 6 hashes and therefore, interfere with the generated block.
There are 3 types of double-spending attacks:
- 51% attacks;
- Race attacks;
- Finney attacks;
- 51% attacks
If anyone could own more than 51% of the network’s computational power, then he/she could effectively generate a fake block in the chain which, unfortunately, every miner will trust to be valid. However, as a result of the hardware and electricity costs involved, generating a fake block may be impossible at the moment.
But what could happen, if you were to send 0.5 BTC to Alice and yourself? Theoretically, you could get 6 confirmations before Alice. In this case, Alice won’t receive the payment if she didn’t wait for 6 confirmations. However, you’ll have managed to send 0.5BTC to your own account.
The diagram below summarizes the 51% attack in cryptocurrencies:
- Race attacks
If you decide to pay Alice 0.5BTC in exchange for goods or services and sign a corresponding transaction, it’s likely to simultaneously generate a different transaction with the same number of bitcoins to Jane. If this were the case, then the protocol will only accept one of the transactions.
Because there is a race about which transaction will be confirmed first, this attack is called a race attack. Alice may want to minimize the risk of a race attack by specifying that she won’t deliver the goods or services until the payment is confirmed in the Blockchain.
- Finney attacks
A Finney attack is a variant of the race attack which requires the involvement of a miner. Rather than sending both payment requests (to pay Alice and Jane with the same 0.5BTC), you’ll only transmit the request to pay Alice while an accomplice tries to mine a block with a payment request to Jane instead of Alice.
There is a likelihood that a fake miner may succeed before the cryptocurrency network, in which case payment to Alice will be thwarted. As it’s the case with the plain race attacks, Alice can minimize the risk of the attack by waiting for the payment to be confirmed on the Blockchain.
#2: Mining pool attacks
The primary objective of creating a mining pool is to enhance the computing power which has a direct impact on block validation time, hence more chances of winning rewards. In the recent past, large numbers of mining pools have been created as a result of the likely rewards to be gained.
Typically, mining pools are governed by pool managers who often forward any unsolved work units to the miners who in turn, create partial proof-of-work (PPoWs) and full proof-of-work (FPoWs), and send them back to pool managers in form of shares.
Once a miner generates a new block, it is sent to the pool manager together with its associated FPoW. The pool manager then broadcasts the new block to the ecosystem to receive the reward. The pool manager will then distribute the mining reward to miners based on the percentage of shares they have contributed to the network.
Ideally, parties are incentivized based on their PPoWs, which have absolutely no value within the majority of cryptocurrencies such as Bitcoin. For instance, the Bitcoin system only supports solo miners, open pools, and closed miners. In recent years, attack vectors that exploit vulnerabilities in pool-based mining have increased.
Here are some of the mining pool based attacks:
- Selfish mining; and
- Block withholding
- Selfish mining
The majority of mining pools allow miners to join them using the Public Internet which is vulnerable to multiple security threats. Malicious users believe that it is profitable to cannibalize the pools as opposed to honest mining.
Consider the following example:
Suppose a miner with a 30% of hash rate and 3 BTC is the block mining reward.
If the pool is sharing the incentive based on the invested hash rate, then a malicious user will get 1BTC for every new block generated in the network. Now, suppose the malicious miner buys more equipment, which is worth 10% of the current hash rate. With a standard mining strategy, that miner will receive additional revenue of 0.333BTC for the 10% addition to the hash rate.
By pool cannibalizing (distributing 10% equally among all the other pools and withholding any valid blocks) the malicious miner will still get rewards from its pool and additional incentives from other pools to which he/she is sharing the 10% hash rate. This anomaly, if undetected, can be unfair to other miners.
- Block withholding
In Block withholding, a pool member doesn’t publish a mined block with an intention of sabotaging the pool revenues. The member will continue to mine the next blocks as he/she maintains the lead. When the rest of the system is about to play catch up, he/she only releases a portion of the mined blocks.
The above diagram illustrates an instance where a pool member doesn’t publish a mined block with the hope of sabotaging the system.
The result of Block withholding is a proof of work which is longer and more difficult for the rest of the network users to adopt as their block solutions claim the rewards. There are 2 Block withholding scenarios: “Sabotage” and “Lie and wait.”
In the “Sabotage” Block withholding scenario, the miner will not gain any bitcoins. His intention is to make the other pool members lose. In the “Lie and wait” scenario, the attacker performs a complex block concealing attack (similar to one described in self-mining) to earn additional income.
#3: Client-side security threats
Today, there is a huge number of users holding bitcoins in their accounts because of Bitcoin’s popularity. Each Bitcoin has a set of private/public keys that are used to access the account. To use bitcoins, you must install a wallet on your mobile device or desktop. The diagram below summarizes how a wallet address is created:
Because of the nature of these keys, it’s desirable to arm yourself with key management techniques which are usable and secure.
This is because, unlike many cryptographic applications, any loss of keys or compromised keys can lead to loss of money. Wallet thefts can occur via methods such as system hacking, incorrect use of the wallet and installing a “Trojan” software. The Bitcoin protocol relies on ECC (Elliptic Curve Cryptography) to secure transactions.
Consider a standard such as P2PKH (“Pay-to-PubKeyHash”):
For you to use this standard, you have to provide your public key and a signature which is embedded in the transaction to prove your identity. Now, to generate the signature, you’ll select a per-signature random code or number. For security reasons, this number must be secret and be unique for every other transaction on P2PKH.
Repeating the per-signature number can be risky to your private key computation. This is because even the partially bitwise equal random numbers can help an attacker to derive your private key. The table below summarizes attack vectors that result from client-side threats:
Table 1.1: A summary of client-side attack vectors
Let’s explore some of these attack vectors:
- Distributed Denial-of-Service (DDoS)
DDoS targets the cryptocurrency exchanges, wallets and mining pools. Because of the decentralized nature of most cryptocurrencies and the consensus algorithms, launching DDoS will have a minimal impact on the network’s performance. Therefore, attackers must design and launch powerful DDoS to interfere with the functionality of the crypto network.
Unlike the DoS attacks where a single attacker carries out the attack, DDoS usually involves multiple attackers who start the attacking process at the same time. For instance, malicious miners in the network can perform a DDoS so long as they have access to the Distributed Botnet.
A Botnet is a network of private nodes that have been infected with a malicious program and managed from a remote location without the owner’s knowledge. When malicious users use Botnets on miners, they can succeed to take out competing miners and increase their own hash rates.
In such attacks, the attackers can exhaust the network resources and disrupt its access to genuine users. For instance, an honest miner will be congested with many requests like fake transactions from many clients who’ll be acting under the management of an attacker. After some time, the miner will most likely begin discarding any incoming inputs and requests including the requests from his/her honest clients.
- Silkroad attacks
In this kind of attack, the client will be under the control of an attacker masquerading as a trader. When the client commences trading with his/her merchant, the wallet address is revealed to the attacker. When the transaction is completed, an attacker initiates an attack by using the client’s address as a refund address and sends a refund request to the merchant.
Obviously, the merchant will send the amount to the attacker, thus getting cheated without getting the refund from the other end. During this time, both the merchant and the trader won’t be aware of any fraud happening in their name.
- The Marketplace trader attack
This kind of attack is a common case of MIMA (man-in-the-middle attack). Here, the attacker sets up an attractive page where he/she attracts the client who falls victim at the later stages. The attacker will often depict himself/herself as a trusted party by making payments using trusted merchants-like features.
When the client clicks on the webpage, he/she accidentally reveals her address and other identities which are enough to perform any malpractice by the malicious trader using the false webpage. When a client buys the products, the payment page will be sent which appears to be a legit payment exchange method.
However, the end merchant will be connected to the attacker’s webpage with all the details of the clients which would have been revealed to the attacker using external email communications which happen in most cryptocurrency payment policies. After the transaction, the middle attacker will claim a refund on behalf of the genuine client and the refund will be sent to the rogue attacker’s account.
- Time jacking
In a Bitcoin ecosystem, all the nodes maintain an internal time counter which represents the network time. The value of the time counter is often based on the median time of all the nodes, and it is transmitted in the version message when the nodes first link-up. If the median time is differing by more than 70 minutes with the system, the network time counter automatically reverts to system time.
An attacker can plant multiple fake nodes in the network where all the peers report inaccurate timestamps. In this case, the network can slow down or even speed up the entire network time counter. An advanced form of time jacking would involve speeding up of all the clocks being used by miners while slowing down the target clock.
Because the time value can always be adjusted by at most 70 minutes, the difference between the computers’ time would be 140 minutes. Furthermore, by publishing inexact timestamps, the attacker can modify the node’s network time counter and cheat it into accepting alternate Blockchains.
- Eclipse attacks
In Eclipse attack, an attacker manipulates the victim node hiding the IP address from the public network and that of the specific miner who is a victim. The IP addresses where the victim connects are either diverted or blocked towards the adversary. Furthermore, an attacker can hold many IP addresses for spoofing victims from the system.
#4: Attacks that slow down the cryptocurrency adoption
When Bitcoin Cash (BCH) was forked from Bitcoin on 1st August 2017, its network hashrate was approximately 300PH/s with new blocks being generated at between 1 and 2 hours. But something unusual took place. The first block (genesis block) took roughly 5 hours to be generated.
The genesis block was followed by a new block at an interval of 12 hours. Ideally, the BCH Blockchain commenced at the same mining difficulty as that original Bitcoin. At the time, its associated token was valued between $600 and $700. This meant that—unless resources such as mining electricity were completely free—mining the BCH wouldn’t have been profitable at the same mining difficulty as BTC which required at least $2100.
That’s why there was an initial time interval of 12 hours between the genesis block and the next block. As it’s the case in such scenarios, miners wanted mining difficulty to drop which eventually did, but the price also nose-dived to as low as $200 making it almost 300 percent more profitable compared to BTC.
Obviously, such profits should have driven more miners into the BCH chain. But this didn’t happen. It was later found out that malicious and honest miners have been gaming the network to impede further difficulty adjustments and slow down the cryptocurrency adoption.
The above case is just one instance where attacks can be created to slow down the cryptocurrency adoption. Essentially, attacks that can slow down the cryptocurrency adoption include:
- Legal attacks;
- Legal attacks
Various countries around the globe have different views about cryptocurrencies. While the western powers such as the US and the UK have taken a positive approach towards cryptos, others like Australia and Canada are still debating whether to incorporate or ban them altogether.
Reasons for banning the cryptos range from protectionism, fear, and ignorance, and implementing their own new cryptocurrencies. As of this writing, among the countries that have banned Bitcoin include Bolivia, Ecuador, Nepal, and Morocco. Therefore, if you own Bitcoin in one of these countries, you may face prosecutions.
Professional programmers can be hired by governments to wage cyberwarfare on cryptocurrencies. Government-sponsored hackers often attack networks and computers which have sensitive resources within a given country. For instance, China may sponsor some of its elite professional hackers to steal information from the US government.
They can achieve this by learning as much as they can and figuring out flaws that can be exploited to allow them to gain control of the network. If such computers are storing cryptocurrencies, then these hackers can destroy it leading to loss of funds.
According to Japantimes.com, North Korea’s growing focus on cyber warfare has continued to pay dividends with the Bitcoin boom. The paper blames Pyongyang for a South Korean crypto exchange that was shut down in December 2017 after losing 17% of its total assets in a hacking scandal.