In the Liquidation Type 1 process, Ether refunds are being sent to an incorrect recipient address
In the Liquidation Type 1 process, when no cross-chain amount is needed, the Ether refund is sent to the borrower instead of the admin who acted as liquidator. This causes the admin to lose funds that should have been refunded to them.
Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/998
Found by
0x23r0, 0xAristos, Audinarey, AuditorPraise, Aymen0909, DenTonylifer, Flashloan44, John44, LZ_security, Ocean_Sky, RampageAudit, nuthan2x, santiellena, super_jack, t.aksoy, theweb3mechanic, valuevalk, volodya, wellbyt3
Summary
In the Liquidation Type 1 process, Ether refunds are being sent to an incorrect recipient address. Specifically, refunds should be directed to the admin user, who acts as the liquidation operator and is the legitimate recipient. However, the current implementation mistakenly sends the refund to the borrower’s address.
File: borrowLiquidation.sol
302: if (liqAmountToGetFromOtherChain == 0) {
303: (bool sent, ) = payable(user).call{value: msg.value}(""); //@note wrong address
304: require(sent, "Failed to send Ether");
305: }
Root Cause
When liqAmountToGetFromOtherChain is zero or cross-chain operations are unnecessary, the Ether refund is incorrectly sent to the borrower’s address instead of the admin’s address. This misdirection can result in the admin losing funds that should rightfully be refunded to them.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
Here is the scenario
- Execution of Liquidation Type 1: A loan is liquidated using Liquidation Type 1.
- Zero Cross-Chain Amount: In this liquidation, liqAmountToGetFromOtherChain is zero, indicating that no Ether is needed for cross-chain operations.
- Refund Process: Ether is intended to be refunded to the liquidator, which is the admin.
- Incorrect Recipient Address: Due to a flaw in the code, the refund is mistakenly sent to the borrower’s address instead of the admin’s address.
- Loss of Funds: As a result, the admin loses the funds that should have been refunded.
Impact
The admin, who is responsible for executing the Liquidation Type 1 process, loses Ether refunds that should be rightfully sent to them.
PoC
see attack path
Mitigation
Update the recipient address in the refund logic to the admin’s address.
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 refund logic uses the borrower's address instead of the admin's address when the cross-chain amount is zero.
Impact
The admin loses Ether refunds that should have been returned to them.
What the attacker needed
Liquidation Type 1 is executed; Cross-chain amount is zero
The fix
The refund recipient should be changed to the admin's address.
How it was found
- A loan is liquidated using Liquidation Type 1.
- The cross-chain amount needed is zero.
- The contract attempts to refund Ether to the liquidator (admin).
- The refund is sent to the borrower's address instead.
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 a loan is liquidated, the person running the liquidation (the admin) may send extra Ether that should be returned to them. A mistake in the code sends that leftover Ether to the borrower instead, so the admin loses money that was meant to come back.
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.