An attacker will steal value from cross-chain swaps by manipulating liquidity used in `_swapAndSendERC20Tokens()`
The contract uses UniswapV2Library.getAmountsIn() to estimate token amounts for gas fees without checking for liquidity manipulation. An attacker can front-run a cross-chain user operation, manipulate pool reserves (e.g., via flashloan), causing the contract to miscalculate and overpay, allowing the attacker to extract value or cause a denial of service.
Source: https://github.com/sherlock-audit/2025-05-dodo-cross-chain-dex-judging/issues/937
This issue has been acknowledged by the team but won't be fixed at this time.
Found by
0xc0ffEE, 0xpetern, 4b, Bizarro, Constant, Cybrid, EgisSecurity, Goran, JuggerNaut, Mimis, Ob, Petrus, ZeroTrust, bladeee, cccz, dhank, fromeo_016, iamandreiski, richa, sheep, silver_eth, the_haritz, upWay, x0lohaclohell
Summary
The reliance on spot reserves from UniswapV2Library.getAmountsIn() will cause a loss of value for cross-chain users as an attacker will manipulate liquidity pools to skew price quotes and steal excess input tokens.
Root Cause
In gatewayCrossChaine.sol:_swapAndSendERC20Tokens(), the contract uses UniswapV2Library.getAmountsIn() to estimate how many targetZRC20 tokens are needed to obtain gasFee in gasZRC20. This quote is then used to swap tokens without checking for liquidity manipulation, allowing attackers to front-run the contract and change pool pricing.
Internal Pre-conditions
.
External Pre-conditions
.
Attack Path
- Attacker identifies a low-liquidity or custom pool for a token pair used in
getPathForTokens(). - Attacker front-runs a cross-chain user operation, sending a transaction that manipulates the reserves in the pool (e.g via a flashloan ).
- The contract executes
_swapAndSendERC20Tokens()using skewed reserves fromgetAmountsIn(), miscalculating the required amount. - As a result, the attacker receives an overpayment or manipulates swap slippage to extract value.
- After the swap completes, the attacker reverts the pool to its original state and profits from the imbalance.
Impact
The cross-chain user suffers a loss in targetZRC20 tokens, which are overpaid due to manipulated pricing.
The attacker gains the difference between the quoted and fair amount or causes a denial of service by making the swap fail (griefing).
PoC
No response
Mitigation
Enforce a hard slippage limit
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 contract relies on spot reserves from UniswapV2Library.getAmountsIn() without checking for liquidity manipulation or enforcing a slippage limit.
Impact
The cross-chain user could suffer a loss in targetZRC20 tokens due to overpayment from manipulated pricing, and the attacker could gain the difference or cause a denial of service by making the swap fail.
What the attacker needed
Low-liquidity or custom pool; attacker can front-run transaction; attacker can manipulate pool reserves
The fix
Enforce a hard slippage limit.
How it was found
- Attacker identifies a low-liquidity or custom pool for a token pair used in getPathForTokens().
- Attacker front-runs a cross-chain user operation, sending a transaction that manipulates the reserves in the pool (e.g via a flashloan).
- The contract executes _swapAndSendERC20Tokens() using skewed reserves from getAmountsIn(), miscalculating the required amount.
- As a result, the attacker receives an overpayment or manipulates swap slippage to extract value.
- After the swap completes, the attacker reverts the pool to its original state and profits from the imbalance.
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.
This report describes a flaw in a cross-chain swap contract that uses a price quote from a liquidity pool without protection against price manipulation. An attacker can temporarily change the pool's reserves (for example, by taking a flash loan) right before a user's transaction, causing the contract to pay more tokens than necessary. The attacker then profits from the difference, while the user loses funds.
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.