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.
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.
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
- Alice has a $1,000 USDC cross-chain borrow on the destination chain (e.g., Chain B), and her position is near liquidation threshold.
- Alice submits a
repayCrossChainBorrowtransaction to avoid liquidation. It enters the mempool but has not yet executed. - 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.
- The liquidation flow begins, and the destination chain sends a
CrossChainLiquidationExecutemessage to the source chain (e.g., Chain A). - The source chain seizes $1,000 worth of Alice’s collateral.
- Meanwhile, Alice’s repayment transaction executes, successfully repaying her USDC borrow.
- The source chain sends a
LiquidationSuccessmessage back to the destination chain. - 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.
- The final step reverts, but Alice’s collateral has already been seized — causing a loss even though she paid her debt on time.
- 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.
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
- Alice has a cross-chain borrow near liquidation threshold.
- Alice submits a repay transaction that enters the mempool.
- A liquidator sends a cross-chain liquidation with higher gas, executing first.
- The destination chain sends a CrossChainLiquidationExecute message to the source chain.
- The source chain seizes Alice's collateral.
- 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.