# Incorrect amount of zrc20 approved in GatewayTransferNative causing loss of fund and DOS

GatewayTransferNative over-approves outputAmount+gasFee to GatewayZEVM, leaving residual gasFee allowance an attacker can spend via withdraw(), draining contract ETH and blocking refunds.

- Payout: Audit contest
- Severity: medium
- Program: Dodo Cross Chain Dex
- Found by: Cybrid
- Disclosed: 2025-05-29
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-05-dodo-cross-chain-dex-judging/issues/230
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AM-1
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm technique:source-review vuln:business-logic vuln:dos

**Target:** GatewayTransferNative / GatewayZEVM cross-chain withdraw contract
**Root cause:** _handleEvmOrSolanaWithdraw approves outputAmount+gasFee to GatewayZEVM but only outputAmount is actually consumed, leaving a residual gasFee allowance.
**Steps:**
1. User calls `withdrawToNativeChain(ETH,1000e18,message)`; fee taken, outputAmount=995 ETH.
2. `_handleEvmOrSolanaWithdraw` approves `outputAmount+gasFee` to GatewayZEVM but sets amountsOutTarget to `outputAmount-gasFee`.
3. After tx, `ETH.allowance(GatewayTransferNative,GatewayZEVM)` remains `gasFee`.
4. Wait for gasPrice to drop to gasPrice1; attacker sets `amount=(gasPrice-gasPrice1)*gasLimit`.
5. Attacker calls `GatewayTransferNative::withdraw()` with outputToken ETH and that amount.
6. GatewayZEVM charges gasFee1 plus amount, consuming the residual allowance to zero.
**How found:** Code reading of approve amount vs actual consumed amount in _handleEvmOrSolanaWithdraw, spotting mismatch between approved outputAmount+gasFee and used outputAmount-gasFee+gasFee.
**Exploitation:** Attacker waits for gas price decrease, then calls withdraw() with an amount sized to consume the leftover allowance, forcing GatewayTransferNative to pay gasFee in ETH while attacker only spends negligible ZETA gas.
**Escalation:** Repeated across cross-chain calls; drained balance also starves refund pool causing DOS for honest refund claimants.
**Insight:** Compare ERC20 approve amounts against what the downstream contract actually pulls; any residual allowance on a contract holding refund balances is a spendable budget for anyone who can trigger the spender.

