Skip to content
Business logic Audit finding Intermediate

`GlobalVariables::oftOrCollateralReceiveFromOtherChains()` calculates the fee as if it was the same in both chains, which is false

The fee calculation in a cross-chain receive function assumed the transfer direction was from the current chain to the destination, when the actual direction is the reverse. This could cause the fee to be overcharged or undercharged, leading to reverts on the destination chain.

0x73696d616f Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-11-autonomint-judging/issues/795

Found by

0x73696d616f

Summary

GlobalVariables::oftOrCollateralReceiveFromOtherChains() send a message to the other chain requesting token/eth transfers to the current chain. In the process, it forwards ETH to pay for the cross chain transfer from the destination to the current chain. However, it calculates the fee as if the direction was current to destination, when in reality it is the opposite and the fee will be different. Thus, it will either overchage or revert in the destination chain.

Root Cause

In GlobalVariables::oftOrCollateralReceiveFromOtherChains() fee is calculated as if the direction is current to destination, when it is the opposite.

Internal pre-conditions

None.

External pre-conditions

None.

Attack Path

  1. GlobalVariables::oftOrCollateralReceiveFromOtherChains() is called, but the fee is incorrectly calculated.

Impact

Overcharging of the fee or charging too little, which will lead to reverts on the destination chain.

PoC

See links.

Mitigation

Add a variable admin set to track the costs.

The original report as published on Sherlock, by 0x73696d616f. 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

Impact

The fee could be overcharged or undercharged, which could cause the transfer to revert on the destination chain.

What the attacker needed

None

The fix

The report suggests adding an admin-set variable to track the costs, so the correct fee for each direction is used.

How it was found

  1. Call the cross-chain receive function, which forwards ETH to pay for the transfer back to the current chain.
  2. Observe that the fee was calculated for the wrong direction, so the amount is incorrect.

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 sends a message to another, a fee is paid to cover the cost of the transfer. The fee depends on which direction the transfer goes, because each chain has its own pricing. Here the code used the wrong direction when estimating the fee, so the amount sent was wrong and the transfer could fail on the other side.

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.

More by 0x73696d616f

View all

172 more disclosed reports, best first.

More from Autonomint Colored Dollar V1

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.