Clever Ethereum honeypot lets coins come in but won’t let them back out

An interesting new Ethereum-based honeypot has been discovered that essentially allows hackers to steal from hackers. The honeypot is detailed on Reddit. A user was hunting for examples of contracts that exhibited possible were susceptible to a “reentrancy attack.” It’s a bit complex but at its core the attack lets you concurrently request your money out of a smart contract over and over before the contract is able to set your account total to zero. Imagine being able to call the back over and over again and ask for $5 before it was able to debit your account to $0.

The contracts are visible on the network and are easy to find. The Reddit user found one and tested it, finally sending 1 Eth – about $1,000 – into the system. He expected to be able to pull out multiple Ethereum thanks to the reentrancy attack. In the worst case these contracts allow you to withdraw they Ether that you deposited so there was seemingly little risk. However, it got stuck.

“Beauty!”, I thought. “I can have some fun and try out this hack, and give the funds back to the contract creator later. There’s 1 ETH in there, so it should be a fun challenge, maybe do a victorious blog post later”.
The first thing I did is to is to re-deploy his contract on Ropsten testnet. Then I wrote my exploit code, and tried it out. After a few tries, it worked! I was able to empty the test contract using my exploit contract.
So next day, I decided it was time to run it on the real thing. Min deposit was 1 Ether.

Once it got stuck once he sent another Ether as a test. It was stuck again. Then, a few moments later, the Ether disappeared. The owner of the honeypot had pulled out the Ether.

One Reddit commenter checked the code and found that all withdrawals had been secretly disconnected in the contract, ensuring that only the owner of the contract could get at the money.

“It’s quite clever, because if you do the deposit and withdraw in separate transactions, you’ll find that the deposit works and the withdraw fails. If you do them together in a single transaction, you’ll still find that the deposit works and the withdraw fails (in the same transaction!),” he wrote.