# Protected listings checkpoints are not always updated when the total supply changes

ProtectedListings checkpoints miss total-supply changes from deposit/redeem/afterSwap, letting an attacker inflate utilization rate and force victims to overpay interest or get liquidated.

- Payout: Audit contest
- Severity: high
- Program: Flayer
- Found by: Ironsidesec
- Disclosed: 2024-08-06
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-08-flayer-judging/issues/515
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-15
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:accounting-error vuln:flash-loan vuln:liquidation vuln:oracle-manipulation

**Target:** ProtectedListings checkpoint/interest-rate accounting in Locker and UniswapImplementation
**Root cause:** Interest rate depends on utilization (listings vs total supply), but checkpoints are only written on some paths; Locker::deposit, Locker::redeem and UniswapImplementation::afterSwap change total supply without creating a new checkpoint.
**Steps:**
1. Alice creates first protected listing via `ProtectedListings::createListings()` expecting low interest.
2. Eve flashloans all collection tokens from the UniV4 pool.
3. Eve calls `Locker::redeem()` to burn flashloaned tokens for NFTs, lowering total supply and raising utilization.
4. Eve calls `Listings::cancelListings()` with empty token id array to force a checkpoint at the inflated utilization.
5. Eve calls `Locker::deposit()` to re-mint collection tokens from the NFTs.
6. Eve returns tokens to the UniV4 pool; Alice now pays inflated interest or gets liquidated early.
**How found:** Code review of interest-rate calculation: noticed utilization depends on total supply, then traced all paths that mint/burn collection tokens (Locker::deposit, Locker::redeem, UniswapImplementation::afterSwap) and found none create a ProtectedListings checkpoint.
**Exploitation:** Attacker flashloans collection tokens, burns them via redeem to spike utilization, triggers a checkpoint via cancelListings with empty array, then re-deposits NFTs to restore supply and repays flashloan. Profit comes from higher interest paid by victims and/or liquidation of their protected listings, especially profitable if attacker is also an LP.
**Escalation:** Worst case: victim borrows 1 wei in a fresh collection fully locked in UniV4, giving utilization of 1e36, making position liquidatable almost immediately.
**Insight:** When a rate/score depends on a mutable global (total supply), enumerate every path that mutates it and verify each writes a checkpoint; mint/burn hooks in adjacent contracts (Locker, swap hooks) are easy to miss.

