SherLOCK Rug Pull

Reported loss $262K
Rugpull

What happened

SherLOCK (LOCK) was a BNB Chain token whose transfer logic lets the owner stop holders from selling while the owner's own wallets trade freely. Every sale to the PancakeSwap pair or router must pass _canTransfer, which checks each seller's cumulative sold amount against what they bought, their cumulative BNB proceeds against the owner-set _theNumber, and their BNB balance against the owner-set _theRemainder; if a check fails, transfer returns true without moving any tokens, so the swap cannot complete. Addresses in _marketersAndDevs skip these checks, and the owner can also credit itself unlimited tokens through rewardHolders.

CertiK reported on 2022-09-21 that the contract deployer removed liquidity and sent 510 BNB to Tornado Cash at the time of its alert. The existing record lists 938 BNB removed from the pool, about 520 BNB sent to Tornado Cash and the rest sent to another address.

How it happened

  1. The constructor gives the whole 100,000,000 LOCK supply to the deployer, creates the PancakeSwap pair, sets master = owner() and marks the deployer in _marketersAndDevs, which bypasses all sell checks.
  2. For any other seller, _canTransfer only allows a transfer to the pair or router when bought >= sold + amount && _theNumber >= soldETH + amountETH && sender.balance >= _theRemainder.
  3. setNumber and setRemainder are onlyOwner with no limits, so the owner can set _theNumber to zero or _theRemainder above any holder's BNB balance and every holder sale fails.
  4. When the check fails, transfer and transferFrom skip _transfer but still return true, so a PancakeSwap sale sends no tokens to the pair and the swap cannot complete.
  5. The owner can mint to itself through rewardHolders, and the constructor grants master an unlimited allowance over the pair's own LOCK balance, which master can pull out with transferFrom and then call syncPair.
  6. On 2022-09-21 CertiK reported that the deployer had removed liquidity from the pool and sent 510 BNB to Tornado Cash.

Protocol details

Classification Token
Protocol Type Insurance
Affected asset / contract LOCK
Protocol links Website @Sherlock_DeFi

Security review history

Build your security review skills

Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.