Cybersecurity Imperatives in Distributed Ledger Technologies
Blockchain matrix

Cybersecurity Imperatives in Distributed Ledger Technologies


What is it?

 

Distributed ledger technologies (DLT), such as blockchain, provide a secure method for conducting and recording transfers of digital assets without relying on a central authority. DLT is termed ‘distributed’ because multiple participants in a computer network, including individuals and businesses, share and synchronize copies of the ledger. New transactions are added in a manner that is cryptographically secured, permanent, and visible to all participants almost in real-time.

 

Applications ranging from monolithic systems to microservices and blockchain technology are all vulnerable to cyber threats. These threats can be inherited, introduced, or arise from both internal and external circumstances.

 

Achieving cybersecurity resilience in distributed ledger technologies (DLT) requires specific measures. In this article, we will explore these measures, with a particular focus on blockchain and Web3 applications.

 

Introduction

 

As new technology advances toward Web3 design, supported by distributed technologies, blockchain technology has gained significant adoption. The foundational concepts of blockchain technology underpin the well-known cryptocurrencies, Bitcoin and Ethereum.

Blockchain-based applications are not immune to vulnerabilities and cyber threats. However, this technology inherently provides the 'Integrity' aspect of the CIA triad.

In the following section, we will explore how to fortify blockchain applications against malicious actors to enhance security and reduce cyber threats. 

 

  

Attack Surface Identification

 

To protect blockchain-based applications, we need to explore their attack surface. Following is the typical architecture of the Blockchain application

 

Blockchain application design layers

 

By securing each layer of the above architecture, we can reduce the attack surface, threats, and risk impact. Let's briefly examine each layer, identify potential threats, and discuss how to fortify them against attacks.

 

Blockchain Platform Security

 

Proof-of-work protocol attacks

 

Threat - The 51% attack is a proof-of-work protocol attack where a group of miners steals more than 51% of the hashing power of the blockchain network. This can lead to the orphaning of genuine transactions and overriding the writing process to the blockchain with their transactions. Blockchain hashing power refers to the number of hash calculations performed per second, and higher hash rates increase the speed at which miners can calculate hashes. If a group of minors collude and start another network while still part of the main blockchain, they can add blocks faster than the main network, resulting in a longer chain. The 51% attack also leads to a double-spending attack, where the same digital currency can be spent or transferred more than once.

 

 

Prevention - To prevent this attack, blockchain designers and implementers can implement security controls during the protocol design stage, such as implementing a penalty proportional to the delay in block addition to the main blockchain network. This can limit the attackers' ability to append an arbitrary number of blocks to the blockchain.

 

Distributed Apps and Smart Contract Security

 

Smart contract and Ethereum Virtual Machine (EVM)

 

Smart contracts and Ethereum Virtual Machine (EVM) are essential components of decentralized applications, but their security can be compromised if poorly written. Traditional centralized applications, such as Web 3.0 applications, have a front-end module that interacts with users via web or mobile interfaces, using languages like HTML, CSS, JavaScript, Angular, or React. The backend server-side logic handles requests and responses from the front-end client, containing business logic and interacting with a relational or NoSQL database. Smart contracts, built on Ethereum, are software programs that contain backend logic, with Solidity being the most common language for developing them. EVM, a virtual software stack embedded in each Ethereum node, executes smart contract code and maintains the state of the world, which includes the balances associated with each Ethereum account on the blockchain. As EVM is deployed on every node, the state of every smart contract is stored on each node.

 

Threat 1- In 2016, Ethereum, a decentralized autonomous organization, faced security threats when an attacker successfully withdrew 3.6 ether currency due to a software issue generated from the recursive calling of an external smart contract. This attack, known as the reentrancy attack, exploits the crypto balances at the blockchain address, which are protected by the mining layer. Smart contracts, which track balances, are susceptible to coding errors, which can create a mismatch between known and known blockchain balances. The fundamental issue is that the smart contract code allows itself to be called repeatedly before finishing the first call, allowing attackers to exploit the incorrect state of a variable created. This is a manifestation of known software weakness, classified by MITRE organization as CWE-664. Another attack is overflow and underflow, where developers fail to account for the upper or lower bounds of a numerical variable. This issue is more prone and has the potential for significant loss due to the arithmetic involved with cryptocurrency.

 

Prevention 1 - To fix this, correct the balance before giving the attacker a second opportunity to call the WithdrawBalance function.

 

Threat 2 - Smart contracts can face threats such as front-running attacks, which originate from traditional financial markets. These attacks take advantage of transaction visibility in the mempool, allowing attackers to manipulate the order of transactions based on fees. Developers can address this vulnerability by implementing a commitment scheme to prevent front-running. Another threat is the self-destruct function in Solidity, which can deactivate a deployed contract by sending its crypto balance to a specified address. However, the receiving contract's Fallback function may not be executed, potentially exposing it to attacks. 

 

Prevention 2 - To mitigate the above risk, developers should avoid relying on the balance variable and track incoming balances separately. Also, it is essential to stay informed about emerging threats through resources like the smart contract attack registry. To prepare for future attacks, developers should adhere to best design practices to build resilient smart contracts and decentralized applications. By following these guidelines, developers can reduce vulnerabilities and enhance the security of their smart contracts against potential threats.

 

Following are a few guidelines:

1.    Focus on secure design involves attention to software development processes, software design principles (especially for smart contracts), and software testing and verification practices. 

