Blockchain security

Attacking Block Creation

March 8, 2021 by Howard Poston

Blockchain is a relatively new technology that is achieving rapid adoption. It has a number of built-in protections and incentives designed to allow the decentralized network to maintain and secure a distributed digital ledger.

However, these protections can be overcome in a variety of different ways.  The block creation process, which collects transactions into blocks to be added to the distributed ledger, can be attacked in a variety of different ways.

Attacks Against Block Creation

The block creation process is designed to add transactions to the blockchain’s distributed ledger in a decentralized fashion.  This is accomplished by having nodes pseudorandomly selected to create blocks and incentivizing them to behave honestly.  However, a malicious node can attack, cheat, or take advantage of the block creation process in a few different ways.

Denial of Service Attacks

Blockchain consensus algorithms are designed to select a node to be the official creator of each block in the blockchain.  If this process works properly, only one node will be able to create a valid block within a given interval.

This creates a single point of failure within a blockchain network.  If malicious nodes can identify the selected creator of the next block, they can perform a Denial of Service (DoS) attack against that node.

By rendering the node unable to create or transmit a block, they can delay the creation of the block or potentially block it entirely.  This decreases the throughput of the blockchain network.

Frontrunning

Transactions are not added immediately to the blockchain’s distributed ledger.  They are broadcast to the blockchain network and later incorporated into a block by a block creator.  The order in which transactions are added to blocks is often dependent on a transaction fee, which allows users to pay for priority.

This model makes blockchains vulnerable to frontrunning.  After observing a broadcast transaction, an attacker can create a transaction of their own (that takes advantage of this transaction in some way) with a higher transaction fee.  The attacker’s transaction is likely to be added to the blockchain first, likely at the expense of the original transaction.

Selfish Mining

In the blockchain, each block is based on the previous block.  Each block has a header that contains the hash of the previous block, making it impossible to start working on creating the next block until the previous one exists.

In Proof of Work (PoW) blockchains, block creation is a race to find a valid version of the next block.  Statistically, it is unlikely that two different nodes will find valid versions of the same block close together, meaning that a block creator who delays publishing their block is unlikely to have it replaced by a different version.

Selfish miners can take advantage of this by keeping a new block to themselves for a time, rather than publishing it immediately (as is intended).  This provides the block creator with a head start on finding a valid version of the next block, increasing their probability of success.  As a result, a node may be able to find new blocks and earn block rewards at a higher rate than their portion of the blockchain’s hash rate should allow.

SPV Mining

Simplified Payment Verification (SPV) nodes are designed to only view the blockchain, not participate in block creation.  One major advantage of an SPV node is that it only downloads block headers, not the bodies (which include the list of transactions contained within a block).  This makes them lightweight and cheaper to run.

Mining with an SPV mode is dangerous because, without downloading block bodies, it is impossible to determine if a block created by an SPV node is valid.  It is possible that this block would contain transactions that conflict with the contents of a previous block, creating a double-spend attack and causing the block to be rejected.

SPV miners evade this issue by creating blocks that only contain the transaction paying themselves the block reward (which is always valid).  Since these nodes do not need to download block bodies, verify block validity, and craft a new, valid block, they can start mining the next block more quickly than normal miners.  This provides a similar head start and benefits to selfish mining.

Abusing Block Creation

The blockchain is designed to implement a trustless, decentralized, and distributed digital ledger.  To accomplish this, it has built-in protections and incentives designed to encourage its users to act properly in the best interests of the blockchain network.

However, these incentives and protections are not always effective.  Attackers can bypass the intended DoS protections of decentralization by targeting block creators, and misaligned incentives encourage blockchain miners to cheat to increase their probability of success and block rewards.

Sources

Blockchain Frontrunning – https://swende.se/blog/Frontrunning.html

Selfish Mining Explained – https://academy.binance.com/en/articles/selfish-mining-explained

Empty Block Data by Mining Pool – https://blog.bitmex.com/empty-block-data-by-mining-pool/

Posted: March 8, 2021

Uh-oh!

We've encountered a new and totally unexpected error.

Get instant boot camp pricing

Thank you!

A new tab for your requested boot camp pricing will open in 5 seconds. If it doesn't open, click here.

Articles Author
Howard Poston
View Profile

Howard Poston is a cybersecurity researcher with a background in cryptography and malware analysis. He has a Master’s degree in Cyber Operations from the Air Force Institute of Technology and two years of experience in cybersecurity R&D at Sandia National Labs. He currently provides consulting and technical content writing for cybersecurity, cryptocurrency, and blockchain.