# initialBalance for native token is wrong

Slingshot's executeTrades reads initialBalance from the wrong token (native ETH vs wrapped ETH) when swapping to ETH, letting anyone skew finalOutputAmount by donating ETH to the executioner.

- Payout: Audit contest
- Severity: medium
- Program: Slingshot Finance
- Found by: WatchPug
- Disclosed: 2021-11-17
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2021-10-slingshot#m-01
- Library page: https://bugbountylibrary.com/r/c4%3A2021-10-slingshot%3AM-01
- Tags: area:web3 domain:web3 impact:dos impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:dos

**Target:** Slingshot.sol executeTrades / _getTokenBalance on-chain router contract
**Root cause:** When toToken is the native token, finalBalance is read from wrappedNativeToken balance but initialBalance is read from the executioner's raw ETH balance via _getTokenBalance, so the two sides of the subtraction measure different assets.
**Steps:**
1. Attacker sends 0.25 ETH directly to the executioner contract, inflating its native balance.
2. Alice calls `executeTrades(fromToken=USDC, toToken=nativeToken, fromAmount=5000e6, trades, finalAmountMin=1e18, depricated)` expecting 1.25 ETH.
3. initialBalance = executioner.balance (includes attacker's 0.25 ETH); finalBalance = wrappedNativeToken.balanceOf(executioner).
4. finalOutputAmount = finalBalance - initialBalance is understated by 0.25 ETH, so Alice receives only 1 ETH.
5. Bob's smaller swap fails the `finalAmountMin` check entirely, causing DoS.
**How found:** Code review of executeTrades: noticed initialBalance uses _getTokenBalance(toToken) while finalBalance special-cases nativeToken to read wrappedNativeToken, an asymmetry between the two balance reads.
**Exploitation:** Any address can pre-fund the executioner with ETH to shift the initialBalance baseline; every subsequent native-token swap computes a reduced finalOutputAmount, silently shortchanging users or reverting their swaps when finalAmountMin cannot be met.
**Insight:** When a contract special-cases a wrapped/native token on one side of a balance delta, check that the other side uses the same asset; any externally-donatable balance used as a baseline is attacker-controllable.

