Skip to main content

This site is for educational purposes only. Nothing here constitutes financial advice.

Topic 12 of 189

Blockchain Security & Attacks

Deep dive into blockchain-level security — 51% attacks, MEV exploitation, flash loan attacks, oracle manipulation, reentrancy, and how protocols defend against these threats.

Beginner
8 min readUpdated July 2026Block Clarity Hub Editorial Team

The basics

Why Blockchains Get Attacked

Blockchains and their applications hold billions of dollars in value, making them attractive targets for hackers. Unlike traditional banks, there is no customer support to reverse fraudulent transactions — once funds are stolen, they are usually gone forever. Blockchain attacks can target different layers: the blockchain itself (51% attacks), the smart contracts running on it (code exploits), the bridges connecting chains, or the users directly (phishing and social engineering). Understanding these attack vectors helps you assess the risk of protocols you use and protect your funds.

The 51% Attack

A 51% attack occurs when a single entity gains control of more than half of a blockchain's mining power (PoW) or staked tokens (PoS). With majority control, they can reverse recent transactions (double-spending) and block new transactions from being confirmed. Think of it like controlling the majority of votes in an election — you can decide the outcome. Large blockchains like Bitcoin and Ethereum are practically immune because the cost of acquiring 51% of their hash power or staked tokens would be billions of dollars. Smaller blockchains with less security (like Ethereum Classic, which was 51% attacked multiple times) are more vulnerable.

Smart Contract Hacks

Smart contract hacks are the most common type of crypto exploit. When a developer writes a smart contract with a bug — even a subtle one — attackers can exploit that bug to drain funds. Famous examples include The DAO hack (2016, $60M stolen due to a reentrancy bug, leading to Ethereum's fork into ETH and ETC) and numerous DeFi exploits since. Because smart contracts are immutable, a bug cannot simply be 'patched' like in a web application — the vulnerability exists as long as the contract does.

How to Protect Yourself

Before depositing funds into any DeFi protocol: check if the smart contracts have been audited (and by whom), look at the protocol's history on rekt.news or DeFi Llama's hacks database, start with small amounts, and diversify across multiple protocols. No protocol is 100% safe, but audited, battle-tested protocols with significant TVL and long track records carry much lower risk.

Key Takeaways

  • Blockchain attacks target different layers: the chain, smart contracts, bridges, or users
  • 51% attacks require majority control of a chain's security — practically impossible on Bitcoin and Ethereum
  • Smart contract bugs are the most common exploit vector and cannot be patched after deployment
  • Always check audit history and track records before depositing funds into any protocol

Going deeper

Common Smart Contract Vulnerabilities

Smart contract exploits follow recurring patterns that developers and auditors specifically look for. Understanding these patterns helps you assess protocol risk even without reading Solidity. Reentrancy attacks (the type that drained The DAO) occur when a contract makes an external call before updating its state, allowing the called contract to re-enter the original function and drain funds repeatedly. Access control bugs occur when critical functions (like withdrawals or admin actions) lack proper permission checks, allowing unauthorized users to call them.

Attack Pattern Catalog

  • Reentrancy — contract calls external address before updating state; the external contract calls back in before the state update, draining funds in a loop
  • Oracle manipulation — attacker distorts a price oracle (usually a DEX spot price) to make a protocol believe an asset is worth more or less than reality, enabling profitable trades or liquidations
  • Flash loan amplification — borrowing millions in a flash loan to amplify oracle manipulation, governance attacks, or arbitrage within a single transaction
  • Integer overflow/underflow — arithmetic errors where numbers wrap around (e.g., 0 - 1 becomes the maximum uint256); largely mitigated by Solidity 0.8+'s built-in checks
  • Front-running — observing a pending transaction in the mempool and inserting your own transaction before it to profit from the price impact
  • Logic errors — flaws in business logic that do not violate any security pattern but allow unintended outcomes (e.g., incorrect reward calculations, missed edge cases)

Oracle Design and Security

Oracles are the bridge between on-chain smart contracts and real-world data (prices, weather, sports results). Oracle manipulation is one of the most exploited attack vectors in DeFi. Using a DEX's spot price as an oracle is dangerous because it can be manipulated within a single transaction (via flash loans). Secure oracle designs use Time-Weighted Average Prices (TWAPs) that smooth prices over multiple blocks, decentralized oracle networks (Chainlink, Pyth) that aggregate data from multiple sources, or a combination of both. Chainlink's decentralized oracle network is the industry standard, with nodes providing price feeds that are aggregated and delivered on-chain.

The Growing Sophistication of Attacks

Modern crypto exploits are increasingly sophisticated, often combining multiple attack vectors in a single transaction. An attacker might use a flash loan to manipulate an oracle, exploit a reentrancy bug to drain a lending protocol, and bridge stolen funds to another chain — all atomically. This is why defense-in-depth (multiple overlapping security measures) is essential for protocol security.

Key Takeaways

  • Reentrancy, oracle manipulation, and flash loan amplification are the most common DeFi exploit patterns
  • Oracle security is critical — never use DEX spot prices as price feeds; use TWAPs or Chainlink
  • Modern attacks often combine multiple vectors in a single atomic transaction
  • Solidity 0.8+ mitigates integer overflow bugs, but logic errors remain common
  • Defense-in-depth with multiple overlapping security measures is the industry best practice

Under the hood

MEV: The Invisible Tax on Every Transaction

Maximal Extractable Value (MEV) represents the profit that block producers (validators) and specialized actors (searchers) can extract by reordering, inserting, or censoring transactions within a block. MEV is an inherent property of public mempools and programmable blockchains — as long as transaction ordering affects outcomes, there is value in controlling that order. Flashbots estimates that over $600 million in MEV has been extracted on Ethereum alone since The Merge, and actual figures including private channels are likely far higher.

MEV Taxonomy

  • Sandwich attacks — a searcher detects a large pending swap, inserts a buy before it (frontrun) and a sell after it (backrun), profiting from the price impact at the user's expense; the most common retail-facing MEV
  • Arbitrage — bots detect price discrepancies across DEXs and execute balancing trades; generally considered beneficial MEV as it improves market efficiency
  • Liquidations — bots race to liquidate undercollateralized positions on lending protocols (Aave, Compound), earning the liquidation bonus; competitive but provides an essential service
  • Just-In-Time (JIT) liquidity — sophisticated LPs provide concentrated liquidity to a Uniswap V3 pool immediately before a large swap and remove it immediately after, capturing fees with minimal risk
  • Time-bandit attacks (theoretical) — a validator reorgs past blocks to capture MEV from previous transactions; economically viable only when the MEV exceeds the block reward, making it a concern for high-value transactions on chains with low block rewards

MEV Mitigation and the PBS Architecture

Ethereum's response to MEV centralization is Proposer-Builder Separation (PBS). Under PBS, block building (transaction ordering and MEV extraction) is separated from block proposing (the validator's role). Specialized builders compete in an auction to construct the most valuable block, and the proposer selects the highest-bidding block without seeing its contents. This democratizes MEV access — any validator can capture MEV value through the auction — but it concentrates block building among a few sophisticated actors. Enshrined PBS (ePBS) is scheduled to enshrine this separation in the Ethereum protocol itself (EIP-7732, Glamsterdam; no mainnet date as of October 2026), while solutions like MEV-Share (Flashbots) allow searchers to return a portion of MEV to the users whose transactions generated it.

