Balancer Hack
What happened
On June 28, 2020, an attacker used a dYdX flash loan to exploit Balancer V1 pools containing STA and STONK, ERC-20 tokens that charge a transfer fee. Balancer credited nominal input amounts in its internal reserve accounting even when the pool received less after the fee, allowing a reserve and price mismatch that drained the pools.
How it happened
The attacker flash-borrowed WETH and repeatedly swapped it for STA, progressively reducing the pool's actual STA balance. Balancer's internal accounting credited the nominal STA input before the token transfer completed, but STA's fee meant the pool received less than recorded. After calling gulp() to synchronize the internal record to the depleted on-chain balance, the attacker made the remaining STA appear extremely valuable and swapped it for other pool assets.
The flash loan made the sequence atomic, but the root cause was the accounting incompatibility with fee-on-transfer tokens.
Protocol details
Security review history
- Trail of Bits No public report
- ConsenSys Diligence No public report
Evidence
- report Report theblockcrypto.com
- report Report cointelegraph.com
- report Balancer: Incident with non-standard ERC20 deflationary tokens medium.com
- transaction Etherscan: Balancer exploit transaction etherscan.io
- analysis PeckShield: Balancer Hacks, Root Cause and Loss Analysis peckshield.medium.com
- analysis DeFiLlama defillama.com
Understand the attack patterns
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.