Navigate Up
Sign In

Of Blocks, Chains and Security

Publication Date: May 23, 2019


Written by Martin Camilleri, Manager – Security Engineering 

Camilleri Martin .jpgA peer-to-peer network is a network of a number of participants, exchanging goods (such as money, merchandises or data) in a decentralised manner, that is the goods are exchanged directly between the participants, eliminating the 3rd party to validate the exchange. Peer-peer networks in the computer and data world have been extensively used since 1990 (well these were established long before that in the 1970) when their popularity and use grew especially in the music industry and file sharing activities.

Capture.JPGThe advantages of this type of data exchange the ability of users to interact with each other, increasing the processing speed and reducing costs. Classical examples of peer-to-peer networks include Napster and Bit Torrent.

The problem with peer-to-peer networks was with trust and integrity. There is no way of guaranteeing that the actors involved in an exchange are integral and trustworthy. One of the participants or nodes can be a malicious node and therefore the transaction between a node and a malicious node cannot be trusted and cannot be verified as correct and true.  To correct this problem of trust, the blockchain was invented and developed.

In 2008, Satoshi Nakamoto developed a white paper on the use of blockchain to effect digital money transactions in a distributed system (peer-to-peer) securely and in a trustworthy environment. The basic concepts of how the blockchain maintains integrity is by using complex cryptographic algorithms (the practice and study of hiding information) to hash (mixing up data into a value that it is unique to the data and cannot be reversed to get the original data) the transaction data. This data then is added to a chain of hash-based blocks, forming a record that cannot be changed without redoing all the calculations (aka proof-of-work). 

6H6A2094.JPGTherefore, at face value, since blockchain is based on cryptography, this makes the technology secure, transparent and immutable (cannot be changed). This is because the technology is based on a cryptographic fingerprint unique to each block also known as the hash value and a “consensus protocol”, which is the process by which the nodes in the network agree on a shared history. But is it true that a blockchain system is secure?

One must keep in mind that a blockchain system is not only made up of cryptographic systems in isolation; it is a whole system including the underlying technology (hardware and networks), software and human interaction.

One of the biggest threats to the security of a blockchain is the double spending threat. Double spending means that the value of a digital currency is used to buy things over and over again. For example, a person has 100 bitcoins and uses them to buy a house. Once the transaction is complete and the house is physically transferred, the person will manipulate the blockchain to reverse that transaction and get the money back and spend it again. The technical term of this attack is known as the 51% attack. This is because the blockchain protocol is basically a governance protocol and it is based on a democracy where the majority of the miners (players in the blockchain network) will decide which version of the blockchain is the truth.

The workings of this protocol are as follows; once user has cleared a transaction, this is put into local pool of transactions and then the miners retrieve these transactions to be verified by performing the proof-of-work (by solving a complex mathematical problem) and add the transactions to a block. When a solution to the problem is found, it is broadcasted over the network with other blocks and the other miners verify that the solution is correct and therefore accepted.

6H6A2064.JPGA corrupt miner will participate in the mining of the blockchain but instead of broadcasting the solution, it will privately mine and build the block. Therefore, at one point in time, there are two versions of the same blockchain, the truthful one and the stealthy one. The malicious miner continues to spend his coins on the truthful blockchain but does not include the transactions in his private version of the chain.

The blockchain is programmed to follow a model of democratic governance, where the majority of the miners add blocks to their version of the blockchain faster than the rest of the network. When the spending of the malicious miner is over, and the assets have been transferred, the miner tries to add blocks faster than the truthful miners and obtain the majority. The corrupt blockchain is now broadcasted and since it is the longer one, it is accepted as the truth and the attack is successful.Capture 2.JPG

A number of such attacks have already taken place. Recently Coinbase detected a 51% attack on Etherium Classic bitcoin resulting in an approximate of 1.1 million dollars of double spending. With the amount of 51% attacks happening, it is feared that this attack is becoming a regular attack.

A blockchain system is also made up of software often known as Smart contracts. These are computer software or protocols that are executed over a blockchain to digitally facilitate, verify, or enforce the negotiation or performance of a contract. As with all software, smart contracts can be vulnerable and errors in their code can compromise the result of the code and it will cost money. In Etherium, there are a number of vulnerabilities that can be exploited such as overflows and under flows ( a program or process attempts to write more data to a fixed length block of memory, or buffer, than the buffer is allocated to hold) and malicious smart contract programming (introduce malevolent code in a legitimate blockchain program).

The overflow/underflow attack is associated with an instance when an operation is performed that requires a fixed size variable to store a number (or piece of data) that is outside the range of the variable's data type. These kinds of numerical requirement allow attackers to misuse code and create unexpected logic flows which might allow the attacker to spend more tokens than he has available.

Malicious smart contract programming involves the programming of intentionally malicious code to manipulate the transactions and steal funds while a smart contract is in operation. It can be like a salami attack whereby the fractions of all financial transaction can be “stolen” into the attackers account, increasing his income drastically.

Another important security vulnerability is the human factor. This is one of the most common modes of attacks carried out on blockchain systems and digital currency theft. This type of attack does not have anything to do with the technology itself, but it is a compromise of the end users’ computers and devices. An attacker manages to get total control of the user’s device, enabling him/her to observe all the activities of the user and once all data is collected, the attacker can take over the device and perform any transactions, which look as if they are legitimately coming from the user. These types of attacks usually originate from social engineering techniques (the art of manipulating people so they give up confidential information via various methods especially via email).

As with all technologies, blockchain is not 100% secure and methods for compromising the security of the system exist. These malicious techniques are present on a number of different layers of the technology varying from the user, at the top, down to the underlying infrastructure. The state of blockchain security can be compared with the development of the security of the Internet through the years. When the Internet was introduced it was a very insecure infrastructure but with time it evolved in a much more secure place with technologies being developed to further enhance its security. For blockchain to become more secure there needs to be:

·       Proper user awareness on the seucre use of the technology and what it means to use the technology including the threats and dangers when using the technology.

·       Ensure that the underlying infrastructure (Internet connectivity) is secured, resilient and always available.

·       Introduce high standard levels in the development of smart contracts ranging from producing good smart contract programmers to having strict smart contract auditing processes.