# Fixed interest rates can be manipulated by a whale borrower

Whale repays large floating debt in one block to drop utilization, then opens fixed-rate loan at ~1% fee instead of ~58%.

- Payout: Contest reward
- Severity: medium
- Program: Interest Rate Model
- Credited: santipu_
- Disclosed: 2024-04-06
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-04-interest-rate-model-judging/issues/67
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-04-interest-rate-model%3AM-2
- 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:oracle-manipulation

**Target:** Lending market fixed-rate borrow (Market.sol borrowAtMaturity)
**Root cause:** Fixed rate uses averaged floating assets but instantaneous floatingDebt for utilization, so a single-block repayment of debt lowers utilization and thus the fixed rate.
**Steps:**
1. Fork Optimism at block 119348257; whale deposits 5M USDC and borrows 35x20 wstETH to inflate floating debt.
2. Baseline: deposit 3 wstETH, call `borrowAtMaturity(maturity, 1e18, max, ...)`; observe fee1 ≈ 0.5825e18 (~58%).
3. Revert snapshot; whale calls `marketWSTETH.repay(700e18, whale)` to slash floatingDebt.
4. Repeat `borrowAtMaturity` with same params; observe fee2 ≈ 0.0114e18 (~1%).
5. Attacker can flash-loan the repayment capital to perform this atomically.
**How found:** Noticed fixed rate uses averaged floating assets but raw current floatingDebt in utilization, hypothesizing single-block debt repayment could skew the rate; validated with a fork PoC comparing fees before/after repayment.
**Exploitation:** Whale (or flash-loan-funded attacker) temporarily repays a large floating loan to depress instantaneous floatingDebt/utilization, opens a fixed-rate loan at a much lower fee, then re-borrows the repaid funds to restore position, capturing the rate difference.
**Insight:** When a rate/oracle mixes averaged and instantaneous inputs, the non-averaged component is the manipulation surface — check every utilization/debt term for TWAP coverage.
