# All assets of (m)TapiocaOFT can be stealed by depositing to strategy cross chain call with 1 amount but maximum shares possible

Cross-chain sendToStrategy debits only the amount but trusts attacker-supplied share, letting anyone drain all (m)TapiocaOFT assets via YieldBox deposit.

- Payout: Contest reward
- Severity: high
- Program: Tapioca DAO
- Credited: 0x73696d616f
- Disclosed: 2023-11-16
- Write-up quality: 8/10
- Original: https://github.com/code-423n4/2023-07-tapioca-findings/issues/1281
- Library page: https://bugbountylibrary.com/r/c4%3A2023-07-tapioca%3AH-14
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:chained technique:source-review vuln:accounting-error vuln:business-logic

**Target:** BaseTOFT / BaseTOFTStrategyModule cross-chain strategy deposit
**Root cause:** sendToStrategy debits the user by `amount` but forwards the unvalidated `share` to the destination chain, where depositToYieldbox recomputes `_amount` from `share` via yieldBox.toAmount, ignoring the debited amount.
**Steps:**
1. Attacker wraps 1 wei of underlying into (m)TapiocaOFT and approves it.
2. Call `sendToStrategy(from, to, amount=1, share=2e18, assetId, lzDstChainId, options)` paying only LZ fees.
3. Source chain `_debitFrom` removes only 1 wei from attacker.
4. LZ payload `PT_YB_SEND_STRAT` carries share=2e18 to destination.
5. Destination `strategyDeposit` -> `depositToYieldbox` sets `_amount = yieldBox.toAmount(assetId, share, false)` = 2e18.
6. `yieldBox.depositAsset(assetId, tapiocaOft, attacker, 2e18, 2e18)` credits attacker with shares backed by other users' bridged funds.
**How found:** Code review of the cross-chain strategy path: noticed `sendToStrategy` validates only `amount > 0` and never checks `share`, then traced the payload into `depositToYieldbox` where `_amount` is recomputed from `share` via `yieldBox.toAmount`, breaking the amount/share invariant across chains.
**Exploitation:** Attacker needs only 1 wei of the underlying plus LZ gas fees. By setting amount=1 and share equal to the full YieldBox share balance of the (m)TapiocaOFT, the destination-chain deposit mints/credits shares worth the entire contract balance to the attacker, who can then withdraw the underlying.
**Escalation:** Repeatable across every (m)TapiocaOFT deployment and assetId; drains all bridged liquidity, not just a single user's deposit.
**Insight:** In cross-chain messaging, any parameter that is validated/recomputed on the destination (here share->amount via YieldBox ratio) must be bound to the value actually debited on the source; audit every field of the LZ payload for source/destination invariant mismatches.
