# Aurora Improper Input Sanitization Bugfix Review

Aurora Engine's ft_on_transfer trusted attacker-supplied msg fee field, letting a worthless NEP-141 token transfer drain victim ERC20 funds up to 18.4 ETH per call.

- Payout: $1,000,000
- Severity: critical
- Program: Aurora
- Disclosed: 2022-09-29
- Write-up quality: 7/10
- Original: https://immunefi.com/blog/bug-fix-reviews/aurora-improper-input-sanitization-bugfix-review/
- Library page: https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-aurora-improper-input-sanitization-bugfix-review
- Tags: domain:web3 impact:funds-loss kind:bounty platform:blog platform:immunefi sev:critical tech:rust tech:solidity technique:chained technique:source-review vuln:access-control vuln:business-logic

**Target:** Aurora Engine NEAR smart contract ft_on_transfer / receive_erc20_tokens
**Root cause:** receive_erc20_tokens parses a fee from the attacker-controlled msg field and transfers it from the recipient to the relayer without validating that the fee is legitimate or bounded by the transferred token value.
**Steps:**
1. Create a NEP-141->ERC20 token mapping (permissionless).
2. Call ft_on_transfer on Aurora Engine with the worthless NEP-141 token, msg = victim 40-hex address + 64-hex fee set to U64_MAX.
3. signer_account_id() resolves to attacker's NEAR account, making attacker the relayer.
4. Engine transfers fee from victim's ERC20 balance to attacker's relayer address, then mints equivalent ERC20 to recipient.
**How found:** Reviewer noticed args (including msg) is fully attacker-controlled and that fee is parsed from msg then used directly in a transfer from recipient to relayer without validation.
**Exploitation:** Attacker registers a worthless NEP-141 token, transfers it to a victim with msg encoding the victim address and U64_MAX fee; the engine debits the victim's ERC20 balance to the attacker (relayer) at up to 18.4 ETH per invocation, repeatable to drain funds.
**Escalation:** Repeatable per invocation at ~18.4 ETH each, enabling full drain of victim balances.
**Insight:** In cross-chain bridge token handlers, audit every field parsed from the user-supplied msg blob and check whether any value (fee, relayer, recipient) is used to move funds from a party other than the caller.
