# Users will lose all ETH sent as cost parameter in transactions to and from Optimism

OptimismDepositProcessorL1 passes user-supplied cost as msg.value to Optimism's L1CrossDomainMessenger, which forwards it to L2 where it is stranded, causing users to lose ETH.

- Payout: Audit contest
- Severity: medium
- Program: Olas
- Found by: EV\_om
- Disclosed: 2024-08-06
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-05-olas-findings/issues/20
- Library page: https://bugbountylibrary.com/r/c4%3A2024-05-olas%3AM-17
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic

**Target:** OptimismDepositProcessorL1 / OptimismTargetDispenserL2 bridge contracts
**Root cause:** _sendMessage() decodes a user-supplied `cost` from bridgePayload and forwards it as msg.value to L1CrossDomainMessenger.sendMessage(), but Optimism fees are paid via L1 gas, not ETH value; the value is relayed to L2 and left unused in OptimismTargetDispenserL2.
**Steps:**
1. User calls Dispenser to bridge tokens L1->Optimism, invoking OptimismDepositProcessorL1._sendMessage() with bridgePayload containing `cost`.
2. Contract checks `0 < cost <= msg.value` and calls `L1CrossDomainMessenger.sendMessage{value: cost}(target, message, gasLimitMessage)`.
3. CrossDomainMessenger encodes msg.value into relayMessage and forwards it to L2.
4. relayMessage calls target with `_value = cost`; ETH lands in OptimismTargetDispenserL2 and is never used.
**How found:** Code-reading of _sendMessage() against Optimism's documented fee model: noticed cost was passed as msg.value despite Optimism charging via L1 gas burn, then traced sendMessage/relayMessage to confirm the ETH is forwarded and unused.
**Exploitation:** No attacker needed; any user bridging via the Dispenser pays the cost ETH which is permanently stranded on L2, a direct loss to the caller.
**Insight:** When integrating a bridge, verify the bridge's actual fee model in its source rather than assuming msg.value pays delivery; trace where msg.value ends up on the destination chain to spot stranded funds.

