# Unauthorized Claim of Non-EVM Chain Refunds in `claimRefund` Function

claimRefund defaults receiver to msg.sender for non-20-byte wallet addresses, so anyone can steal refunds meant for Bitcoin/Solana users.

- Payout: Audit contest
- Severity: high
- Program: Dodo Cross Chain Dex
- Found by: 0xAura
- Disclosed: 2025-05-29
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2025-05-dodo-cross-chain-dex-judging/issues/873
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AH-5
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:chained technique:source-review vuln:access-control vuln:business-logic

**Target:** GatewayCrossChain.sol / GatewayTransferNative.sol claimRefund
**Root cause:** When refundInfo.walletAddress.length != 20, receiver stays msg.sender, so require(bots[msg.sender] || msg.sender == receiver) trivially passes for any caller.
**Steps:**
1. Trigger onAbort with revertMessage = externalId + non-EVM address (e.g. 42-byte Bitcoin address) to create refundInfo
2. Observe walletAddress.length != 20 so receiver = msg.sender
3. Call `claimRefund(externalId)` from any address; require passes
4. Contract transfers refund tokens to attacker and deletes refund record
**How found:** Code reading of claimRefund: noticed receiver defaults to msg.sender and only overwritten when walletAddress.length == 20, making the auth check tautological for non-EVM addresses.
**Exploitation:** Attacker monitors EddyCrossChainRefund events, filters non-EVM refunds, front-runs the legitimate bot with higher gas calling claimRefund(externalId), receiving the refund tokens directly.
**Insight:** When an auth check compares msg.sender to a variable that defaults to msg.sender, look for branches where the variable is never reassigned—length-gated address parsing is a common trigger.

