Open c4-submissions opened 1 year ago
0xA5DF marked the issue as duplicate of #887
0xA5DF marked the issue as sufficient quality report
alcueca marked the issue as not a duplicate
alcueca changed the severity to QA (Quality Assurance)
alcueca marked the issue as grade-a
User error, as the warden points out.
Lines of code
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/RootBridgeAgent.sol#L788 https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/RootBridgeAgent.sol#L712 https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/RootBridgeAgent.sol#L938
Vulnerability details
Impact
_performFallbackCall can revert sliently when refundee is not capable of taking ETH refund from layerzero side
Proof of Concept
In RootBridgeAgent.sol when the has fall back toggle flag is on, the smart contract aim to perform a fallback call to notify the dest chain the failure to deliver the message
for example, the relevent code is here
and here when retrieve the deposit
the logic of the _performFallbackCall is here
the code forward all ETH (address(this).balance) and aim to use the ETH to pay for the layerzero fee
the problem is that such fallback is wrapped by the excessivelySafeCall
to not blocking other passing messaging via layerzero endpoint, the excessivelySafeCall will sliently revert but does not block transaction confirm
basically this means if there are revert (refundee cannot take the ETH) inside the excessivelySafeCall, fall back is never executed and even user toggle the fall back flag, asset can still be lost
which line of code will revert when refundee is not capable of taking ETH refund from layerzero side
after the message is sent via the endpoint, the layerzero endpoint foward the message to UltraLightNodeV2
the code quote the fee and refund the excessive fee to the refundee address
but if the refundee address is not capable of taking the ETH refund, transaction revert
transaction revert in this line of code
can add this test into the BranchBridgeAgentTest.t.sol to prove that the transaction revert when the refund address is not capable of taking the ETH refund
we need to add a smart contract code in the same file first
then add
and we can run the fork test
the transaction revert and we can see the error message:
note, the BranchBridgeAgent has the same problem when executing fallback call
submitting as medium because it may require user error but
it is very natural maybe for a smart contract that implement some check inside the receive function (only receive ETH from WETH contract)
and if that case, if such address is the refundee, perform fall back sliently revert
Tools Used
Manual Review, foundry
Recommended Mitigation Steps
call estimate fee before sending the fallback request to not send too much fee to avoid layerzero fee refund
also if the fallback revert, save the payload and allow user retry the fallback call later
Assessed type
DoS