RapidSwap Honeypot
What happened
RapidSwap is a BEP-20 token on BNB Smart Chain deployed from 0x2988c04f…EDdCF4. De.Fi's REKT database lists it as an exit scam/honeypot, stating that the contract owner could disable the transfer function and so restrict users from selling. In the verified source, a hidden address variable newun is filled by the first transferFrom call and from then on no transfer or transferFrom can send tokens to it.
A blog analysis of this code pattern explains that when newun ends up as the liquidity pool, selling back to BNB is blocked.
How it happened
- The constructor mints the whole supply to the deployer:
_totalSupply = 100000000000000000000000000;andbalances[owner] = _totalSupply;. A public variableaddress public newun;starts at the zero address. - In
transferFrom, the first call made whilenewunis unset runsif(from != address(0) && newun == address(0)) newun = to;. That call is not checked against anything, and it records its recipienttoinnewun. The blog post describes this as the first add-liquidity transaction, so thatnewunbecomes the pool; the supplied code does not itself say which address was recorded. - After that, every
transferFromtakes theelsebranch:else require(to != newun, "please wait");. The plaintransferfunction has the same check on every call:require(to != newun, "please wait");. Neither function exempts the owner or any other sender. - A swap of tokens for BNB sends the tokens to the pool. If the pool is
newun, that transfer reverts with "please wait", so holders cannot sell. Transfers to any other address, and transfers out ofnewun, are not blocked by these checks. - The owner can change the target with
transfernewun(address _newun) public onlyOwner. Setting it to the zero address makes the nexttransferFromcapture its recipient again, so the block comes back; pointing it at an address that never receives tokens lifts the block. The owner can also runclearCNDAO()(onlyOwner), which sends the contract's own BNB balance to the caller.
The code allows this behaviour. The sources opened show no transaction proving which address newun held or when the owner changed it, so what actually happened to holders rests on De.Fi's listing.
Protocol details
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.