MoonChain Honeypot
What happened
MoonChain (MCF) is a BNB Smart Chain BEP-20 token with an owner-controlled tracing flag. When the owner turns it on, transferFrom and transfer start rejecting transfers to a single recorded address nxOwner, which is set automatically from the first transferFrom recipient while tracing is on. De.Fi's REKT database lists the token as an exit scam/honeypot and states that the owner could disable the transfer function, which restricted users in selling their tokens.
The code allows that outcome. Whoever is recorded as nxOwner also passes the onlyOwner check, and the owner can add to its own balance with emitTransfer.
How it happened
- The constructor sets
symbol = "MCF"; name = "MoonChain"; decimals = 9;, credits_totalSupply = 860000000000000000to the deployer, and moves half of it to the dead address. - The owner (or
nxOwner) can toggle the flag:function setTracing(bool _tracing) onlyOwner public { tracing = _tracing; }.tracingstarts asfalse. - With tracing on,
transferFromruns the modifiercontextHandler(from, to):if(from != address(0) && nxOwner == address(0)) nxOwner = to; else require(to != nxOwner, "Order ContextHandler");. The firsttransferFrommade while the flag is on succeeds, from any caller, and records its recipient asnxOwner. The owner does not choose that address through any function. Every latertransferFromto it reverts. The source does not say who that first recipient is. transferusesrequestHandler(to):if(tracing) require(to != nxOwner, "Handling Request");, so direct transfers tonxOwneralso revert while the flag is on. IfnxOwneris a liquidity pair, holders cannot sell into it.onlyOwnerisrequire(msg.sender == owner || msg.sender == nxOwner);, so whoever is recorded asnxOwneralso gains the owner functions. These includeemitTransfer(uint256 _input), which executesbalances[msg.sender] = balances[msg.sender] + (_input);without changing_totalSupply, and_construct(), which sends the contract's BNB balance to the caller.renounceOwnership(address _newOwner)has no access check and only writescurrentOwner = _newOwner. It does not changeowner, so it removes no power.- The source does not show that the owner enabled
tracingor usedemitTransfer. De.Fi's REKT database lists the token as a honeypot dated 2021-05-18.
Protocol details
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.