Platform: Code4rena
Start Date: 26/05/2023
Pot Size: $100,000 USDC
Total HM: 0
Participants: 33
Period: 14 days
Judge: leastwood
Id: 241
League: ETH
Rank: 20/33
Findings: 1
Award: $813.40
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: rbserver
Also found by: 0x73696d616f, 0xTheC0der, 0xdeadbeef, 0xhacksmithh, Bauchibred, GalloDaSballo, KKat7531, Madalad, MohammedRizwan, Rolezn, SAAJ, SanketKogekar, Sathish9098, VictoryGod, brgltd, btk, codeslide, descharre, hunter_w3b, jauvany, kaveyjoe, ladboy233, nadin, niser93, shealtielanz, souilos, trysam2003, yongskiws
813.4016 USDC - $813.40
checks-effects-interactions code pattern is not completely followed in relayMessage() function. It can open CrossDomainMessenger contract to reentrancy vulnerabilities, though the chance is slim.
Affected Code Section https://github.com/ethereum-optimism/optimism/blob/382d38b7d45bcbf73cb5e1e3f28cbd45d24e8a59/packages/contracts-bedrock/contracts/universal/CrossDomainMessenger.sol#L303-L413
While it is beneficial to restrict copying returndata in the external contract to prevent direct reentry and exploitation of reentrancy vulnerabilities through return data manipulation, it is essential to emphasize that this measure alone does not provide comprehensive protection against all reentrancy attack scenarios. Other vectors and attack possibilities should be taken into consideration.
In the specific context of the relayMessage() function, where low-level calls to an external address are made using the SafeCall library while restricting copying returndata, it is important to acknowledge that reentrancy attacks can still occur through alternative avenues.
It is crucial to note that during the gas estimation period, multiple transactions triggered by the estimation address can be successful, potentially leading to a reentrancy hack.
Therefore, it is advised that the validation of "ESTIMATION ADDRESS" is done before the low level call.
#0 - 0xleastwood
2023-06-16T15:03:00Z
Not really sure about this one so will keep open for the Base protocol team to respond.
#1 - c4-judge
2023-06-16T15:03:07Z
0xleastwood marked the issue as grade-b