Note — WEB3

Why Blockchain "Immutability" Doesn't Mean What People Think

The immutability of the digital ledger is one of the central tenets of blockchain and Web3. However, this immutability isn't as all-encompassing as many people think.

Blockchain transactions and their contents are largely immutable once they've been incorporated into an accepted block. This is both beneficial and harmful for security, since it protects the blockchain's history, smart contract code, and malicious transactions from being modified or reversed.

What's Actually Immutable On-Chain

Blockchain immutability is restricted to transactions and their contents. The ability to have an immutable record of the blockchain's history is essential for a distributed, decentralized financial network. Without immutability, anyone could rewrite history, making it impossible for various, mutually-distrusting parties to agree on anything.

On smart contract platforms, the immutable state includes the bytecode of smart contracts deployed on-chain. This bytecode is deployed via transactions, so immutable transactions mean immutable smart contract bytecode.

The Limitations of Blockchain Immutability

The immutability of smart contract bytecode makes it seem like smart contracts are unchanging, providing a level of predictability. However, this assumption is incorrect.

Some elements of the blockchain that can undermine the immutability of smart contracts include:

  • Smart Contract Memory: Smart contract bytecode is immutable, but their memory isn't (and can't be for a useful program). Any transaction interacting with a smart contract can change the values it stores. Crucial parameters and settings may be stored in smart contract memory, allowing a malicious admin or compromised account to modify them.
  • Upgradeable Smart Contracts: Upgradeable proxy patterns use a proxy contract at a fixed address to point to an address where the real logic is stored. Since this address can be changed, this allows smart contract code to be updated and modified.
  • Oracle Data: Smart contracts use external oracles to access off-chain data, such as pricing data for blockchain tokens or information about real-world events that is used for on-chain betting. While this data may be immutable once it's on-chain, it can be modified or corrupted by an attacker before it is submitted in a transaction.
  • Off-Chain Infrastructure and Dependencies: Smart contract code is often hosted on GitHub, built using third-party dependencies, and deployed on-chain with various tools. All of these can be tampered with by an attacker to change the code before the bytecode is deployed on-chain and becomes immutable.

Misunderstanding Immutability Creates False Confidence

Blockchain immutability is a major security feature because it makes it harder for an attacker to tamper with smart contract logic without detection. However, relying on smart contract immutability can be dangerous because the immutable deployed bytecode is only one element of the logic that is executed on-chain.

Managing Web3 risk requires a comprehensive understanding of all elements of the blockchain ecosystem and how they work together. To learn more about how on-chain systems work and the most common threats, check out the Blockchain Security Specialization on Coursera.