The ReserveLibrary contract calculates borrowing and liquidity rates using parameters (optimalUtilizationRate, baseRate, primeRate, etc.) that lack validation, allowing them to be set to mathematically invalid or dangerous values. This can result in negative interest rates, arithmetic overflows, or unsustainable rate spikes, destabilizing the protocol’s lending/borrowing equilibrium.
Exploit Scenerio
Set Invalid Parameters: Admin configures optimalUtilizationRate to 150% (exceeding 100%).
Trigger Rate Calculation: When utilization exceeds 100%, the interest rate formula breaks.
Protocol Malfunction: Borrowing/lending functions fail due to invalid rates.
Code Proof:
https://github.com/Cyfrin/2025-02-raac/blob/89ccb062e2b175374d40d824263a4c0b601bcb7f/contracts/libraries/pools/ReserveLibrary.sol#L270
In ReserveLibrary.sol, the calculateBorrowRate function lacks bounds checks:
Attack Simulation:
Parameters:
optimalUtilizationRate = 150% (1.5e27 in Ray)
utilizationRate = 100% (1e27)
Calculation:
Since utilizationRate (1e27) ≤ optimalUtilizationRate (1.5e27), the formula attempts:
Since the primeRate < baseRate, this produces a negative rate, crashing the protocol.
Rates can become invalid (e.g., >100%), crashing the protocol.
Manual review
Enforce strict bounds on interest rate parameters
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.