Hex-Mex Honeypot
What happened
Hex-Mex (MEX) was an Ethereum token (0x53f86430…c01dde, deployed on 17 June 2021) whose transfer code let anyone buy from the pool but blocked ordinary holders from selling. A modifier on every transfer and transferFrom only lets a holder move tokens if they are the owner, the _safeOwner address, on an owner-controlled whitelist, or sending to the Uniswap router address itself; a sale to the pool fails with the misleading error "ERC20: transfer amount exceeds balance". The owner can whitelist or blacklist any address through functions disguised as increaseAllowance and addApprove, and the contract has no function to transfer or renounce ownership.
De.Fi's REKT database lists the token as a honeypot exit scam on 18 June 2021 in which the owner restricted users from selling; no loss figure is recorded.
How it happened
- The constructor stores the
ownerargument as_ownerand_safeOwner. On the owner's first outgoing transfer,if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}makes that recipient the new_safeOwner. If that first transfer is the liquidity deposit, the pool becomes_safeOwnerand can send tokens freely, so buys go through. - For any other sender, the
burnTokenCheckmodifier allows the transfer only ifsender == _owner || sender == _safeOwner || recipient == _owner, or if_whiteAddress[sender] == true. - A holder who is not whitelisted falls through to
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"). A Uniswap sale moves tokens from the holder to the pool, not to the router, so it reverts with an error that looks like a balance problem. - The only exception is
if (amount < _sellAmount)._sellAmountstarts at 0 and is set only by an owner transfer to itself (if (sender == _owner && sender == recipient){_sellAmount = amount;}). Below that threshold a transfer succeeds, but if the recipient is_safeOwnerthe sender is then blacklisted:if(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}. - Owner-only functions with standard-looking names manage the lists:
increaseAllowance(address[])whitelists addresses,addApprove(address[])blacklists them,decreaseAllowance(address)sets_safeOwner, andmultiTransfersends tokens and whitelists the firstapprovecountreceivers. _mintis a public owner-only function that credits_balances[_owner]while emitting aTransferevent to a differentaccount. The constructor calls it ten times with 0x896f2337…dD98CC asaccount, so the explorer shows that address receiving the supply while the balance sits with the owner.
Protocol details
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.