# YziAI: hardcoded transferFrom backdoor mints and dumps LP

YziAI token's transferFrom had a hardcoded backdoor: a specific caller and amount triggered minting and a router swap draining LP to the manager.

- Payout: Real-world hack
- Severity: high
- Program: YziAI
- Credited: DeFiHackLabs
- Disclosed: 2025-03-27
- Write-up quality: 6/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2025-03/YziAIToken_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20250327-yziaitoken
- Tags: domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity technique:source-review vuln:access-control vuln:business-logic

**Target:** BEP-20 token contract on BSC (transferFrom override)
**Root cause:** transferFrom contains a hidden branch: when msg.sender == manager and amount == 1199002345, it mints supply*10000 to the contract, approves the router, and swaps tokens for ETH sent to manager.
**Steps:**
1. Fork BSC at block 47838545-1.
2. As attacker, call `YziAI.transferFrom(CAKE_LP, CAKE_LP, 1199002345)`.
3. Backdoor branch fires: `_mint(address(this), supply*10000)`, `_approve(address(this), router, supply*100000)`, then `swapExactTokensForETH(balanceOf(to)*1000, 1, [token,WETH], manager, ...)`.
4. Attacker BNB balance increases (drained from LP).
**Exploitation:** Attacker triggers the hardcoded transferFrom branch with the magic amount 1199002345, causing the contract to mint a huge token supply, approve the Uniswap router, and swap tokens for ETH routed to the manager address, draining ~376 BNB (~$239.4K) from the CAKE LP.
**Insight:** Read token transferFrom/transfer overrides for magic constants (specific msg.sender + amount) that gate mint/approve/swap logic — a classic rug backdoor hidden in plain sight in verified source.
