Open c4-submissions opened 1 year ago
0xA5DF marked the issue as sufficient quality report
0xA5DF marked the issue as primary issue
What is being described is incorrect, the msg.value
is passed in order to be spent by the attached router being called, this can be used, for example to start Layer Zero cross-chain messages.
If this were to revert this revert would be triggered and a refund would take place: https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/RootBridgeAgent.sol#L430
As a result the issue being described does not occur.
0xBugsy (sponsor) disputed
What is being described is incorrect, the
msg.value
is passed in order to be spent by the attached router being called, this can be used, for example to start Layer Zero cross-chain messages.If this were to revert this revert would be triggered and a refund would take place: https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/RootBridgeAgent.sol#L430
As a result the issue being described does not occur.
Try to add console.logs at the end of the test suit to see the balances after the call:
console2.log("Bob balance", bob.balance); // 0.9 ETH
console2.log("Executor balance", coreBridgeAgent.bridgeAgentExecutorAddress().balance); // 0.1 ETH
The funds sent to arbitrumCoreBridgeAgent
by Bob are now located on RootBridgeAgentExecutor
without being refunded.
I see what is happening now, you are sending 0 calldata.
This is a duplicate of #685
alcueca changed the severity to QA (Quality Assurance)
alcueca marked the issue as grade-a
Lines of code
https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchBridgeAgent.sol#L195 https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchBridgeAgent.sol#L209 https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchBridgeAgent.sol#L231 https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchBridgeAgent.sol#L262 https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchBridgeAgent.sol#L276 https://github.com/code-423n4/2023-09-maia/blob/ffbe532c6f5224a55ce099b4016bd8806bdbc913/src/BranchBridgeAgent.sol#L306
Vulnerability details
Impact
Users will face permanent loss of their funds because there is no mechanism in place to transfer these funds anywhere. Specifically, the
RootBridgeAgentExecutor
lacks any function for withdrawing its balance.Proof of Concept
In the case of the basic
BranchBridgeAgent
deployed on other chains, themsg.value
sent to thecallOut*()
functions is treated as a gas fee, efficiently managed by LayerZero. It is sent alongside the call tolzEndpoint
, and after the cross-chain call, it is returned to the user as intended.However, in the scenario involving the
ArbitrumBranchBridgeAgent
, themsg.value
ends up with theRootBridgeAgentExecutor
(as evident from the execution logs below), and unfortunately, it is never returned to the user. This results in the loss of user funds.PoC
Tools Used
Manual review, Forge
Recommended Mitigation Steps
Pass the
msg.value
back to the gas recipient (msg.sender
in most cases). It's better to copy behavior of LayerZero to not make special exceptions in the execution of calls on Arbitrum.Assessed type
ETH-Transfer