# Attacker can use MagnetarAction.OFT action of the Magnet to perform operations as any user including directly stealing user tokens

Magnetar OFT action lacks selector checks and whitelists itself, letting an attacker re-enter as msg.sender and act as any user to steal approved tokens.

- Payout: Contest reward
- Severity: high
- Program: Tapioca DAO
- Credited: ronnyx2017
- Disclosed: 2024-05-23
- Write-up quality: 8/10
- Original: https://github.com/code-423n4/2024-02-tapioca-findings/issues/100
- Library page: https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-06
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:access-control vuln:auth-bypass

**Target:** Magnetar.sol burst/_processOFTOperation and MagnetarAssetModule
**Root cause:** _processOFTOperation only validates target addresses against the cluster whitelist without checking function selectors, and Magnetar itself is whitelisted, so a self-call makes msg.sender pass _checkSender.
**Steps:**
1. Call `Magnetar.burst` with `_action.id == MagnetarAction.OFT`, `_target = address(Magnetar)`, and `_actionCalldata` encoding another `burst` with `MagnetarAction.OFT`.
2. Inner call executes with `msg.sender == Magnetar`, which is whitelisted, so `_checkSender` passes for any `_from`.
3. Invoke `MagnetarAssetModule` with arbitrary `data.user` and `withdrawCollateralParams.withdraw = true`; collateralWithdrawReceiver becomes Magnetar.
4. Set `_withdrawToChain` receiver to attacker address to receive withdrawn collateral on destination chain.
**How found:** Code review of _processOFTOperation noticed only target addresses (not selectors) are validated; then noticed Magnetar is added to its own cluster whitelist in integration tests, hypothesizing a self-call would satisfy _checkSender.
**Exploitation:** Attacker re-enters Magnetar via OFT self-call to bypass sender authorization, then calls asset module functions as any user who approved tokens to Magnetar, withdrawing their collateral cross-chain to an attacker-controlled receiver.
**Escalation:** Chaining selector-check bypass with self-whitelisting turns a whitelist bypass into theft of any user's approved collateral.
**Insight:** When a contract validates callee addresses but not function selectors, check whether the contract itself is whitelisted—a self-call makes msg.sender trusted and unlocks arbitrary downstream calls.
