Photosynthesis Honeypot
What happened
Photosynthesis (PSY) is a BNB Smart Chain token whose _approve function wipes every holder's allowance. Only one hard-coded address, which matches the deployer address, is allowed to keep an allowance. Because transferFrom subtracts the amount from the caller's allowance, any ordinary holder's transferFrom for a non-zero amount reverts, and a sale that pulls tokens through transferFrom fails.
De.Fi's REKT database lists the token as an exit scam/honeypot and says the contract owner could disable the transfer function, which restricted users in selling their tokens.
How it happened
- The constructor mints the whole supply of 1298000000000 raw units (4 decimals) to the deployer:
_balances[msg.sender] = _totalSupply;. - Every allowance write goes through
_approve, which branches on a literal address:if (owner == address(0x394FB89C650Ce6eE5D5A02EB8a194C27eFD5f919)) { _allowances[owner][spender] = amount; ... } else { _allowances[owner][spender] = 0; emit Approval(owner, spender, 0); }. For every other holder the stored allowance is always 0, whateverapprove,increaseAllowanceordecreaseAllowanceis called with. transferFrommoves the tokens and then runs_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance"));. With an allowance of 0, thesubreverts for any amount above zero, so the wholetransferFromcall reverts for an ordinary holder.- Plain
transfercalls_transferdirectly and does not touch allowances, so holders can still send tokens wallet to wallet. A sale that has the router pull tokens withtransferFromis the case that fails. The hard-coded address is not restricted, so its approvals andtransferFromcalls work. - The address is a literal in the bytecode, so
renounceOwnershiportransferOwnershipdoes not remove the exemption or the block. The owner can also callmint(uint256), which credits new tokens to the owner and raises_totalSupply.
Protocol details
Build your security review skills
Work through hands-on labs covering real exploit mechanics, review techniques, and defensive patterns.