All vulnerabilities
CRITICALWeb3exploited in the wild

WEB3-THEDAO-2016

Web3 · Ethereum · The DAO

Summary

On June 17, 2016, an attacker exploited a reentrancy vulnerability in The DAO's smart contract, draining around 3.6 million ETH (about $60-70M at the time). The vulnerable path was the splitDAO function, used to let dissenting holders exit into a child DAO: it sent ether via an external msg.sender.call.value() before it decremented balances[msg.sender] and totalSupply. Because the attacker's receiving contract had a fallback that recursively re-entered splitDAO before those state updates ran, the same balance was refunded over and over in a single nested call sequence, withdrawing far more ether than the attacker was owed. The DAO had raised roughly $150M in ETH after launching in spring 2016. To return the stolen funds, the Ethereum community executed a contentious hard fork on July 20, 2016, splitting the chain into Ethereum (funds returned) and Ethereum Classic (which kept the original 'code is law' chain).

How to avoid it in your code

  • Follow checks-effects-interactions: update balances and totalSupply before any external call.
  • Use a reentrancy guard (mutex) on functions that make external calls.
  • Prefer pull-over-push withdrawals and minimize ether transfers inside state transitions.
  • Limit gas forwarded on external calls or use transfer-style patterns where appropriate.
  • Add reentrancy-focused invariant and property tests for every fund-moving function.

References

Related vulnerabilities

All Web3 →