moonpirate Honeypot
What happened
moonpirate (MOONPIRATE) is a BNB Chain token deployed on 19 April 2021 at 0xa7aa9d6a…0c45a5 by 0x55eFF416…327818. Every transfer and transferFrom runs the burnTokenCheck modifier, which lets the fixed _owner, a special _safeOwner address and whitelisted wallets move tokens but makes every other holder's transfer revert unless it is sent to the PancakeSwap router address. A PancakeSwap sale moves tokens into the pair, not the router, so ordinary holders can buy but not sell, and the revert shows the misleading message "ERC20: transfer amount exceeds balance".
The whitelist and blacklist setters hide behind ERC-20 names (increaseAllowance, addApprove, decreaseAllowance), and a public owner-only _mint lets the owner add unlimited supply to its own balance. De.Fi's REKT database lists moonpirate as an exit scam/honeypot.
How it happened
- The constructor sets
_ownerand_safeOwnerto itsownerargument and mints100000000000 * 10**6 * 10**9raw units (100,000,000,000,000,000 MOONPIRATE at 9 decimals) to it. No other code writes_owner. - In
burnTokenCheck, while_owner == _safeOwner, the owner's first outgoing transfer runs_safeOwner = recipient. If that first transfer is the liquidity deposit into the PancakeSwap pair, the pair becomes_safeOwner; the owner can also set it directly withdecreaseAllowance(address safeOwner). - Transfers where the sender is
_owneror_safeOwner, or the recipient is_owner, always pass, so buys out of a pair set as_safeOwnergo through. Senders marked byincreaseAllowance(address[])(the whitelist) also pass. - Every other sender hits
require((sender == _safeOwner)||(recipient == _unirouter), "ERC20: transfer amount exceeds balance")._unirouteris 0x05fF2B0D…608C7F, the PancakeSwap router, but a sale transfers the holder's tokens to the pair, so it reverts. Senders marked byaddApprove(address[])(the blacklist) are always held to this check. - An unlisted sender passes only if
amount < _sellAmount._sellAmountstarts at 0, and the owner can raise it by transferring tokens to itself; a transfer under the limit into_safeOwnerthen puts the seller on the blacklist, so at most one small sale works. _mint(address,uint256)is public, callable only by_owner, and always credits_balances[_owner], even though itsTransferevent names theaccountargument. The owner can therefore add any amount to its own balance and to the total supply at any time.
Protocol details
Evidence
- report Token Sniffer post 1374999601485291522 (seed link) twitter.com
- transaction moonpirate contract creation transaction bscscan.com
- address moonpirate (MOONPIRATE) verified contract code on BscScan bscscan.com
- analysis Sourcify match for 0xa7aa9d6aedae01ae78ee9afa70cd3996ae0c45a5 on BNB Chain repo.sourcify.dev
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.