Platform: Code4rena
Start Date: 22/09/2023
Pot Size: $100,000 USDC
Total HM: 15
Participants: 175
Period: 14 days
Judge: alcueca
Total Solo HM: 4
Id: 287
League: ETH
Rank: 73/175
Findings: 1
Award: $39.20
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 3docSec
Also found by: 0xStalin, 0xadrii, KingNFT, Limbooo, T1MOH, Tendency, ZdravkoHr, ciphermarco, jasonxiale, lsaudit, minhtrng, rvierdiiev, wangxx2026
39.2026 USDC - $39.20
https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/RootBridgeAgent.sol#L1204-L1217 https://github.com/code-423n4/2023-09-maia/blob/f5ba4de628836b2a29f9b5fff59499690008c463/src/BranchBridgeAgent.sol#L936-L944
lzreceive is not working properly
The entire link to interact with lz is: bridgeAgent.lz.send->validateTransactionProof (off-chain service)->lz.receivePayload->bridgeAgent.lzReceive
The second parameter calldata _srcAddress received by lzReceive is passed by lz:
bytes memory pathData = abi.encodePacked(_packet.srcAddress, _packet.dstAddress); // msg.sender is stored in the first 20 bytes,
For details, please refer to the source code of lz
https://arbiscan.io/address/0x4D73AdB72bC3DD368966edD0f0b2148401A178E2#code
You can also refer to the mock version https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/lzApp/mocks/LZEndpointMock.sol
The usage in the code is as follows // found
function _requiresEndpoint(address _endpoint, bytes calldata _srcAddress) internal view virtual { //Verify Endpoint if (msg.sender != address(this)) revert LayerZeroUnauthorizedEndpoint(); if (_endpoint != lzEndpointAddress) revert LayerZeroUnauthorizedEndpoint(); //Verify Remote Caller if (_srcAddress.length != 40) revert LayerZeroUnauthorizedCaller(); if (rootBridgeAgentAddress != address(uint160(bytes20(_srcAddress[20:])))) revert LayerZeroUnauthorizedCaller(); // found }
The last 20 bytes obtained from _srcAddress are dstAddr, and here we want to limit the caller, so we should get the first 20 bytes.
Manual Review
Get msg.sender using first 20 bytes of _srcAddress
Access Control
#0 - c4-pre-sort
2023-10-13T05:50:49Z
0xA5DF marked the issue as duplicate of #439
#1 - c4-pre-sort
2023-10-13T05:50:53Z
0xA5DF marked the issue as sufficient quality report
#2 - c4-judge
2023-10-26T09:42:13Z
alcueca changed the severity to 2 (Med Risk)
#3 - c4-judge
2023-10-26T09:45:20Z
alcueca marked the issue as satisfactory
#4 - c4-judge
2023-10-26T09:52:31Z
alcueca marked the issue as partial-50
#5 - alcueca
2023-10-26T09:52:31Z
There are very high effort submissions in this duplicate group. All others are getting 50% so that the few very high effort ones get double rewards.