Skip to content
Business logic Audit finding Advanced

`ReserveLogic::_updateIndexes()` assumes the utilization rate was constant the whole time when calculating the new borrows

The smart contract's interest index calculation uses a stale utilization rate, so borrowers pay less interest than they should. The impact depends on utilization but is likely constrained.

0x73696d616f Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-02-yieldoor-judging/issues/86

Found by

0x73696d616f

Summary

ReserveLogic::_updateIndexes() is as follows:

Solidity
function _updateIndexes(DataTypes.ReserveData storage reserve) internal {
    uint256 newBorrowingIndex = reserve.borrowingIndex;
    uint256 newTotalBorrows = reserve.totalBorrows;

    if (reserve.totalBorrows > 0) {
        newBorrowingIndex = latestBorrowingIndex(reserve);
        newTotalBorrows = newBorrowingIndex * (reserve.totalBorrows) / (reserve.borrowingIndex);
    ...
}

Note that when calculating the newBorrowingIndex, it calls latestBorrowingIndex(reserve), which uses reserve.currentBorrowingRate, which was calculated at the last time the index was updated. However, in the mean time, the borrows have grown, increasing the utilization rate, which has increased the borrowing rate, but the one used was the past one, which is incorrect. To fix this, a better closed formula would be required, simultaneously calculating the new borrows as well as the current utilization rate, which depend on one another.

Root Cause

In ReserveLogic:155/156, new borrows use a stale utilization rate.

Internal Pre-conditions

None.

External Pre-conditions

None.

Attack Path

  1. Users borrow from the lending pool and their interest will be incorrect, smaller than it should be.

Impact

Depending on utilization, the impact can be very significant, however, it is likely to stay relatively constrained due to daily utilization or similar.

PoC

Borrow interest depends on the utilization rate. The utilization rate grows with borrows, so it can not stay constant when calculating the new borrows over time.

Mitigation

Implement a closed formula that calculates the new borrows and utilization rate correctly.

The original report as published on Sherlock, by 0x73696d616f. 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 function calculates the new borrowing index using the borrowing rate from the last update, ignoring that utilization has changed since then.

Impact

Borrowers may pay less interest than they should, with the impact depending on utilization but likely constrained.

What the attacker needed

None

The fix

Implement a closed formula that calculates the new borrows and utilization rate correctly.

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 pool, the interest rate depends on how much of the pool is borrowed (utilization). When calculating new total borrows, the code uses an old interest rate that doesn't reflect recent borrowing, so borrowers are charged too little interest.

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 0x73696d616f

View all

172 more disclosed reports, best first.

More from Yieldoor

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.