# Quote pools are expected to have same base token and quote token but this is not enforced in swaps

Woofi Solana swap() lacked a constraint that the quote pool has matching base/quote tokens, letting fees be deducted from non-quote pools.

- Payout: Audit contest
- Severity: high
- Program: Woofi Solana Deployment
- Found by: S3v3ru5
- Disclosed: 2024-08-26
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-08-woofi-solana-deployment-judging/issues/64
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-woofi-solana-deployment%3AH-2
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:rust tech:solana technique:source-review vuln:accounting-error vuln:business-logic vuln:fee-bypass

**Target:** Solana swap instruction (woopool_quote account)
**Root cause:** swap.rs only constrained woopool_quote.token_mint == woopool_from.quote_token_mint and matching authority, never that the quote pool's base token equals its quote token, so any pool with the right mint could serve as the quote pool.
**Steps:**
1. Read swap.rs:79-84 account constraints on woopool_quote
2. Note only token_mint==woopool_from.quote_token_mint and authority equality are enforced
3. Observe swap.rs:192-194 deducts swap_fee from woopool_quote via sub_reserve/add_unclaimed_fee
4. Call swap instruction passing a non-quote pool (base==woopool_from.quote_token_mint, same authority) as woopool_quote
5. Fees are charged against that non-quote pool's reserve instead of the intended quote pool
**How found:** Code review of the swap account constraints against the documented invariant that quote pools have identical base and quote tokens; noticed the constraint only checked the from-pool's quote mint, not the quote pool's own base/quote equality.
**Exploitation:** Any user invoking swap can supply a non-quote pool as woopool_quote; the fee accounting then debits that pool's reserve and credits its unclaimed_fee, diverting fees away from the intended quote pool.
**Insight:** When a protocol documents an invariant (quote pool has base==quote token), grep every account constraint that admits a pool and verify the invariant is actually encoded, not just implied by mint equality with the counterparty.

