# `TpdaLiquidationPair.swapExactAmountOut()` can be DOSed by a vault's mint limit

Attacker front-runs liquidation bots by depositing to hit the vault's uint96 mint limit, shrinking liquidatableBalanceOf so swapExactAmountOut reverts, then buys the yield cheaply.

- Payout: Contest reward
- Severity: medium
- Program: PoolTogether
- Credited: 0xSpearmint1
- Disclosed: 2024-05-10
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-05-pooltogether-judging/issues/39
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-05-pooltogether%3AM-4
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:race-window technique:source-review vuln:business-logic vuln:dos vuln:liquidation

**Target:** TpdaLiquidationPair / PrizeVault liquidation swap
**Root cause:** liquidatableBalanceOf() caps share output at the vault mint limit (_mintLimit), so pushing minted shares near type(uint96).max reduces availableOut below the bot's requested _amountOut, reverting the swap.
**Steps:**
1. Vault state: _availableYield=1000e18, shares minted=type(uint96).max-2000e18, yieldFee=0, smoothingFactor=0.
2. Bot calls `swapExactAmountOut(_amountOut=1000e18)`.
3. Attacker front-runs with a deposit of `1000e18+1`, minting shares so mint limit becomes `1000e18-1`.
4. Bot tx executes: `_amountOut > availableOut` -> `revert InsufficientBalance`.
5. Repeat until auction price decays, then attacker swaps liquidatable balance himself at discount.
**How found:** Code reading of swapExactAmountOut's availableOut check traced into PrizeVault.liquidatableBalanceOf, noticing share-output liquidation is bounded by _mintLimit; realized an attacker can saturate the mint limit to zero out availableOut.
**Exploitation:** Attacker deposits (or flash-borrows and back-runs) to keep minted shares at the uint96 mint limit, forcing every liquidation bot swap to revert; the auction price decays linearly with elapsed time, letting the attacker later buy the liquidatable yield below fair value, harming vault users.
**Insight:** When a swap's available output is derived from a mint/withdraw cap rather than actual balance, an attacker can saturate that cap cheaply to zero out the victim's allowed amountOut and grief liquidations; check whether output-token choice (shares vs asset) routes through a capped path.
