Skip to content
Race condition Audit finding Intermediate

Borrower will loose funds if their repay transaction executes after cross-chain liquidation call

The cross-chain liquidation flow seizes collateral before repaying the debt, so if a borrower repays during the interim, the liquidator's repayment fails and the collateral remains seized. This causes the borrower to lose collateral despite having repaid their debt.

jokr Follow with patitonar

Originally disclosed on Sherlock

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

Found by

jokr, patitonar

Summary

In the current cross-chain liquidation flow, the liquidation begins on the destination chain, which sends a CrossChainLiquidationExecute message to the source chain. The source chain seizes the user’s collateral and then sends back a LiquidationSuccess message. Finally, the borrow is repaid using the liquidator’s funds on the destination chain.

However, if the borrower calls repayCrossChainBorrow while the liquidation is in progress (after collateral has been seized but before the final repayment step), the borrow may already be repaid by the user. In this case, the final repayment using the liquidator’s funds will fail, and the LiquidationSuccess message will revert. Despite this, the collateral has already been seized on the source chain ,leading to an unfair loss for the borrower, who repaid their debt but still lost collateral.

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

Root Cause

The cross-chain liquidation process performs the debt repayment in the final step. If a user repays their borrow during the interim (after the collateral is seized but before the repayment), the repayment attempt from the liquidator will revert. Since the collateral has already been seized, this causes an irreversible and unfair loss for the borrower.

Internal Pre-conditions

None.

External Pre-conditions

The borrower's repay transaction must be executed in between the cross-chain liquidation execution and the liquidation success handling.

Attack Path

  1. Alice has a $1,000 USDC cross-chain borrow on the destination chain (e.g., Chain B), and her position is near liquidation threshold.
  2. Alice submits a repayCrossChainBorrow transaction to avoid liquidation. It enters the mempool but has not yet executed.
  3. A liquidator, seeing that the position is liquidatable, sends a cross-chain liquidation transaction with higher gas fees. This executes before Alice’s repayment transaction.
  4. The liquidation flow begins, and the destination chain sends a CrossChainLiquidationExecute message to the source chain (e.g., Chain A).
  5. The source chain seizes $1,000 worth of Alice’s collateral.
  6. Meanwhile, Alice’s repayment transaction executes, successfully repaying her USDC borrow.
  7. The source chain sends a LiquidationSuccess message back to the destination chain.
  8. On the destination chain, the protocol attempts to repay Alice’s borrow using the liquidator’s funds, but this fails since the borrow is already repaid.
  9. The final step reverts, but Alice’s collateral has already been seized — causing a loss even though she paid her debt on time.
  10. The liquidator's repayment is reverted, but the user loses collateral unjustly.

Impact

  • Borrowers can lose their collateral unfairly.

PoC

_No code provided

Mitigation

  • Restructure the liquidation flow to repay the borrow first, before seizing collateral. This ensures that if the liquidator has already repaid the debt, borrower's repay transaction will fail.

The original report as published on Sherlock, by jokr. 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 liquidation process seizes collateral before completing the debt repayment, so a concurrent repayment by the borrower causes the final repayment to revert while the collateral seizure remains.

Impact

Borrowers can lose their collateral unfairly even after repaying their debt.

What the attacker needed

Borrower has a cross-chain borrow near liquidation; borrower's repay transaction executes during liquidation

The fix

The liquidation flow should be restructured to repay the borrow first, before seizing collateral.

How it was found

  1. Alice has a cross-chain borrow near liquidation threshold.
  2. Alice submits a repay transaction that enters the mempool.
  3. A liquidator sends a cross-chain liquidation with higher gas, executing first.
  4. The destination chain sends a CrossChainLiquidationExecute message to the source chain.
  5. The source chain seizes Alice's collateral.
  6. Alice's repayment executes, repaying her borrow.

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 cross-chain loan, a liquidator can start taking a borrower's collateral on one chain while the final repayment happens on another. If the borrower repays in between, the system still keeps the collateral because the repayment step fails, leaving the borrower worse off.

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 by jokr

View all

5 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.

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.