DirtyPig Honeypot
What happened
DirtyPig (PIG) on BNB Smart Chain, contract 0x3ab81681…fbcd0c, overrides the internal _approve function so that only one hard-coded address, 0x4e512563…D624A5, can hold a non-zero allowance. For every other holder the contract stores an allowance of 0 whatever amount is approved. A DEX sale pulls tokens with transferFrom, which subtracts the amount from that allowance and reverts, while a plain transfer still works.
That address is also the deployer and the current owner(), and the owner can call mint. De.Fi's REKT database lists the token as an Exit Scam/Honeypot dated 2021-04-19; the code contains no function that disables transfers, so the allowance override is the control that blocks sales.
How it happened
- The constructor mints the whole supply,
_totalSupply = 100000 * (10**10), to the deployer, with 10 decimals (100,000 tokens). _approvebranches on who is approving:if (owner == address(0x4e5125634a1f8baCe0b04F9B8Fe60c5AccD624A5)) { _allowances[owner][spender] = amount; ... } else { _allowances[owner][spender] = 0; emit Approval(owner, spender, 0); }. Every other holder who approves a router or any spender ends up with an allowance of 0, although anApprovalevent with value 0 is emitted.transferFromruns_transfer(sender, recipient, amount)and then_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance")). For a non-exempt sender the allowance is 0, so thesubreverts for any amount above 0 and the whole call is undone. A sale routed throughtransferFromtherefore fails for these holders.transfercalls_transferdirectly and has no allowance check, so tokens can still move into a holder's wallet and between wallets; only spender-based pulls fail.- The owner also has
mint(uint256 amount) public onlyOwner, which adds to_totalSupplyand to the owner's balance, andrenounceOwnership/transferOwnershipfromOwnable. The exemption, however, is tied to the hard-coded address, not toowner(). - What happened: the supplied sources do not show holder losses, sale attempts or liquidity removal. De.Fi's REKT database lists the token as an Exit Scam/Honeypot on 2021-04-19.
Protocol details
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.