Open c4-submissions opened 1 year ago
0xA5DF marked the issue as sufficient quality report
0xA5DF marked the issue as primary issue
Leaving open for sponsor to comment
0xLightt (sponsor) confirmed
0xBugsy marked the issue as disagree with severity
alcueca changed the severity to 2 (Med Risk)
No funds at risk. Medium at best, since there is a workaround (since this is also a router contract, users can always interact directly with the bridgeAgent and approve funds to be spent by the correct Port themselves (approve rootPort instead of ArbitrumBranchPort)
alcueca marked the issue as satisfactory
alcueca marked the issue as selected for report
From the sponsor:
we believe it is accurate. we need to increase the allowance/approve to the root port in arbitrum base branch routers.
Lines of code
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BaseBranchRouter.sol#L95-L100 https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BaseBranchRouter.sol#L167-L168 https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L224 https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L824 https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/ArbitrumBranchPort.sol#L134
Vulnerability details
Impact
All branches have one core router and several subsidiary branches. The core branches handle system calls, and users can create deposits using subsidiary branches. The function utilized for creating deposits is the
callOutAndBridge
function. However, in theArbitrum
branch, this function is not available for use. This restriction has system-wide implications because the Arbitrum branch should function similarly to other local branches.Proof of Concept
When a user attempts to make a deposit in other branches, the
local hTokens
are transferred from the user to thelocal branch port
and subsequently burned. However, inArbitrum
, there is no differentiation betweenlocal
andglobal hTokens
. Consequently, they are sent directly to theroot port
. When a user invokes thecallOutAndBridge
function in a branch, it involves the transfer ofhTokens
andunderlying tokens
from theuser
to therouter
. Additionally, therouter
approves thelocal port
to access and utilize these tokens. https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BaseBranchRouter.sol#L95https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BaseBranchRouter.sol#L167-L168
Then we call the 'callOutAndBridge' function within the
bridge agent
. Within this function, a deposit is created. https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L224https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L824
We've now reached the
_bridgeOut
function inArbitrumBranchPort
. https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/ArbitrumBranchPort.sol#L134Here, the
_depositor
is the router, andArbitrumBranchPort
is authorized to access these tokens, but notRootPort
. https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/RootPort.sol#L301Consequently, we are unable to bridge these tokens to the
RootPort
from_depositor
.Add test below to
test/ulysses-omnichain/ArbitrumBranchTest.t.sol
and run test. You could see that the test will be failed.Tools Used
Recommended Mitigation Steps
Change this
with
You can observe that the test will pass successfully. It's important to note that when users attempt to use the
callOutAndBridge
function within thebridge agent
, they allow thelocal port
to access their funds, just as in other branches.Assessed type
Token-Transfer