Submitted by 0xWaitress, also found by 0xWaitress, ast3ros, catellatech (1, 2), Nyx (1, 2), kodyvim, and nadin (1, 2)
accrueInterest is expected to revert when the rate is higher than the maximum allowed rate, which is possible since the utilization can be more than 1
accrueInterest is an essential function to keep updated of the global mToken interest payment from the borrower to the depositor. The function is called anytime there is a deposit/liquidate/borrow/repay/withdraw.
The function is set to revert when the borrowRateMantissa is bigger than the borrowRateMaxMantissa.
require(borrowRateMantissa <= borrowRateMaxMantissa, "borrow rate is absurdly high");.
With proper configuration, this check should be fine since the real borrowRate should be calibrated to be within the maxRate. However, since the utilization could actually be bigger than 1 (when reserve is bigger than cash [issue-37] , the actual rate could be bigger than the expected unreachable max rate:
Example:
Base: 1%
multiplierPerTimestamp: 5% APR
jumpMultiplier: 50% APR
klink: 50%
We could reasonably assume the max APR is 1% + 5% * 0.5 + 50% * (1-0.5) = 28.5%
However when reserve is more than cash it would cause the utilization be bigger than 1, letsay utilization is 101%: such that the actual rate would  be:
1% + 5% * 0.5 + 50% * (1.01 - 0.5) = 29%
This would cause the accurueInterest to revert.
Impact: all deposit/withdraw/borrow/repay function would fail and severe brick the operation of the protocol and lock user funds. Interest accrual cannot work which impact both borrower for timely exit as well as deposit to collect their interest.
https://github.com/code-423n4/2023-07-moonwell/blob/main/src/core/MToken.sol#L403
Note: per judge request, this information from duplicate issue 37 has been appended to M-16 for the final report.
Utilization is calculated as borrow / (cash + borrow - reserve). and the utilization would determine the interest rate in this classic jump/klink model.
Consider:
When reserves becomes more than cash, the formula for utilizationRate would give a utilization rate above 1. This is different from the code comment which said to @return The utilization rate as a mantissa between [0, 1e18]
https://github.com/code-423n4/2023-07-moonwell/blob/main/src/core/IRModels/JumpRateModel.sol#L66-L75
ElliotFriedman (Moonwell) disputed and commented:
