`GlobalVariables::oftOrCollateralReceiveFromOtherChains()` always charges twice the collateral on `COLLATERAL_TRANSFER`, which is not needed
The function that forwards cross-chain messages always charges fees for two collateral token transfers plus ETH, even when only ETH needs to be sent. This overcharges users, causing repeated fee losses during events such as liquidations.
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/798
Found by
0x73696d616f
Summary
GlobalVariables::oftOrCollateralReceiveFromOtherChains() frequently occurs losses by forwarding too much ETH as it assumes collateral transfer always happen for the 2 tokens + eth, which is not true as it can just be ETH and it skips collateral transfers when the amount is null. This will happen on liquidations for example as the collateral my just be ETH and it needs to fetch ETH from the other chain, so the other chain will only send ETH and the 2 other collateral transfers can be skipped. However, they will still be payed here, taking the user the loss.
Root Cause
In GlobalVariables.sol:290/300, collateral transfers are always charged even if amounts to send are null.
Internal pre-conditions
None.
External pre-conditions
None.
Attack Path
- Borrower is liquidated and had deposited ETH.
- Chain does not have enough ETH and requests from other chain. It pays for 2 extra collateral transfers.
- Other chain sends ETH and will have leftover native.
Impact
Losses keep being accrued as it overcharges fees.
PoC
See links above.
Mitigation
Check if the amount is null and only charge fees for both collateral tokens if the amount is non null.
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
Impact
Users are overcharged fees, and these losses keep accruing over time.
What the attacker needed
A liquidation involving ETH collateral; cross-chain ETH request
The fix
The code should check whether each collateral amount is null and only charge fees for collateral tokens whose amount is non-null.
How it was found
- A borrower who deposited ETH is liquidated.
- The chain lacks enough ETH and requests ETH from another chain.
- The request pays for two extra collateral transfers that are not needed.
- The other chain sends only ETH, leaving leftover native funds.
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 one blockchain needs to send a message to another, it pays a fee for each thing being transferred. This code always pays for three transfers (two tokens and ETH) even when only ETH is actually sent, so the user is charged more than necessary.
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.