# Funds can be stolen through remote transfer functionality

Remote transfer compose message sets srcChainSender to the fund owner instead of the caller, letting an attacker bypass allowance checks and steal victim tokens cross-chain.

- Payout: Contest reward
- Severity: high
- Program: Tapioca DAO
- Credited: rvierdiiev
- Disclosed: 2024-05-23
- Write-up quality: 8/10
- Original: https://github.com/code-423n4/2024-02-tapioca-findings/issues/76
- Library page: https://bugbountylibrary.com/r/c4%3A2024-02-tapioca%3AH-09
- 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:business-logic

**Target:** TapiocaOmnichainReceiver remote transfer / LayerZero compose flow
**Root cause:** In _internalRemoteTransferSendPacket the outgoing composed message encodes the fund owner (_srcChainSender param passed as owner) as srcChainSender_ rather than the actual compose initiator, so the next hop treats the victim as the caller and skips allowance checks.
**Steps:**
1. Attacker on chain A calls TapiocaOmnichainSender.sendPacket with a composed message targeting chain B, setting owner=victim and amount=0.
2. On chain B, _lzReceive mints 0 tokens and forwards compose to endpoint; lzCompose sets srcChainSender_=victim (encoded from chain A).
3. MSG_REMOTE_TRANSFER executes: transfers 0 tokens from victim (allowed since srcChainSender==owner, no allowance needed), then _internalRemoteTransferSendPacket burns and crafts a new composed message encoding victim as srcChainSender_.
4. On chain A the returned compose is processed with srcChainSender_=victim, so remote transfer of victim's full balance to attacker passes without allowance check.
5. Attacker receives victim's tokens on chain B.
**How found:** Code reading of the compose encoding: noticed encode() stores msg.sender as srcChainSender_, but the remote-transfer path passes the fund owner into _internalRemoteTransferSendPacket, making the propagated sender the owner rather than the initiator.
**Exploitation:** Attacker crafts a zero-amount remote transfer compose from chain A naming the victim as owner; the round-trip re-encodes the victim as srcChainSender, so the follow-up remote transfer on chain A moves the victim's entire balance to the attacker without any approval.
**Insight:** In cross-chain compose/messaging designs, trace which identity gets re-encoded into the outbound message at each hop; any place the 'sender' field is populated from a user-supplied owner/beneficiary rather than the actual caller creates an identity-confusion that bypasses allowance/auth checks on the return path.
