PepeSocks Honeypot
What happened
PepeSocks (PEPE) is a token on BNB Smart Chain (420-token on-chain supply) whose transfers pass through a burnTokenCheck modifier. Unless the sender is the owner or the stored _safeOwner, is whitelisted by the owner, or is sending to the owner, a transfer succeeds only if it goes to the hard-coded _unirouter address or its amount is below _sellAmount (which is 0 until the owner sets it). Everything else reverts with "ERC20: transfer amount exceeds balance", whatever the holder's real balance.
The owner can also whitelist, blacklist, change _safeOwner and mint. De.Fi's REKT database lists the token as an Exit Scam/Honeypot dated 2021-03-05, saying the owner could disable the transfer function and so restrict selling. The code shows what the owner can do; it does not show which addresses were whitelisted or blacklisted.
How it happened
- The constructor sets
_owner = owner; _safeOwner = owner;and mints the initial supply to the owner._unirouteris hard-coded as 0x7a250d56…F2488D and_sellAmountstarts at 0. transferandtransferFromcall_approveCheck, which carries theburnTokenCheckmodifier. While_owner == _safeOwner, a transfer from the owner passes and moves_safeOwnerto its recipient. After that, a transfer passes if the sender is_owneror_safeOwner, or the recipient is_owner.- Otherwise a sender in
_whiteAddresspasses. A sender in_blackAddresspasses only ifrecipient == _unirouter(thesender == _safeOwnerhalf of that check cannot be true here, since_safeOwneralready passed in step 2). - A sender in neither list passes if
amount < _sellAmount, and if the recipient is then_safeOwnerthe sender is moved to the blacklist. With_sellAmountat 0 this never holds, so theelsebranch runs:require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance"). An ordinary holder can therefore only send to_unirouteror_owner; any other recipient, including a pair contract that is not one of them, reverts the transaction and the holder keeps their tokens. - The owner steers this with functions whose names suggest allowances:
increaseAllowance(address[])whitelists and un-blacklists,addApprove(address[])blacklists and un-whitelists,decreaseAllowance(address safeOwner)sets_safeOwner, andmultiTransferwhitelists the firstapprovecountreceivers and sets their allowance to_unirouterto the maximum._mint(address,uint256)ispublicand owner-only and credits_balances[_owner], so the owner can raise the supply._sellAmountis set only by an owner transfer to itself that reaches the second branch (if (sender == _owner && sender == recipient){_sellAmount = amount;}). - What happened: De.Fi's REKT database lists PEPE as a honeypot. The proof tweet could not be opened and no transaction was examined, so which addresses were whitelisted, blacklisted or blocked is not established.
Protocol details
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.