# Vaults with non-UST underlying asset vulnerable to flash loan attack on curve pool

NonUSTStrategy prices vault deposits/withdrawals off a manipulable DAI/UST Curve pool, letting a flash loan skew the rate and extract value.

- Payout: Audit contest
- Severity: high
- Program: Sandclock
- Found by: camden
- Disclosed: 2022-02-23
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-01-sandclock-findings/issues/7
- Library page: https://bugbountylibrary.com/r/c4%3A2022-01-sandclock%3AH-03
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:flash-loan vuln:oracle-manipulation

**Target:** NonUSTStrategy.sol vault strategy using DAI/UST Curve pool
**Root cause:** The strategy reads the DAI/UST exchange rate directly from the Curve pool spot state (line 135) instead of a manipulation-resistant oracle, so a large swap moves the rate used for vault deposit/withdraw accounting.
**Steps:**
1. Deploy vault with DAI underlying and NonUSTStrategy pointing at a DAI/UST Curve pool
2. Flash loan a large amount of DAI
3. Swap DAI for UST in the Curve pool, pushing the DAI->UST rate up
4. Deposit or withdraw from the vault at the now-favorable manipulated rate
5. Swap UST back to DAI, repay flash loan, keep profit
**How found:** Code review of NonUSTStrategy identified that the exchange rate at line 135 is derived from Curve pool spot reserves, which are flash-loan manipulable.
**Exploitation:** Attacker flash-borrows DAI, dumps it into the DAI/UST Curve pool to skew the spot exchange rate the strategy trusts, then deposits/withdraws from the vault on favorable terms, reverses the swap, and repays the loan, pocketing the difference.
**Insight:** When a strategy converts between assets using a Curve/AMM pool's spot reserves for accounting, the pool is a price oracle an attacker can move with one swap; check every rate read against whether it can be skewed within a single transaction.
