Deposits from L1 to L2 using L1CrossDomainMessenger will fail and will not be replayable when L2CrossDomainMessenger is paused
When the L2CrossDomainMessenger contract is paused, deposits sent from L1 to L2 through L1CrossDomainMessenger fail on the L2 side because relayMessage reverts. The deposited value is minted to an aliased address and the depositor cannot replay the transaction, losing their funds.
rvierdiiev Follow with Bnke0x0 and 0xdeadbeef
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2023-01-optimism-judging/issues/57
Found by
rvierdiiev, Bnke0x0, 0xdeadbeef
Summary
Deposits from L1 to L2 using L1CrossDomainMessenger will fail and will not be replayable when L2CrossDomainMessenger is paused.
Vulnerability Detail
Both L1CrossDomainMessenger and L2CrossDomainMessenger extend CrossDomainMessenger contract that can be paused.
When CrossDomainMessenger is paused then only relayMessage function will revert as it uses whenNotPaused modifier. It's still possible to call sendMessage when contract is paused.
In known issues section you can find following:
3.If the L1CrossDomainMessenger is paused, withdrawals sent to it will fail and not be replayable.
However there is another problem with pausing.
In case if L2CrossDomainMessenger is paused and no matter if L1CrossDomainMessenger is pause or not(as sendMessage function is callable when contract is paused), then all deposits that are coming from L1 to L2 through the L1CrossDomainMessenger will fail on L2 side, as relayMessage will revert, because is paused.
As result, it will be not possible for depositor to replay that deposit anymore as no information about the call is saved.
All sent value will be minted to aliased L2CrossDomainMessenger address.
Example.
1.User wants to send himself some eth from L1 to L2 through L1CrossDomainMessenger.
2.When new TransactionDeposited event was fired by OptimismPortal, L2CrossDomainMessenger on L2 was paused for some reasons.
3.TransactionDeposited was explored by special service that sent tx to L2 node.
4.Sent value amount is minted to aliased L2CrossDomainMessenger address and L2CrossDomainMessenger.relayMessage is called which reverts.
5.Depositor lost his eth as he is not able to replay tx.
Impact
Lose of funds for depositor.
Code Snippet
Tool used
Manual Review
Recommendation
Pause CrossDomainMessenger on both sides at same time(L1 and L2) and restrict call of sendMessage function when contract is paused.
Discussion
rcstanciu
Comment from Optimism
Description: lock ups on l1->l2 pausing
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the pause mechanism only blocks relayMessage while sendMessage remains callable, so a paused L2 messenger causes incoming deposits to revert without saving replay information.
Impact
The depositor could lose the deposited funds because the failed deposit cannot be replayed.
What the attacker needed
L2CrossDomainMessenger is paused; user deposits via L1CrossDomainMessenger
The fix
The recommendation is to pause both L1 and L2 messengers at the same time and to restrict sendMessage when the contract is paused.
How it was found
- A user sends ether from L1 to L2 through L1CrossDomainMessenger.
- The L2CrossDomainMessenger on L2 is paused.
- A service relays the TransactionDeposited event to the L2 node.
- The value is minted to the aliased L2CrossDomainMessenger address and relayMessage reverts.
- The depositor cannot replay the transaction and loses the ether.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This report is about a bridge that moves ether between two blockchains, L1 and L2. The bridge has a pause switch that stops messages from being processed. If only the L2 side is paused, a deposit sent from L1 still gets recorded but cannot be delivered on L2, and the money is stuck with no way to retry.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.