# Attacker can inflict losses to other Superpool user's during a bad debt liquidation depending on the deposit/withdraw queue order

SuperPool deposit/withdraw queue ordering lets an attacker shift assets into a soon-to-be-slashed base pool, forcing other depositors to absorb the bad-debt loss.

- Payout: Audit contest
- Severity: medium
- Program: Sentiment
- Found by: hash
- Disclosed: 2024-08-07
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-08-sentiment-v2-judging/issues/564
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-sentiment-v2%3AM-20
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:chained vuln:business-logic vuln:liquidation

**Target:** SuperPool deposit/withdraw queue and base pool bad-debt liquidation
**Root cause:** SuperPool routes deposits/withdrawals by fixed queue order, so an attacker can deposit into one base pool and withdraw from another to concentrate SuperPool assets in the pool about to be slashed by rebalanceBadDebt, which zeroes out borrowAssets from totalDepositAssets.
**Steps:**
1. Observe a base pool (PoolA) about to undergo bad-debt liquidation via `rebalanceBadDebt`.
2. Attacker deposits into SuperPool so funds land in PoolA per depositQueue.
3. Attacker withdraws from SuperPool, draining a different pool (PoolB) per withdrawQueue, leaving SuperPool concentrated in PoolA.
4. `rebalanceBadDebt` slashes PoolA's totalDepositAssets, and the loss is borne by remaining SuperPool depositors.
**How found:** Code reading of `rebalanceBadDebt` writing off borrowAssets from totalDepositAssets combined with SuperPool's owner-configurable deposit/withdraw queues; constructed numeric scenarios to show share-value divergence with and without attacker.
**Exploitation:** Attacker times deposit/withdraw around an imminent bad-debt liquidation, using queue ordering to move SuperPool exposure into the slashed pool while exiting the safe pool, avoiding personal loss and shifting it to other depositors; flash loans can supply capital per referenced issue #487.
**Insight:** When a vault routes funds across multiple underlying pools by ordered queues, check whether an attacker can reorder effective exposure via deposit/withdraw asymmetry right before a loss event (liquidation/slashing) to concentrate losses on others.

