[WP-H5] L1Migrator.sol#migrateETH() does not send bridgeMinter ’s ETH to L2 causing ETH get frozen in the contract
The L1Migrator contract withdraws ETH from BridgeMinter but fails to include that amount when sending a transaction to L2, so the L2 call always fails due to insufficient funds. As a result, all ETH from BridgeMinter becomes permanently frozen in the contract.
Submitted by WatchPug, also found by gzeon, harleythedog, and Ruhum.
Per the arb-bridge-eth code:
all msg.value will deposited to callValueRefundAddress on L2
- https://github.com/OffchainLabs/arbitrum/blob/78118ba205854374ed280a27415cb62c37847f72/packages/arb-bridge-eth/contracts/bridge/Inbox.sol#L313
- https://github.com/livepeer/arbitrum-lpt-bridge/blob/ebf68d11879c2798c5ec0735411b08d0bea4f287/contracts/L1/gateway/L1ArbitrumMessenger.sol#L65-L74
uint256 seqNum = inbox.createRetryableTicket{value: _l1CallValue}(
target,
_l2CallValue,
maxSubmissionCost,
from,
from,
maxGas,
gasPriceBid,
data
);
At L308-L309, ETH held by BridgeMinter is withdrawn to L1Migrator:
uint256 amount = IBridgeMinter(bridgeMinterAddr)
.withdrawETHToL1Migrator();
However, when calling sendTxToL2() the parameter _l1CallValue is only the msg.value, therefore, the ETH transferred to L2 does not include any funds from bridgeMinter.
sendTxToL2(
l2MigratorAddr,
address(this), // L2 alias of this contract will receive refunds
msg.value,
amount,
_maxSubmissionCost,
_maxGas,
_gasPriceBid,
""
)
As a result, due to lack of funds, call with value = amount to l2MigratorAddr will always fail on L2.
Since there is no other way to send ETH to L2, all the ETH from bridgeMinter is now frozen in the contract.
Recommendation
Change to:
sendTxToL2(
l2MigratorAddr,
address(this), // L2 alias of this contract will receive refunds
msg.value + amount, // the `amount` withdrawn from BridgeMinter should be added
amount,
_maxSubmissionCost,
_maxGas,
_gasPriceBid,
""
)
yondonfu (Livepeer) confirmed and resolved:
Fixed in https://github.com/livepeer/arbitrum-lpt-bridge/pull/51
0xleastwood (judge) commented:
Awesome find!
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
The contract withdraws ETH from BridgeMinter but only passes msg.value as the L1 call value when sending to L2, omitting the withdrawn amount.
Impact
All ETH from BridgeMinter becomes permanently frozen in the L1Migrator contract, as there is no other way to send it to L2.
What the attacker needed
ETH held by BridgeMinter; migrateETH() is called
The fix
The fix was to add the withdrawn amount to msg.value when calling sendTxToL2, and it was fixed in a pull request.
How it was found
- Call migrateETH() which withdraws ETH from BridgeMinter to L1Migrator.
- The contract calls sendTxToL2 with _l1CallValue equal to msg.value only.
- The L2 call to l2MigratorAddr with value amount fails due to insufficient funds.
- The ETH from BridgeMinter remains frozen in the L1Migrator contract.
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 is a smart contract bug where a function moves money from one contract to another but forgets to add that money to a transaction sent to another network. Because the transaction doesn't have enough funds, it fails, and the money gets stuck forever.
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.