User can redeem collateral immediately after initiating the borrow, leading undercollateralization
A cross-chain borrow is recorded on the destination chain only after a message is delivered, but the source chain does not lock the user's collateral while that message is pending. The user can redeem collateral immediately after starting the borrow, so the position becomes undercollateralised once the borrow completes, and the text claims this can be repeated to drain the pool.
Source: https://github.com/sherlock-audit/2025-05-lend-audit-contest-judging/issues/909
Found by
0xhp9, 1337web3, Constant, Fade, Hueber, Kirkeelee, Leaningone, befree3x, chaos304, coin2own, future, hgrano, jokr, owanemi, t.aksoy, xiaoming90, zacwilliamson
Summary
When a user initiates a cross-chain borrow, during a pending cross-chain borrow operation, the user redeems their collateral immediately after initiating the borrow, which could result in undercollateralization once the borrow is completed on the destination chain.
Root Cause
- function borrowCrossChain() in CrossChainRouter.sol : https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/CrossChainRouter.sol#L113C5-L154
- function redeem() in CoreRouter.sol: https://github.com/sherlock-audit/2025-05-lend-audit-contest/blob/main/Lend-V2/src/LayerZero/CoreRouter.sol#L100-L138
In CrossChainRouter.borrowCrossChain(), after adding collateral tracking on the source chain, it sends a cross-chain message. The collateral is added to storage via lendStorage.addUserSuppliedAsset, but no locking mechanism is applied to restrict access to it. After this function is called, the user can still interact with their collateral, like calling redeem() on the source chain.
function borrowCrossChain(uint256 _amount, address _borrowToken, uint32 _destEid) external payable {
// validations
// Then adding collateral tracking on source chain
lendStorage.addUserSuppliedAsset(msg.sender, _lToken);
if (!isMarketEntered(msg.sender, _lToken)) {
enterMarkets(_lToken);
}
// get collateral
// Get current collateral amount for the LayerZero message
// This will be used on dest chain to check if sufficient
(, uint256 collateral) =
lendStorage.getHypotheticalAccountLiquidityCollateral(msg.sender,LToken(_lToken), 0, 0);
// @audit: Send BorrowCrossChain message without setting any lock
Send message to destination chain with verified sender
_send(
_destEid,
_amount,
0,
collateral,
msg.sender,
destLToken,
address(0),
_borrowToken,
ContractType.BorrowCrossChain
);
}
The CoreRouter.redeem function allows the user to redeem their supplied tokens if they have sufficient balance and liquidity
function redeem(uint256 _amount, address payable _lToken) external returns (uint256) {
//Checks
require(lendStorage.totalInvestment(msg.sender, _lToken) >= _amount, "Insufficient balance");
// Check liquidity
(uint256 borrowed, uint256 collateral) =
lendStorage.getHypotheticalAccountLiquidityCollateral(msg.sender, LToken(_lToken), _amount, 0);
require(collateral >= borrowed, "Insufficient liquidity");
// proceeds to redeem
}
Issue arises: The liquidity check in lendStorage.getHypotheticalAccountLiquidityCollateral only considers existing borrows. It might not account for the pending cross-chain borrow (the new borrow has not been recorded yet, pending the message to the destination chain). Before the LZ message is finalized, when redeeming, the user still has sufficient liquidity to redeem part of their collateral, so the redemption still passes.
Internal Pre-conditions
N/A
External Pre-conditions
N/A
Attack Path
- User supplies collateral on Chain A in contract CoreRouter.sol and calls borrowCrossChain() in CrossChainRouter.sol to borrow on Chain B - sending LZ message.
- The user calls redeem() immediately on Chain A in contract CoreRouter.sol to redeem part of their collateral.
- The liquidity check in redeem() passes because the pending borrow is not yet reflected in the borrow balance.
- LZ message finalized on Chain B, the position on Chain A becomes undercollateralized - The user can borrow without enough collateral.
- The user can repeat this process to drain the pool.
Impact
Users can borrow on other chains without having enough collateral on the source chain. The user can repeat this process to drain the pool.
PoC
N/A
Mitigation
Add a flag in lendStorage to lock collateral when a cross-chain borrow is initiated.
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 cross-chain borrow path adds collateral tracking and sends the message without locking the collateral, and the redeem liquidity check only counts already-recorded borrows, not the pending one.
Impact
A user could borrow on another chain without enough collateral on the source chain, and the text claims repeating this could drain the pool.
What the attacker needed
Supplied collateral on the source chain; cross-chain borrow support enabled
The fix
Collateral should be locked in storage when a cross-chain borrow is initiated, so it cannot be redeemed while the message is pending.
How it was found
- Supply collateral on the source chain and call borrowCrossChain to borrow on the destination chain, sending the cross-chain message.
- Immediately call redeem on the source chain to withdraw part of the collateral.
- The redeem liquidity check passes because the pending borrow is not yet counted.
- When the message is finalised on the destination chain, the source position is undercollateralised.
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.
A lending pool lets you borrow only if you have put up enough collateral, meaning assets held as a guarantee. Here the borrow happens on another chain, so the pool waits for a message before recording the debt, and during that wait it still lets you take your collateral back. You end up owing money with too little backing it.
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.