Ethereum Hive Hack
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
EHIVEcontract:0x4Ae2Cd1F5B8806a973953B76f9Ce6d5FAB9cdcfd - Attack transactions:
0xad818ec910def08c70ac519ab0fffa084b4178014a91cd8aa2f882d972a511c1,0xd9156f507c701a09d3312e1987383c7c882df50b3127e1adfd74d74052642114(second from existing record) - Tornado Cash deposit (existing record):
0x61bfbd48088f2f5236bc9eca991a53cd9199dc7a1bdfe1d17dbd1638d7af185d
How it happened
- 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. - The attacker waited while those empty stakes aged. The reproduction advances time by 38 days.
- The attacker took a WETH flash loan from Aave (18 WETH in the reproduction), swapped it for
EHIVEon the Uniswap V2 pair and sent theEHIVEto the first helper. - Each helper staked its whole
EHIVEbalance, immediately calledunstake, and passed everything on to the next helper. Becausestakedwas updated beforeearnedwas calculated, each helper collected rewards as if the full balance had been staked since its original zero stake. - The last helper returned the inflated
EHIVEbalance to the attacker. The attacker swapped it back to WETH, repaid the flash loan and kept about 9.3 ETH.
Protocol details
Evidence
- report @CyversAlerts incident report twitter.com
- report Cyvers Alerts: malicious transaction with @EthereumHive, old EHIVE contract hacked for $15.5K twitter.com
- transaction etherscan.io transaction 0x61bf…185d etherscan.io
- transaction etherscan.io transaction 0xad81…11c1 etherscan.io
- transaction etherscan.io transaction 0xd915…2114 etherscan.io
- address etherscan.io address 0x0195…4bb5 etherscan.io
- address etherscan.io address 0x98C2…B892 etherscan.io
- address etherscan.io address 0xE7d9…cb84 etherscan.io
- code DeFiHackLabs EHIVE_exp.sol proof of concept github.com
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.