# An attacker can steal funds from multi-token vaults

yAxis Vault.balanceOfThis sums raw normalized balances of differently-priced tokens, letting an attacker deposit cheap USDT and withdraw more valuable DAI/USDC.

- Payout: Audit contest
- Severity: high
- Program: yAxis
- Found by: WatchPug
- Disclosed: 2021-11-10
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2021-09-yaxis-findings/issues/77
- Library page: https://bugbountylibrary.com/r/c4%3A2021-09-yaxis%3AH-10
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:solidity technique:source-review vuln:accounting-error vuln:oracle-manipulation

**Target:** Vault.sol / Controller.sol multi-token vault accounting
**Root cause:** balanceOfThis() adds normalized token amounts across tokens without weighting by price, so vault share value is mispriced when token prices diverge.
**Steps:**
1. Vault holds DAI/USDC/USDT at prices 1.05/0.98/0.95 with balances 2M/1M/0.5M
2. Attacker deposits 3M USDT, receiving shares priced off the naive summed balance
3. Attacker withdraws 3M worth of shares, receiving 2M DAI + 1M USDC
4. Attacker profits from price differential; remaining holders lose funds
**How found:** Code review of balanceOfThis() noticing it sums _normalizeDecimals of each token's balanceOf without any price oracle, then reasoning about divergent token prices.
**Exploitation:** Deposit the cheapest token in a multi-token vault, then withdraw to receive proportionally more valuable tokens; profit equals the price spread times withdrawn amount.
**Insight:** In multi-asset vaults, any accounting that sums raw balances across tokens is exploitable whenever token prices diverge; check whether share pricing uses a virtual price or oracle weighting.