2.    In software development, use Git for version control, document code, conduct peer reviews, automate analysis and testing, and address security bugs before deployment. 

3.    For smart contract design, anticipate and mitigate failures, use circuit breakers to pause functionality in case of errors, implement waiting periods for major changes, and keep contracts simple to avoid complexity. 

4.    Understanding the blockchain platform and protocols is crucial for security. Conduct threat modelling to identify design weaknesses and use testing strategies such as static code analysis, dynamic security testing tools, fuzz testing, and monitoring smart contract attack registry. 

5.    Test thoroughly before deployment and consider enrolling in bug bounty programs for additional security testing.

 

Ecosystem Integration Security

 

Threat 1 - Smart contracts and decentralized applications rely on enabler services for real-world use. Security vulnerabilities in blockchain platforms can impact the ecosystem's core, while poorly written smart contracts can lead to breaches. Enabler services within the ecosystem are also susceptible to security attacks, including hosted wallets, exchanges, and oracles. Hosted wallets serve as custodians of tokens, offering a user-friendly interface to the blockchain. They can be vulnerable to classic security attacks, so providers must follow secure development processes to mitigate risks. These wallets are also vulnerable to attacks like denial of service and phishing, making them single points of failure. Non-hosted wallets, where users control their tokens, are subject to additional attacks, such as keyloggers and malware. 

 

Prevention 1 - Hardware wallets and multi-factor authentication can help mitigate hosted wallet risks. Software used for managing keys may also have security weaknesses, so using recommended libraries for cryptographic operations is essential for protecting against threats.

 

 

Threat 2- The blockchain ecosystem faces threats in the form of centralized and decentralized exchanges. Centralized exchanges like Binance and Coinbase offer KYC requirements and third-party intermediary services, providing liquidity, stability, and customer support. Decentralized exchanges such as Uniswap operate without intermediaries, relying on smart contracts for transactions. Despite lower liquidity and slower order fulfilment, decentralized exchanges are gaining popularity due to user control of funds. However, both exchange types are vulnerable to attacks like OWASP Top 10 application-level attacks and denial of service attacks. Centralized exchanges, similar to hosted wallets, have been targeted more frequently in recent years. Decentralized exchanges are susceptible to the same blockchain vulnerabilities, such as the reentrancy attack that led to a $25 million theft from Uniswap and Lendf.Me in April 2020. 

 

Prevention 2 - Mitigation strategies include implementing security controls and best practices for smart contracts.

 

Threat 3  - The blockchain ecosystem faces threats from centralized and decentralized oracles that act as intermediaries between blockchain networks and external data sources. Oracles play a crucial role in ensuring the trustworthiness of data used in smart contracts and decentralized apps. Centralized oracles pose a risk of manipulation and conflict of interest, leading to breaches in trust and security. Decentralized oracle networks, such as Witnet, Auger, and Chainlink, offer a more secure alternative by running specialized consensus protocols within the blockchain network itself. 

 

Prevention 3 - Transitioning from centralized to decentralized oracles can help mitigate the risks associated with single points of failure and vulnerability to attacks like denial of service.

 

Overall, securing the blockchain ecosystem requires a multi-layered approach to protect against various potential attacks.

 

User Interface and End User Security

 

Wallets and Key Security


Threats and Prevention

Blockchain platforms, smart contracts, and enabler services are essential for maintaining trust, but this trust doesn't automatically extend to the end user. The end user's responsibility is high in a decentralized environment without governance or protection laws. However, many lack the expertise to effectively protect themselves. To safeguard your cryptocurrency and decentralized application, protect against malware and trojan horses with antivirus software and system updates. Avoid keyloggers by not installing untrusted software. Consider cold wallets and diversify your portfolio with multiple wallets. Always keep your private keys confidential. Remember, stay vigilant and protect your assets as you would any valuable possession.

 

 

Web Session Security


Threats and Prevention 

When using online exchanges or wallet providers, it is crucial to protect your session from various attacks like man-in-the-middle, cross-site scripting, and phishing. Enable web protection through your antivirus provider to add an extra layer of defence. Avoid conducting transactions on websites without TLS implementation and be cautious of phishing attempts through emails or text messages. Stay vigilant against social engineering attacks like ice fishing, which can lead to significant losses as seen in the Badger DAO attack. Always verify smart contract details before engaging in token transfers to prevent falling prey to malicious actors.

 

Conclusion 

Securing distributed ledger technologies (DLT) such as blockchain is crucial in the face of cyber threats that can target various layers of blockchain applications. Measures such as implementing security controls during the protocol design stage and enhancing smart contract and Ethereum Virtual Machine (EVM) security are imperative to fortify blockchain-based applications. The 51% attack, reentrancy attack, overflow, underflow, and front-running attacks are some vulnerabilities that blockchain developers must address to reduce the risk of exploitation by malicious actors. By focusing on secure design practices, testing thoroughly before deployment, and integrating with secure enabler services such as wallets and exchanges, developers can strengthen the security of their blockchain ecosystem. Furthermore, end users should take proactive steps to safeguard their assets, including using antivirus software, avoiding phishing attempts, and securing their private keys. Overall, a multi-layered approach is essential to protect blockchain applications from a wide range of potential cyber threats.

 Blockchain Vulnerabilities

 


To view or add a comment, sign in

More articles by Virendra Ukey

Insights from the community

Others also viewed

Explore topics