Ethereum Hive Hack

Reported loss $16K
Other

What happened

On August 21, 2023, an attacker exploited the old Ethereum Hive (EHIVE) token contract on Ethereum. The contract had staking built in, and the attacker drained about $15.5K from its EHIVE/WETH liquidity. Cyvers flagged the attack and noted that the attacker had been funded through Tornado Cash. According to the existing record, the attacker created about 744 million EHIVE in rewards and swapped them for about 9.32 ETH ($15,569), then deposited the proceeds into Tornado Cash.

This was not a reentrancy attack. The flaw was in reward accounting. stake() updated the caller's staked balance before it calculated rewards earned. So an address that had staked 0 tokens long ago could stake a large balance and be paid rewards as if that balance had been staked the whole time. The attacker set up many helper contracts with zero-amount stakes and later passed one borrowed EHIVE balance through all of them.

  • Attacker: 0x0195448a9c4ADEaF27002C6051C949f3C3234bb5
  • Attack contracts: 0x98C2e1E85F8bF737D9c1450dd26D4A4bf880B892, 0xE7d9a93541FA79D6ECF3DC5997632177146Dcb84 (second from existing record)
  • Vulnerable EHIVE contract: 0x4Ae2Cd1F5B8806a973953B76f9Ce6d5FAB9cdcfd
  • Attack transactions: 0xad818ec910def08c70ac519ab0fffa084b4178014a91cd8aa2f882d972a511c1, 0xd9156f507c701a09d3312e1987383c7c882df50b3127e1adfd74d74052642114 (second from existing record)
  • Tornado Cash deposit (existing record): 0x61bfbd48088f2f5236bc9eca991a53cd9199dc7a1bdfe1d17dbd1638d7af185d

How it happened

  1. The attacker deployed a set of helper contracts; the DeFiHackLabs reproduction uses 28. Each one called stake(0), which started its reward clock with nothing staked.
  2. The attacker waited while those empty stakes aged. The reproduction advances time by 38 days.
  3. The attacker took a WETH flash loan from Aave (18 WETH in the reproduction), swapped it for EHIVE on the Uniswap V2 pair and sent the EHIVE to the first helper.
  4. Each helper staked its whole EHIVE balance, immediately called unstake, and passed everything on to the next helper. Because staked was updated before earned was calculated, each helper collected rewards as if the full balance had been staked since its original zero stake.
  5. The last helper returned the inflated EHIVE balance to the attacker. The attacker swapped it back to WETH, repaid the flash loan and kept about 9.3 ETH.

Protocol details

Classification Other
Protocol Type Exploit/Other
Affected asset / contract EHIVE
Protocol links @EthereumHive

Build your security review skills

Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.