Skip to content
Business logic Audit finding Intermediate

GatewayTransferNative does not collect platform fee when native asset is bridged

The withdrawToNativeChain function in GatewayTransferNative fails to collect platform fees when bridging native assets because it uses an ERC20 transfer helper on a non-contract address. An attacker can bridge native assets without paying the platform fee, causing revenue loss for the protocol.

0xc0ffEE Follow with Goran, IvanFitro and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-05-dodo-cross-chain-dex-judging/issues/700

Found by

0xc0ffEE, Goran, IvanFitro, SarveshLimaye

Summary

The withdrawToNativeChain function of GatewayTransferNative fails to collect platform fees when users bridge native asset. While the function is designed to accept native asset payments through its payable modifier, the fee collection mechanism silently fails due to a low-level call to a non-contract address. This allows users to bridge native asset while completely bypassing the platform's fee collection, resulting in lost revenue for the protocol.

Root Cause

User will provide _ETH_ADDRESS_ as zrc20 param in withdrawToNativeChain function when bridging native asset. Then, internal function _handleFeeTransfer is called:

Solidity
   function withdrawToNativeChain(address zrc20, uint256 amount, bytes calldata message) external payable {
        if (zrc20 != _ETH_ADDRESS_) {
            require(
                IZRC20(zrc20).transferFrom(msg.sender, address(this), amount),
                "INSUFFICIENT ALLOWANCE: TRANSFER FROM FAILED"
            );
        }

       // ...

        // Transfer platform fees
        uint256 platformFeesForTx = _handleFeeTransfer(zrc20, amount); // platformFee = 5 <> 0.5%
        amount -= platformFeesForTx;

There, transfer helper is used to collect fees:

Solidity
    function _handleFeeTransfer(address zrc20, uint256 amount) internal returns (uint256 platformFeesForTx) {
        platformFeesForTx = (amount * feePercent) / 1000; // platformFee = 5 <> 0.5%
        TransferHelper.safeTransfer(zrc20, EddyTreasurySafe, platformFeesForTx);
    }

That's where the problem lies - since asset is native asset and not erc20 token, direct ETH transfer methods should be used instead of erc20-transfer:

Solidity
    function safeTransfer(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
    }

What happens instead is that low level call 'transfer(address,uint256)' is executed on address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE). Since there's no code at the address, call will be successful even though no funds were moved. TX execution normally proceeds while protocol collected 0 fees.

Internal Pre-conditions

None

External Pre-conditions

User initiates a native asset bridge transaction by calling withdrawToNativeChain with zrc20 = _ETH_ADDRESS_

Attack Path

  1. User calls withdrawToNativeChain(_ETH_ADDRESS_, amount, message) with 0 value
  2. Function skips token collection validation for native ETH
  3. Platform calculates fee: platformFeesForTx = (amount * feePercent) / 1000
  4. _handleFeeTransfer attempts to transfer fees but calls non-contract address _ETH_ADDRESS_
  5. Low-level call returns success without actual transfer
  6. Bridge proceeds with zero fees collected

Result: User bridges native asset, but protocol receives no revenue

Impact

Medium severity - revenue loss for the protocol

PoC

No response

Mitigation

Implement proper native asset fee collection

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/Skyewwww/omni-chain-contracts/pull/28

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

Root cause

The fee collection uses an ERC20 transfer helper on the native asset address, which is not a contract, so the low-level call succeeds without transferring funds.

Impact

The protocol loses fee revenue when users bridge native assets, as the fee is never collected.

What the attacker needed

User initiates a native asset bridge

The fix

The protocol team fixed this issue in a pull request.

How it was found

  1. User calls withdrawToNativeChain with the native asset address, amount, and message, sending zero value.
  2. The function skips token collection because the asset is native.
  3. The platform calculates the fee based on the amount.
  4. The fee transfer attempts to call the native asset address as if it were an ERC20 token.
  5. The low-level call returns success without moving any funds.
  6. The bridge proceeds and the protocol collects no fee.

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 you bridge a native asset like ETH, the contract is supposed to take a small fee. But it tries to take the fee using a method meant for tokens, not for ETH, and because the address it calls has no code, the call succeeds without moving any money. So users can bridge ETH without paying the fee.

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 0xc0ffEE

View all

27 more disclosed reports, best first.

More from DODO Cross-Chain DEX

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.