Skip to content
Business logic Audit finding Intermediate

Outdated Exchange Rate Utilization

The supply function uses a stale exchange rate that ignores pending interest, so users receive more lTokens than the contract actually mints. This can cause losses for other users and reduce the underlying assets received when redeeming.

0xc0ffEE Follow with 0xiehnnkta, 0xlrivo and 42 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/628

Found by

0xc0ffEE, 0xiehnnkta, 0xlrivo, Audinarey, BimBamBuki, DharkArtz, Drynooo, ElmInNyc99, GypsyKing18, HeckerTrieuTien, Hueber, Light, Nomadic_bear, TessKimy, Uddercover, Waydou, Ziusz, aman, chaos304, durov, eta, evmninja, francoHacker, future, ggg_ttt_hhh, h2134, harry, jo13, jokr, kelvinclassic11, lazyrams352, molaratai, momentum, newspacexyz, patitonar, rokinot, t.aksoy, udo, wickie, x0rc1ph3r, xiaoming90, yaioxy, ydlee, yoooo, zxriptor

Summary

When users supply tokens, an outdated exchangeRate is utilized. Consequently, users obtain more lTokens than were actually minted, within the contract.

Root Cause

The root cause is the use of an outdated exchange rate that does not account for the current pending interest in the lToken.

https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/CoreRouter.sol#L74

Solidity
    function supply(uint256 _amount, address _token) external {
        address _lToken = lendStorage.underlyingTolToken(_token);

        require(_lToken != address(0), "Unsupported Token");

        require(_amount > 0, "Zero supply amount");

        // Transfer tokens from the user to the contract
        IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);

        _approveToken(_token, _lToken, _amount);

        // Get exchange rate before mint
74:     uint256 exchangeRateBefore = LTokenInterface(_lToken).exchangeRateStored();

        // Mint lTokens
        require(LErc20Interface(_lToken).mint(_amount) == 0, "Mint failed");

        // Calculate actual minted tokens using exchangeRate from before mint
        uint256 mintTokens = (_amount * 1e18) / exchangeRateBefore;

        lendStorage.addUserSuppliedAsset(msg.sender, _lToken);

        lendStorage.distributeSupplierLend(_lToken, msg.sender);

        // Update total investment using calculated mintTokens
        lendStorage.updateTotalInvestment(
            msg.sender, _lToken, lendStorage.totalInvestment(msg.sender, _lToken) + mintTokens
        );

        emit SupplySuccess(msg.sender, _lToken, _amount, mintTokens);
    }

Internal pre-conditions

In the lToken, there is pending interest.

External pre-conditions

N/A

Attack Path

  1. Attacker supplies large amount of underlying.
  2. Attacker withdraws small amount of lToken.
  3. Attacker withdraws all remaining lToken.

PoC

https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LToken.sol#L271-L309

Solidity
    function exchangeRateCurrent() public override nonReentrant returns (uint256) {
        accrueInterest();
        return exchangeRateStored();
    }
    function exchangeRateStored() public view override returns (uint256) {
        return exchangeRateStoredInternal();
    }
    function exchangeRateStoredInternal() internal view virtual returns (uint256) {
        uint256 _totalSupply = totalSupply;
        if (_totalSupply == 0) {
            /*
             * If there are no tokens minted:
             *  exchangeRate = initialExchangeRate
             */
            return initialExchangeRateMantissa;
        } else {
            /*
             * Otherwise:
             *  exchangeRate = (totalCash + totalBorrows - totalReserves) / totalSupply
             */
            uint256 totalCash = getCashPrior();
            uint256 cashPlusBorrowsMinusReserves = totalCash + totalBorrows - totalReserves;
            uint256 exchangeRate = cashPlusBorrowsMinusReserves * expScale / _totalSupply;

            return exchangeRate;
        }
    }

As can be seen, exchangeRateStored does not account for pending interest. Consider the following scenario:

  • Alice supplies 1010 underlying tokens.
  • The exchangeRateStored is 1, with 1% of total assets as interest.
  • At this time, exchangeRateCurrent is 1.01.

Alice should receive 1000 lTokens. However, due to the current implementation, she receives 1010 lTokens, even though the contract only receives 1000 lTokens. This leads to the lToken amount within the contract being less than the total of users' investments.

Additionally, when redeeming, the outdated exchangeRate is also utilized.

Impact

Users can obtain more lTokens than intended when supplying tokens, leading to losses for other users. Users may receive fewer underlying assets when redeeming.

Mitigation

Diff
-74:     uint256 exchangeRateBefore = LTokenInterface(_lToken).exchangeRateStored();
+74:     uint256 exchangeRateBefore = LTokenInterface(_lToken).exchangeRateCurrent();

The original report as published on Sherlock, by 0xc0ffEE. 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

The supply function reads the exchange rate before accruing interest, so it uses a stale value that does not reflect pending interest.

Impact

Users can obtain more lTokens than intended when supplying tokens, leading to losses for other users, and may receive fewer underlying assets when redeeming.

What the attacker needed

Pending interest in the lToken

The fix

The supply function should use the current exchange rate (which accrues interest) instead of the stored one.

How it was found

  1. Attacker supplies a large amount of underlying tokens.
  2. Attacker withdraws a small amount of lTokens.
  3. Attacker withdraws all remaining lTokens.

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 protocol, users deposit tokens and get lTokens in return. The number of lTokens should be based on the current exchange rate, which includes interest earned. Here, the code used an old exchange rate that ignored recent interest, so users got too many lTokens, which can harm others.

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

View all

27 more disclosed reports, best first.

More from LEND

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.