Skip to content
Business logic Audit finding Advanced

First depositor can brick market by forcing very large borrow rate

The first depositor in a lending market can manipulate the utilisation rate to become extremely high by borrowing and then repaying in a way that leaves a tiny cash balance and a small outstanding borrow. This causes the calculated borrow rate to exceed the maximum allowed, making every call to accrue interest revert and effectively bricking the market.

Bobai23 Follow with Kvar, LeFy and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-07-malda-judging/issues/86

This issue has been acknowledged by the team but won't be fixed at this time.

Found by

Bobai23, Kvar, LeFy, cergyk, dan__vinci

Description

The borrow rate is computed in JumpRateModelV4 as a function of the utilisation:

JumpRateModelV4.sol#L140-L150:

Solidity
    function getBorrowRate(uint256 cash, uint256 borrows, uint256 reserves) public view override returns (uint256) {
        uint256 util = utilizationRate(cash, borrows, reserves);


        if (util <= kink) {
            return util * multiplierPerBlock / 1e18 + baseRatePerBlock;
        } else {
            uint256 normalRate = kink * multiplierPerBlock / 1e18 + baseRatePerBlock;
            uint256 excessUtil = util - kink;
            return excessUtil * jumpMultiplierPerBlock / 1e18 + normalRate;
        }
    }

Utilization rate being defined as:

JumpRateModelV4.sol#L127-L135:

Solidity
    function utilizationRate(uint256 cash, uint256 borrows, uint256 reserves) public pure override returns (uint256) {
        if (borrows == 0) {
            return 0;
        }
        return borrows * 1e18 / (cash + borrows - reserves);
    }

We notice that utilizationRate can be greater than 1e18, when cash + borrows - reserves < borrows. In the following section, we will show a scenario where the ratio can become very big.

First depositor manipulation

Assuming a 18 decimals market:

  1. Alice the first depositor can mint for 1e18 tokens, and borrow it all (by having additional collateral in another market):

    • cash = 0
    • totalBorrows = 1e18
    • reserves = 0
  2. Alice waits for a few blocks for some interest to accrue:

    • cash = 0
    • totalBorrows = 1e18 + 1e12
    • reserves = 5e11 (assuming 50% reserve factor)
  3. Alice repays totalBorrows minus reserves minus 1:

    • cash = 1e18 + 5e11 - 1
    • totalBorrows = 5e11 + 1
    • reserves = 5e11
  4. Alice redeems the total supply

    • cash = 0
    • totalBorrows = 5e11 + 1
    • reserves = 5e11

utilization rate is very big: 5e11. As a result the getBorrowRate is bigger than 0.0005e16 (initial max borrow value):

mToken.sol#L36-L39:

Solidity
    constructor() {
        borrowRateMaxMantissa = 0.0005e16;
    }

As a result the market is completely bricked, because _accrueInterest always reverts: mTokenStorage.sol#L351-L356:

Solidity
    //@audit in _accrueInterest():
    /* Calculate the current borrow interest rate */
    uint256 borrowRateMantissa =
        IInterestRateModel(interestRateModel).getBorrowRate(cashPrior, borrowsPrior, reservesPrior);
    if (borrowRateMaxMantissa > 0) {
        require(borrowRateMantissa <= borrowRateMaxMantissa, mt_BorrowRateTooHigh());
    }

Indeed _accrueInterest is called for all operations, even for updating the interestRateModel.

Recommendation

Consider bounding the utilization to be at most 1e18 (100%), which would avoid having degenerate borrow rate values.

The original report as published on Sherlock, by Bobai23. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the utilisation rate calculation does not cap the result at 100%, allowing it to exceed 1e18 when cash plus borrows minus reserves is less than borrows, which then produces a borrow rate above the maximum and causes interest accrual to revert.

What the attacker needed

Attacker is the first depositor; attacker has collateral in another market; market has 18 decimals

The fix

The utilisation rate should be bounded to at most 1e18 (100%) to prevent degenerate borrow rate values.

How it was found

  1. Alice becomes the first depositor, mints 1e18 tokens, and borrows them all using collateral from another market.
  2. Alice waits a few blocks for interest to accrue.
  3. Alice repays the total borrows minus reserves minus one.
  4. Alice redeems the total supply, leaving cash at zero and a small outstanding borrow.
  5. The utilisation rate becomes very large, causing the borrow rate to exceed the maximum and making _accrueInterest revert.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In a lending market, the interest rate depends on how much of the pool is borrowed compared to what is available. The first person to deposit can take out a loan and then repay almost all of it, leaving a tiny amount borrowed and almost no cash. This makes the calculated interest rate shoot up beyond a safety limit, so the system refuses to process any further actions, locking everyone out.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Bobai23

View all

1 more disclosed report, best first.

More from Malda

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.