Shiba Diamond Honeypot
What happened
Shiba Diamond (SHIBA) is a BNB Smart Chain token whose transfer and transferFrom both run through a burnTokenCheck modifier. The modifier lets the owner, the address stored as _safeOwner, any transfer to the owner, and owner-whitelisted addresses move tokens freely. Every other holder can only send tokens to the hard-coded _unirouter address or send an amount below _sellAmount, which starts at 0, so a sale into the trading pair reverts until the owner sets that threshold.
De.Fi's REKT database lists the token as an exit scam/honeypot in which the owner could disable transfers and restrict users from selling; no sale attempt, transaction or loss figure was opened for this record.
How it happened
What the code allows:
- The constructor sets
_safeOwner = ownerand_sellAmountstarts at 0._unirouteris hard-coded as 0x10ED43C7…56024E. - The modifier's first branch is
if (_owner == _safeOwner && sender == _owner){_safeOwner = recipient;_;}. The owner's first transfer therefore stores its recipient as_safeOwner; if that transfer is the liquidity deposit, the recipient is the trading pair. - After that, a second branch passes any transfer where
sender == _owner || sender == _safeOwner || recipient == _owner. If_safeOwneris the pair, tokens leaving the pair (purchases) always pass. - For all other senders,
_whiteAddress[sender] == truepasses with any recipient. The owner fills the whitelist throughincreaseAllowance(address[])and throughmultiTransfer, which also gives the firstapprovecountreceivers a maximum allowance for_unirouter. - A sender that is neither whitelisted nor blacklisted reaches
if (amount < _sellAmount){...; _; }else{require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance");_;}. With_sellAmountat 0,amount < _sellAmountis false, so a sale that moves tokens from the holder into the pair (recipient is the pair, not_unirouter) reverts with a balance-style error message. _sellAmountis changed only when the owner sends tokens to itself:if (sender == _owner && sender == recipient){_sellAmount = amount;}. Once it is above 0, a holder selling an amount strictly below it succeeds, and the lineif(recipient == _safeOwner){_blackAddress[sender] = true; _whiteAddress[sender] = false;}then blacklists that holder. A blacklisted sender passes only whenrecipient == _unirouter.- The owner can also blacklist addresses with
addApprove(address[]), change_safeOwnerwithdecreaseAllowance(address)(setting it back to the owner re-arms the capture in step 2), and mint with the public_mint, which requiresmsg.sender == _ownerand addsamountto_balances[_owner]. No function in the contract reassigns_owner.
De.Fi's REKT database lists Shiba Diamond as an exit scam/honeypot dated 2021-06-06 where holders could not sell. No transaction showing a failed sale, a change of _safeOwner, a whitelist or blacklist update, or a liquidity removal was opened for this record.
Protocol details
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.