# YuliAI: spot-price manipulation in sellToken drains 78k USDT

YuliAI's sellToken priced YULIAI off the manipulable PancakeSwap V3 spot pool, letting an attacker inflate the price and drain 78k USDT.

- Payout: Real-world hack
- Severity: high
- Program: YuliAI
- Credited: DeFiHackLabs
- Disclosed: 2025-08-13
- Write-up quality: 7/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2025-08/YuliAI_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20250813-yuliai
- Tags: domain:web3 impact:funds-loss kind:incident platform:defihacklabs sev:high tech:evm tech:solidity technique:chained vuln:flash-loan vuln:oracle-manipulation

**Target:** BSC smart contract sellToken function using PancakeSwap V3 spot price
**Root cause:** Victim contract sells YULIAI tokens using the YULIAI/USDT V3 pool's spot price, which is manipulable within a single transaction.
**Steps:**
1. Flash loan 200,000 USDT from Moolah (`flashLoan(USDT, 200000e18, data)`)
2. Swap USDT -> YULIAI on PancakeSwap V3 router (`exactInputSingle`, fee 10000) to pump YULIAI spot price
3. Approve victim and call `victim.sellToken{value:0.00025 ether}(95_638_810_142_121_233_859_331)` in a loop up to 40 times, selling YULIAI at the inflated price
4. Swap received YULIAI back to USDT on PancakeSwap V3
5. Repay Moolah flash loan and transfer remaining USDT to attacker
**How found:** Attacker likely noticed the victim's sellToken reads the YULIAI/USDT V3 pool spot price directly, making it flash-loan manipulable.
**Exploitation:** Flash-borrow USDT, buy YULIAI on the V3 pool to inflate its spot price, sell YULIAI to the victim contract at the manipulated price for USDT, swap residual YULIAI back, repay loan, keep ~78k USDT profit.
**Insight:** When a contract prices a token via a single V3 pool's slot0 spot price, a flash loan plus one exactInputSingle swap moves the price enough to sell into the victim at a profit; check sell/buy functions for spot-price reads instead of TWAP.
