# AutoRoller#eject can be used to steal all the yield from vault's YTs

AutoRoller#eject transfers the contract's entire target-asset balance to the caller, letting any ejector steal yield accrued for all other YT holders.

- Payout: Contest reward
- Severity: high
- Program: Sense
- Credited: 0x52
- Disclosed: 2022-10-31
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2022-11-sense-judging/issues/22
- Library page: https://bugbountylibrary.com/r/sherlock%3A2022-11-sense%3AH-3
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** AutoRoller.sol eject/_exitAndCombine in Sense auto-roller
**Root cause:** eject transfers asset.balanceOf(address(this)) to the receiver, but _exitAndCombine's divider.combine call collects yield for ALL YTs into the AutoRoller, so the full balance includes other users' yield.
**Steps:**
1. Deposit into AutoRoller to get shares; other users' YTs accrue yield in the adapter.
2. Call `eject(shares, receiver, owner)` with a small share amount.
3. _exitAndCombine calls `divider.combine(adapter, maturity, ytBal)`, which via _collect transfers collected yield for the whole series to the AutoRoller.
4. eject then executes `asset.transfer(receiver, asset.balanceOf(address(this)))`, sending the entire balance including others' yield to the caller.
**How found:** Code review of eject: noticed the final transfer uses the contract's entire asset balance rather than the amount returned by combine, and traced _exitAndCombine -> divider.combine -> _collect to confirm yield for all YTs lands in the AutoRoller.
**Exploitation:** Attacker holds any shares in the AutoRoller, calls eject; combine pulls all accrued YT yield into the contract, and the unconditional full-balance transfer hands it to the attacker, extracting value belonging to other depositors.
**Insight:** When a function transfers `token.balanceOf(address(this))` instead of a computed amount, check every internal call that can deposit tokens into the contract during that same transaction—shared-pool yield collectors are a common source of over-transfer.
