# MyAi MultiSender: arbitrary _from drains victim token approvals

MyAi MultiSender batchTokenTransfer trusted a caller-supplied _from address, letting an attacker drain a victim's approved MyAi tokens and swap them for BNB.

- Payout: Real-world hack
- Severity: high
- Program: MyAi
- Analysis by: DeFiHackLabs
- Disclosed: 2023-06-30
- Write-up quality: 6/10
- Original: https://github.com/SunWeb3Sec/DeFiHackLabs/blob/main/src/test/2023-06/MyAi_exp.sol
- Library page: https://bugbountylibrary.com/r/dhl%3A20230630-myai
- Tags: area:web3 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:** MultiSender batchTokenTransfer contract on BSC
**Root cause:** batchTokenTransfer accepts an arbitrary _from parameter and pulls tokens via transferFrom without verifying the caller is _from or otherwise authorized, so anyone can spend any holder's approval to the contract.
**Steps:**
1. Attacker approves PancakeRouter and MultiSender for MyAi.
2. Build arrays of 100 addresses (attacker) and 100 amounts of `999_999_999_999_400`.
3. Call `MultiSender.batchTokenTransfer{value: 1 ether}(Victim, Attack, Token, address(MyAi), 999_999_999_999_400 * 100, true)` passing the victim as _from.
4. Contract pulls victim's MyAi via transferFrom into the batch recipients (attacker).
5. Loop 100 times swapping MyAi to WBNB via PancakeRouter.
**Exploitation:** Attacker used the victim's existing MyAi approval to MultiSender as the funding source, passing Victim as _from and attacker addresses as recipients, then dumped the drained tokens on PancakeSwap for ~2-10 BNB.
**Insight:** Batch-transfer/multisender helpers that take a _from parameter are a classic approval-drain primitive: any holder who approved the contract can be impersonated. Grep for transferFrom(_from,...) where _from is caller-supplied and not checked against msg.sender.

