Closed c4-submissions closed 1 year ago
0xA5DF marked the issue as primary issue
0xA5DF marked the issue as sufficient quality report
0xBugsy (sponsor) confirmed
alcueca marked issue #728 as primary and marked this issue as a duplicate of 728
alcueca marked the issue as satisfactory
alcueca marked the issue as duplicate of #518
Lines of code
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L579-L583
Vulnerability details
Impact
The protocol uses LayerZeros Airdrop mechanism to send gas to BridgeAgents which they need to pay for subsequential cross-chain-messages. If the transaction on the receiver fails, this airdropped gas will remain in the BridgeAgent and can be used up by the next caller.
Proof of Concept
The use of the Airdrop mechanism can be seen for example in
BranchBridgeAgent._performCall
:An example that shows an attempt of using the airdropped gas to perform a follow up call is in
BranchBridgeAgent._performFallBackCall
:This call happens after the execution of another call has failed, for example
_executeWithSettlement
:As can be seen, the function attempts to send back the remaining native gas to the recipient. If the execution fails, the fallback is triggered. However the fallback too can fail, if the gas balance of the bridge agent is not enough to cover the relayer costs (looking at LayerZero code ->
UltraLightNodeV2.send
gets called by the Endpoint). In this case, the airdropped gas is not send anywhere and can be used up by the next caller.Tools Used
Manual Review
Recommended Mitigation Steps
At
lzReceive
(which can never fail due to a low level call, with additional safety), the contract balance could be sent to a refundee or recipient in case of failure:Assessed type
Other