Censorship and MEV

MEV infrastructure creates censorship risks. If a majority of block builders comply with government sanctions lists (as happened when builders began filtering OFAC-sanctioned addresses), transactions from sanctioned addresses can be effectively censored even on a permissionless blockchain. Ethereum's inclusion lists and forced inclusion mechanisms are being developed to guarantee that validators cannot indefinitely censor valid transactions, preserving censorship resistance.

Key Takeaways

  • MEV is an inherent property of public mempools — searchers profit by controlling transaction ordering
  • Sandwich attacks cost retail users; arbitrage and liquidations provide beneficial services to markets
  • Proposer-Builder Separation (PBS) democratizes MEV capture but concentrates block construction
  • MEV-Share and similar protocols return extracted value to the users who generated it
  • MEV infrastructure creates censorship vectors that threaten blockchain neutrality

Related Content

Security 101

Protect your crypto — learn about 2FA, hardware wallets, seed phrase storage, common scams, and operational security practices that keep your assets safe.

Regulation & Taxes

Navigate the complex and evolving landscape of crypto regulation — KYC/AML requirements, SEC enforcement, MiCA in Europe, tax treatment of crypto transactions, and DeFi-specific tax challenges.

DAOs & Governance

How decentralized autonomous organizations work — governance tokens, voting mechanisms, Snapshot, treasury management, delegation, and the risks of governance attacks.

Bridges & Cross-Chain

Understand how assets move between blockchains — bridge types, wrapped tokens, cross-chain messaging, major bridge exploits, and the emerging world of ZK bridges.

Tokenomics

Understand the economics of crypto tokens — supply dynamics, token distribution, vesting schedules, burn mechanisms, inflation vs. deflation, and how to spot Ponzi-nomics red flags.

How Exchanges Work

Understand how centralized and decentralized exchanges operate, including order books, AMMs, fees, and the tradeoffs between convenience and self-custody.

Reading Charts & Market Data

Learn to read candlestick charts, understand timeframes and volume, identify support and resistance levels, interpret moving averages, and explore on-chain metrics — while understanding that technical analysis is pattern recognition, not prediction.

Portfolio Management

Learn the principles of building and managing a crypto portfolio — diversification, risk tolerance, dollar-cost averaging, rebalancing, position sizing, and tax considerations. This is educational content, not financial advice.

References & further reading