# Utilization rate multiplier will not shift if oracle is consulted frequently

Rounding in VaultAdapter multiplier shift lets frequent oracle calls zero out elapsed time, freezing utilization-based interest rate multiplier.

- Payout: Audit contest
- Severity: medium
- Program: Cap
- Found by: Matin
- Disclosed: 2025-07-07
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-07-cap-judging/issues/148
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-07-cap%3AM-2
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error

**Target:** VaultAdapter oracle utilization rate multiplier (Solidity)
**Root cause:** `(_elapsed * $.rate / 1e27)` rounds to zero when elapsed time is small relative to rate, so the multiplier update becomes a no-op instead of shifting.
**Steps:**
1. Set rate so full multiplier shift takes ~24h (e.g. `_rate = 1e27/1 days`).
2. Borrow to push utilization above kink.
3. Call `adapter.rate(...)` every ~23h so `_elapsed * rate / 1e27 == 0`.
4. Observe multiplier and interest rate unchanged across calls; only after `_elapsed` exceeds 1 day + 1s does rate increase.
**How found:** Code review of multiplier shift formula; noticed the inner `(_elapsed * $.rate / 1e27)` term truncates to zero for short elapsed windows, making the whole update a no-op.
**Exploitation:** Attacker repeatedly pokes the oracle at intervals shorter than the rounding threshold, keeping the multiplier pinned and preventing interest rate from rising during high LTV (or falling during low LTV).
**Insight:** In interest-rate/oracle accumulators, check whether time-delta scaling is applied before or after division by a large fixed-point base; a pre-division truncation lets an attacker reset the clock cheaply by frequent pokes.

## Proof of concept (copied exactly from the original report)

**Foundry test proving multiplier does not shift**

```
function test_submissionValidity() public {
        vm.startPrank(user_agent);
        // utilization rate is set below than the kink ratio
        lender.borrow(address(usdc), 100e6, user_agent);
        assertLt(cUSD.utilization(address(usdc)), 2e26);
        adapter.rate(env.usdVault.capToken, address(usdc));
        // utilization rate is set above than the kink ratio
        lender.borrow(address(usdc), 2600e6, user_agent);
        assertGt(cUSD.utilization(address(usdc)), 2e26);

        // due to rounding issue, utilization rate will not grow because multiplier is not shifted
        _timeTravel(1 days / 2);
        uint256 utilizationRateFirst = adapter.rate(env.usdVault.capToken, address(usdc));
        _timeTravel(1 days / 2);
        uint256 utilizationRateSecond = adapter.rate(env.usdVault.capToken, address(usdc));
        assertEq(utilizationRateFirst, utilizationRateSecond);

        // rounding issue happens for 1 day as well, so we need to advance 1 second further
        _timeTravel(1 days + 1);
        // now the utilization rate is increased
        uint256 utilizationRateThird = adapter.rate(env.usdVault.capToken, address(usdc));
        assertGt(utilizationRateThird, utilizationRateSecond);
    }
```

