# Zero rates on new quoted tokens allow an attacker to take an interest free quota

Newly added quota tokens default to a zero interest rate until the next epoch, letting borrowers take max quota interest-free and depriving LPs of quota revenue.

- Payout: Audit contest
- Severity: high
- Program: LoopFi
- Found by: Bauchibred
- Disclosed: 2025-02-17
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-07-loopfi-findings/issues/195
- Library page: https://bugbountylibrary.com/r/c4%3A2024-07-loopfi%3AH-03
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:incomplete-fix technique:source-review vuln:accounting-error vuln:business-logic

**Target:** PoolQuotaKeeperV3 / CDPVault quota accounting (Solidity)
**Root cause:** addQuotaToken registers a token with rate=0 and cumulativeIndexLU=1; rates only refresh on the next gauge epoch via updateRates, so quota interest accrues at zero until then.
**Steps:**
1. Gauge calls `addQuotaToken(token)`; token stored with default rate 0 and cumulativeIndexLU=1.
2. Attacker opens/borrows against collateral via `CDPVault.borrow` up to the configured quota limit for that token.
3. `_calcDebt` -> `_getQuotedTokensData` -> `PoolQuotaKeeperV3.cumulativeIndex` uses rate 0, so `cumulativeQuotaInterest` stays 0.
4. `_calcQuotaRevenueChange` returns `change * rate / PERCENTAGE_FACTOR` = 0, so no quota revenue is booked.
5. Attacker repays after the zero-rate window paying only base credit interest, no quota interest.
**How found:** Code review of addQuotaToken noting rates default to 0 and only update on epoch change in GaugeV3._checkAndUpdateEpoch; cross-referenced the same issue fixed in upstream Gearbox (ChainSecurity audit 7.3).
**Exploitation:** Borrower takes a maximum-size quota position immediately after a new token is quoted; during the zero-rate epoch no quota interest accrues and quota revenue stays zero, so the position is interest-free on the quota component until the next epoch update sets a real rate.
**Escalation:** Repeatable on every newly added token and scalable across many users or one large position, compounding LP revenue loss.
**Insight:** When a fork re-implements an upstream fix, grep the lib for the patched guard (here `rate == 0 ? 0 : calcActualQuotaChange`) and check the fork's own copy still has it; default-zero state variables set at registration are a recurring interest/revenue bypass.

