# Calls To Swivel.initiate() Do Not Verify o.exit or o.vault Allowing An Attacker To Manipulate Accounting In Their Favour

Illuminate's lend() forwards unvalidated o.exit/o.vault to Swivel.initiate(), letting a caller select a different fill path that over-transfers underlying from Lender.

- Payout: Contest reward
- Severity: medium
- Program: Illuminate
- Credited: kirk-baird
- Disclosed: 2022-08-23
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-06-illuminate-findings/issues/93
- Library page: https://bugbountylibrary.com/r/c4%3A2022-06-illuminate%3AM-03
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** Lender.sol lend() / Swivel.initiate() order routing
**Root cause:** lend() does not constrain o.exit and o.vault before calling Swivel.initiate(), so the order can route to initiateZcTokenFillingZcTokenExit() instead of the intended initiateZcTokenFillingVaultInitiate().
**Steps:**
1. Call `Lender.lend()` with an order whose `o.exit`/`o.vault` select `initiateZcTokenFillingZcTokenExit()` rather than the vault-initiate path.
2. Swivel transfers `a - premiumFilled + fee` from Lender to Swivel instead of the expected `a + fee`.
3. Accounting in lend() is skewed; excess underlying is pulled from Lender.
**How found:** Code review of the lend() -> Swivel.initiate() external call, noticing o.exit/o.vault are attacker-controlled and select among multiple internal fill functions with differing token transfer amounts.
**Exploitation:** Attacker submits a crafted order to lend() choosing a non-intended Swivel fill path, causing Swivel to pull more underlying from Lender than the caller paid for; per maintainer the excess sits in Lender until maturity, leaking value rather than direct theft.
**Insight:** When a wrapper forwards user-supplied enum/selector fields to an external protocol's dispatcher, enumerate every branch the selector can reach and diff the token flows — the intended branch is rarely the only one with side effects.
