Missing LayerZero Ordered Execution Option For Orderly Chain Messages
The withdraw implementation in SolConnector only sets basic gas and value options for LayerZero messages, omitting the ordered execution option. As a result, messages can arrive out of order at the Solana vault, causing rejection and leaving balances inconsistent between the Orderly Chain ledger and the Solana vault.
0xNirix Follow with LZ_security, g and 1 other
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-09-orderly-network-solana-contract-judging/issues/146
The protocol has acknowledged this issue.
Found by
0xNirix, LZ_security, g, krikolkk
Summary
Missing ordered execution enforcement will cause message rejection vulnerability for users as unordered messages will update balances on Orderly Chain's ledger but fail on Solana vault due to message ordering mismatch.
Root Cause
In https://github.com/sherlock-audit/2024-09-orderly-network-solana-contract/blob/main/sol-cc/contracts/SolConnector.sol#L92 the withdraw implementation only applies basic gas/value options without ordered execution option: solidityCopybytes memory withdrawOptions = OptionsBuilder.newOptions().addExecutorLzReceiveOption( msgOptions[uint8(MsgCodec.MsgType.Withdraw)].gas, msgOptions[uint8(MsgCodec.MsgType.Withdraw)].value ); LayerZero will not guarantee ordered message delivery in absence of this option.
Internal pre-conditions
- Ordered delivery is enabled on Solana vault side and Orderly chain
- Multiple withdrawals are processed in quick succession
External pre-conditions
No response
Attack Path
- User A and User B submit withdrawals close together
- SolConnector sends messages with only gas/value options configured
- LayerZero messages arrive out of order at Solana vault due to missing ordered execution option
- Solana vault rejects out-of-order messages with InvalidInboundNonce error
- Ledger contract has already updated balances on Orderly Chain
- Balance state becomes inconsistent between chains
Impact
Users suffer from state inconsistency where their balances are reduced on Orderly Chain's ledger but funds remain locked in Solana vault due to message rejection. User may effectively lose funds and to resolve this extensive manual intervention may be required by admin.
PoC
No response
Mitigation
No response
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The withdraw message options builder only adds gas and value options and does not include the LayerZero ordered execution option.
Impact
Users could suffer state inconsistency where balances are reduced on Orderly Chain but funds remain locked in the Solana vault, potentially requiring manual intervention by an admin.
What the attacker needed
Ordered delivery enabled on both chains; Multiple withdrawals in quick succession
The fix
The withdraw options should include the LayerZero ordered execution option so messages are delivered in order.
How it was found
- User A and User B submit withdrawals close together
- SolConnector sends messages with only gas/value options configured
- LayerZero messages arrive out of order at Solana vault due to missing ordered execution option
- Solana vault rejects out-of-order messages with InvalidInboundNonce error
- Ledger contract has already updated balances on Orderly Chain
- Balance state becomes inconsistent between chains
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When two blockchains talk to each other, messages must arrive in the same order they were sent. This report says the code that sends withdrawal messages forgot to ask for that ordering guarantee, so messages can arrive out of order and be rejected, leaving the user's balance reduced on one chain but funds stuck on the other.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.