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.
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:
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:
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:
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
- User calls
withdrawToNativeChain(_ETH_ADDRESS_, amount, message)with 0 value - Function skips token collection validation for native ETH
- Platform calculates fee:
platformFeesForTx = (amount * feePercent) / 1000 _handleFeeTransferattempts to transfer fees but calls non-contract address_ETH_ADDRESS_- Low-level call returns success without actual transfer
- 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
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
- User calls withdrawToNativeChain with the native asset address, amount, and message, sending zero value.
- The function skips token collection because the asset is native.
- The platform calculates the fee based on the amount.
- The fee transfer attempts to call the native asset address as if it were an ERC20 token.
- The low-level call returns success without moving any funds.
- 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.