Skip to content
Race condition Audit finding Intermediate

Multiple Cross-Chain borrows using same collateral

The borrowCrossChain function does not lock collateral before sending a cross-chain borrow request, so a user can submit multiple borrow requests on different chains using the same collateral. This allows the user to borrow more than the collateral's capacity and default, causing a loss to the protocol.

0xDgiin Follow with 0xEkko, 0xbakeng and 14 others

Originally disclosed on Sherlock

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

Found by

0xDgiin, 0xEkko, 0xbakeng, 0xgee, 4n0nx, Aenovir, PNS, Tychai0s, dystopia, future, gkrastenov, lazyrams352, patitonar, pv, realsungs, theweb3mechanic, xiaoming90

Summary

The failure to lock collateral in borrowCrossChain before sending cross-chain borrow requests via LayerZero V2 enables users to initiate multiple borrow requests on different chains (e.g., Chain B and Chain C) using the same collateral on Chain A, resulting in loans exceeding the collateral’s capacity and significant protocol loss.

Root Cause

In CrossChainRouter.sol within the borrowCrossChain function, the collateral amount is calculated but not locked in lendStorage before sending a borrow request via _lzSend. The collateral is only registered in _handleValidBorrowRequest after receiving confirmation from the destination chain, allowing multiple requests to use the same collateral concurrently.

CrossChainRouter.borrowCrossChain

Internal Pre-conditions

  1. The user needs to have sufficient collateral on Chain A (e.g., $1000 USDC in an lToken pool).
  2. The protocol needs to support cross-chain borrowing on at least two destination chains (e.g., Chain B and Chain C).
  3. The lToken pools on destination chains need to have sufficient liquidity to process borrow requests.
  4. The collateral factor (e.g., 75%) needs to allow significant borrowing relative to the collateral.

External Pre-conditions

  1. The underlying token prices (e.g., USDC) need to remain stable to ensure consistent collateral and borrow valuations.
  2. The LayerZero V2 network needs to process messages with minimal delay to allow rapid request submission.

Attack Path

  1. A user with 1000 USDC collateral on Chain A calls borrowCrossChain twice in the same block:
    • Request 1: Borrow 750 USDC on Chain B.
    • Request 2: Borrow 750 USDC on Chain C.
  2. Both requests use getHypotheticalAccountLiquidityCollateral, which reports 1000 USDC collateral, as no borrow is yet registered.
  3. Chain B receives the request, verifies payload.collateral (1000 USDC) >= 750 USDC, and executes borrowForCrossChain, transferring 750 USDC to the user.
  4. Chain C does the same, transferring another 750 USDC.
  5. Both chains send ValidBorrowRequest messages back to Chain A, which registers two borrows totaling 1500 USDC in _handleValidBorrowRequest.
  6. User does not repay the debt and sacrifices the collateral, leaving with $500 in profit.

Impact

The protocol suffers a significant financial loss by granting loans exceeding the collateral’s capacity (e.g., $750 loss for 1500 USDC borrowed against 1000 USDC collateral). The issue scales with the number of chains, potentially leading to catastrophic losses (e.g., 7500 USDC for 10 chains).

PoC

The issue can be demonstrated as follows:

  • Deploy Lend-V2 on three chains: Chain A (collateral), Chain B, and Chain C (borrowing). A user supplies 1000 USDC collateral on Chain A in an lToken pool with a 75% collateral factor.
  • The user calls borrowCrossChain twice in one block:
    • Chain B: 750 USDC borrow.
    • Chain C: 750 USDC borrow.
  • getHypotheticalAccountLiquidityCollateral returns 1000 USDC collateral for both requests, as no borrow is registered.
  • Chain B verifies payload.collateral (1000 USDC) >= 750 USDC, executes borrowForCrossChain, and transfers 750 USDC.
  • Chain C does the same, transferring 750 USDC.
  • Chain A receives ValidBorrowRequest messages, registering 1500 USDC total borrow.
  • For a $10,000 collateral, the loss is $7500 across two chains (75% loss).

Mitigation

Lock the collateral in lendStorage before sending the borrow request in borrowCrossChain by tracking pending borrow requests and deducting their collateral impact. Use a nonce-based lock to prevent concurrent requests for the same collateral. In _handleValidBorrowRequest, clear the pending borrow lock after registering the borrow. Add a check in borrowCrossChain to prevent new requests if a pending borrow exists for the same user and collateral.

The original report as published on Sherlock, by 0xDgiin. 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 collateral is not locked or reserved in storage before sending the cross-chain borrow request; it is only registered after the destination chain confirms, allowing concurrent requests to use the same collateral.

Impact

The protocol could suffer a significant financial loss by granting loans exceeding the collateral's capacity, with the loss scaling with the number of supported chains.

What the attacker needed

Sufficient collateral on source chain; cross-chain borrowing on at least two chains; destination pools have liquidity; stable token prices

The fix

The collateral should be locked in storage before sending the borrow request, tracking pending borrows and preventing new requests for the same collateral until the pending one is resolved.

How it was found

  1. User supplies 1000 USDC collateral on Chain A.
  2. User calls borrowCrossChain twice in the same block: once for 750 USDC on Chain B and once for 750 USDC on Chain C.
  3. Both requests see the full 1000 USDC collateral because no borrow is registered yet.
  4. Chain B and Chain C each verify the collateral and transfer 750 USDC to the user.
  5. Chain A receives confirmation messages and registers two borrows totalling 1500 USDC.
  6. User does not repay and sacrifices the collateral, leaving with a profit.

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.

When you borrow money using collateral, the system should set aside that collateral so you cannot use it again for another loan. Here, the system only checks the collateral but does not reserve it until later, so a user can quickly ask for loans on several chains at once, each thinking the full collateral is available. The user then takes the money and never repays, leaving the protocol with a loss.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More from LEND

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.