zEVM cross-chain messages ignore the user-specified message and prevent calling the destination contract
Cross-chain messages sent from the zEVM had their user-specified message field overwritten with an empty string, so the destination contract's onZetaMessage function was never called. This made cross-chain messaging useless and could cause loss or locking of funds.
berndartmueller Follow with MevSec
Originally disclosed on Code4rena
Submitted by berndartmueller, also found by MevSec
Cross-chain Zeta messages originating from the zEVM have an empty message field, preventing the destinationAddress contract from being called.
This renders the cross-chain messaging functionality useless as the message is never used and potentially causes a loss of funds (if assets have been burned on the zEVM) or locked funds (if unable to unlock on the receiver end).
Proof of Concept
zEVM transactions are post-processed in the PostTxProcessing function of the x/crosschain module. Specifically, the goal is to parse and process ZetaSent and ZRC-20 Withdrawal events and send them to the corresponding, external receiver chains.
Any emitted ZetaSent events are parsed and processed in the ProcessZetaSentEvent function. This event is emitted by the ZetaConnectorZEVM.send function to send a cross-chain message to an external chain.
The message input, ZetaInterfaces.SendInput, allows the sender to specify a message that is forwarded to the receiver contract (destinationAddress) on the destination chain.
Specifically, once the cross-chain message is received by the onReceive function of the ZetaConnector contract on the receiver chain (e.g., ZetaConnectorEth or ZetaConnectorNonEth), the destinationAddress’s onZetaMessage function is called and the message is provided as a parameter.
However, the user-specified message is not used, instead, it is overwritten by an empty string in line 221.
172: func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaConnectorZEVMZetaSent, emittingContract ethcommon.Address, txOrigin string) error {
... // [...]
212:
213: // Bump gasLimit by event index (which is very unlikely to be larger than 1000) to always have different ZetaSent events msgs.
214: msg := types.NewMsgVoteOnObservedInboundTx(
215: "",
216: emittingContract.Hex(),
217: senderChain.ChainId,
218: txOrigin, toAddr,
219: receiverChain.ChainId, /
220: amount,
221: ❌ "",
222: event.Raw.TxHash.String(),
223: event.Raw.BlockNumber,
224: 90000,
225: common.CoinType_Zeta,
226: "",
227: event.Raw.Index,
228: )
229: sendHash := msg.Digest()
230:
231: // Create the CCTX
232: cctx := k.CreateNewCCTX(ctx, msg, sendHash, tss.TssPubkey, types.CctxStatus_PendingOutbound, &senderChain, receiverChain)
... // [...]
246: }
As a result, the destination contract is never called as the message is empty.
Recommended mitigation steps
Consider using the user-specified message instead of overwriting it with an empty string.
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 ProcessZetaSentEvent function passed an empty string instead of the event's message field when constructing the cross-chain transaction.
Impact
Cross-chain messaging from zEVM is rendered useless and may cause loss of burned assets or locked funds on the receiver end.
What the attacker needed
Sending a cross-chain message from zEVM
The fix
The code should use the user-specified message instead of an empty string; the report does not state that it was fixed.
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 you send a message from one blockchain to another, the message content should be passed along. Here, the code that handles the sending accidentally replaced the user's message with nothing, so the receiving contract never got called. This broke the feature and could trap funds.
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.