sherlock-audit / 2024-09-orderly-network-solana-contract-judging

0 stars 0 forks source link

Original Emerald Millipede - Missing Conditional Registration for New LayerZero Endpoint on OApp Reinitialization May Cause Call Failures #167

Open sherlock-admin2 opened 4 days ago

sherlock-admin2 commented 4 days ago

Original Emerald Millipede

High

Missing Conditional Registration for New LayerZero Endpoint on OApp Reinitialization May Cause Call Failures

Summary

The OApp reinitialization process lacks a conditional registration for newly configured LayerZero endpoints, leading to potential call failures if a new endpoint is specified. The LayerZero endpoint should only be registered once, but if reinitialization configures a new endpoint, registration does not occur, causing calls to fail due to the endpoint’s unregistered status.

Root Cause

During OApp reinitialization, there is no check to register a new LayerZero endpoint if the configuration has changed. The initial setup registers the endpoint correctly, but reinitialization does not trigger registration if a different endpoint is introduced. https://github.com/sherlock-audit/2024-09-orderly-network-solana-contract/blob/main/solana-vault/packages/solana/contracts/programs/solana-vault/src/state/oapp_state/oapp_config.rs#L32-L41

https://github.com/sherlock-audit/2024-09-orderly-network-solana-contract/blob/main/solana-vault/packages/solana/contracts/programs/solana-vault/src/instructions/oapp_instr/reinit_oapp.rs#L29-L46

xample:

In LayerZero's example implementation, endpoint registration occurs during initial setup, ensuring valid communication paths. The OApp, however, does not re-register if a new endpoint is added during reinitialization, leaving it unverified and potentially inactive.

Internal pre-conditions

External pre-conditions

Attack Path

Impact

The OApp may experience disruptions as calls to an unregistered, newly configured LayerZero endpoint fail. This missing conditional registration step for new endpoints affects cross-chain communication, leading to potential call failures and limited protocol usability.

PoC

No response

Mitigation

No response