False “pool exists” detection via `balanceOf()` leads to broken swap paths
The pool existence check in two gateway contracts infers a UniswapV2 pair exists by reading token balances at the computed pair address, without verifying deployed code or reserves. An attacker can send small token amounts to that address so the check returns true, causing swap path selection to use a non-existent pool and transactions to revert.
Source: https://github.com/sherlock-audit/2025-05-dodo-cross-chain-dex-judging/issues/856
This issue has been acknowledged by the team but won't be fixed at this time.
Found by
0xEkko, 1337, AnomX, Cybrid, EgisSecurity, Ob, ZeroTrust, hy, mahdiRostami, peppef, roadToWatsonN101, rsam_eth, silver_eth, the_haritz
Summary
The function _existsPairPool() in GatewayCrossChain.sol and GatewayTransferNative.sol uses ERC20.balanceOf() at a computed UniswapV2 pair address to infer pool existence. Because any address can hold tokens—even without a deployed pair contract—this check produces false positives. Consequently, getPathForTokens() may return a direct token–token path that does not actually exist, triggering downstream transaction reverts and denial of service.
Root Cause
In both contracts, _existsPairPool() is implemented as follows: https://github.com/sherlock-audit/2025-05-dodo-cross-chain-dex/blob/main/omni-chain-contracts/contracts/GatewayCrossChain.sol#L207-L220
This logic never verifies that pool has deployed contract code, nor does it read real reserves via getReserves(). It thus treats any stray token balances at that address as liquidity.
Internal Pre-conditions
-
A call to
getPathForTokens(tokenA, tokenB)is made. -
_existsPairPool()returnstruebecause the computed address holds non-zero balances of both tokens. -
The actual UniswapV2 pair contract was never deployed at that address.
External Pre-conditions
-
An EOA or arbitrary contract receives
tokenAandtokenBtransfers at the computed pool address. -
The true UniswapV2 factory has not created a pair for
(tokenA, tokenB).
Attack Path
-
Attacker transfers small amounts of
tokenAandtokenBto the computed pair address (no contract deployed). -
User or protocol calls
getPathForTokens(tokenA, tokenB).
3. _existsPairPool() returns true (false positive).
-
getPathForTokens()returns[tokenA, tokenB]instead of fallback path. -
Downstream swap via UniswapV2 router (e.g.,
swapExactTokensForTokens) attempts to interact with a non-existent pool contract. -
Transaction reverts, causing denial of service.
Impact
-
Denial of Service: Legitimate swaps between
tokenAandtokenBcannot execute. -
Broken UX: Cross-chain transfers or swaps fail unexpectedly whenever a fake “liquidity” address is used.
PoC
No response
Mitigation
No response
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 existence check relies only on token balances at the computed pair address and never verifies that contract code is deployed there or reads actual reserves.
Impact
Legitimate swaps between the affected tokens cannot execute and cross-chain transfers or swaps fail unexpectedly, causing denial of service and broken user experience.
What the attacker needed
Attacker can transfer tokens to any address; no real UniswapV2 pair exists for the token pair; a user or protocol triggers path selection
The fix
The check should verify that the computed pair address has deployed contract code and read real reserves rather than relying on token balances; the team acknowledged the issue but stated it will not be fixed at this time.
How it was found
- Attacker transfers small amounts of two tokens to the computed pair address where no contract is deployed.
- A user or the protocol calls the path-finding function for those two tokens.
- The existence check returns true because the address holds token balances.
- The path finder returns a direct token-to-token path instead of a fallback path.
- A downstream swap through the UniswapV2 router tries to interact with the non-existent pool and reverts.
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.
A smart contract tried to guess whether a trading pool existed by checking if that pool's address held any tokens. But anyone can send tokens to any address, even one with no contract behind it, so the guess could be fooled. When fooled, the contract picked a trading route that did not really exist and the trade failed.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.