# Malicious user can leverage flash loans to claim all coupon rewards

Anyone can mint bond tokens, call startAuction to snapshot shares, then distribute and claim all coupon rewards in one flash-loan transaction.

- Payout: Audit contest
- Severity: high
- Program: Plaza Finance
- Found by: 0x23r0
- Disclosed: 2024-12-16
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-12-plaza-finance-judging/issues/725
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-12-plaza-finance%3AH-6
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:business-logic vuln:flash-loan vuln:reward-distribution

**Target:** Pool/Distributor/BondToken reward distribution
**Root cause:** getIndexedUserAmount credits shares based on balance at the moment startAuction checkpoints sharesPerToken, with no snapshot or holding-period protection, so a balance held only momentarily earns full-period rewards.
**Steps:**
1. Flash-loan `couponAmountToDistribute / sharesPerToken` worth of underlying
2. Mint that many bond tokens via Pool
3. Call `Pool::startAuction()` to increment period and checkpoint sharesPerToken
4. Call `Pool::distribute()` to fund Distributor with previous auction's coupon amount
5. Call `Distributor::claim()` to receive all coupon tokens
6. Burn bond tokens and repay flash loan
**How found:** Reading that startAuction is permissionless and checkpoints sharesPerToken, combined with getIndexedUserAmount looping from lastUpdatedPeriod to current period using current balance — meaning a balance held only at snapshot time earns full rewards.
**Exploitation:** Single-transaction flash loan: mint bond tokens, trigger startAuction to snapshot balance into the new period, distribute previous auction rewards, claim 1:1 coupon tokens, burn, repay. Attacker captures the entire coupon pool.
**Insight:** When a reward index is checkpointed by a permissionless call and user shares are computed from current balance rather than a historical snapshot, a mint-snapshot-claim-burn sequence in one tx captures all rewards; look for permissionless period-advance functions paired with balance-based share accounting.

