Attacker can block LayerZero channel
The RedemptionReceiver contract on Optimism did not implement LayerZero's non-blocking message handling, so a failed message from any sender could block the channel between FTM and Optimism. An attacker could send a message that causes the receiver to revert, preventing legitimate redemption messages from being processed.
Submitted by Ruhum
According to the LayerZero docs, the default behavior is that when a transaction on the destination application fails, the channel between the src and dst app is blocked. Before any new transactions can be executed, the failed transaction has to be retried until it succeeds.
See https://layerzero.gitbook.io/docs/faq/messaging-properties#message-ordering & https://layerzero.gitbook.io/docs/guides/advanced/nonblockinglzapp
So an attacker is able to initiate a transaction they know will fail to block the channel between FTM and Optimism. The RedemptionSender & Receiver won’t be usable anymore.
Proof of Concept
The RedemptionReceiver contract doesn’t implement the non-blocking approach as seen here: https://github.com/code-423n4/2022-05-velodrome/blob/main/contracts/contracts/redeem/RedemptionReceiver.sol#L72-L105
An example implementation of the non-blocking approach by LayerZero: https://github.com/LayerZero-Labs/solidity-examples/blob/main/contracts/lzApp/NonblockingLzApp.sol
Recommended Mitigation Steps
Use the non-blocking approach as described here.
pooltypes (Velodrome) disagreed with severity
Alex the Entreprenerd (judge) commented:
@pooltypes Can anyone send a message or would they need to be whitelisted?
Alex the Entreprenerd (judge) commented:
If anyone can call and deny, the contract is not suited to handle exceptions and doesn’t implement the
forceReceivefunction, meaning the channel can be griefed and I don’t believe there’s a way to remedy.The contract needs to implement
forceResumeReceiveto allow to remove malicious messages that may be received.I still am unsure if anyone can send a malicious message or if they need to be approved. If only the admin can this is a Medium Severity. If anyone can, this is a High Severity finding.
From the documentation it seems like anyone can call the function: https://layerzero.gitbook.io/docs/guides/master/how-to-send-a-message
Alex the Entreprenerd (judge) increased severity to High and commented:
With the information I currently have, it seems like the channel can be setup to receive messages only by the specified contract, however for multiple reasons, the message sent can cause a revert, and in lack of a “nonblocking” architecture, the messages can get stuck indefinitely.
However, the implementation under scope has none of these defenses, it seems like the contact under scope can be denied functionality by any caller that builds their own LZApp.
See example of how to prevent untrusted callers.
Because of that, the message queue can be filled with blocking messages that cannot be removed.
Because the contract under scope also has no way of re-setting the queue, I have reason to believe that any attack can permanently brick the receiver.
For these reasons, I believe High Severity to be more appropriate.
ethzoomer (Velodrome) commented:
At this point in time we’ve already completed all of the redemptions.
Is it possible to send a message from the contract other than what sender sends? lz’s msg queues are per src addr. https://layerzero.gitbook.io/docs/faq/messaging-properties “STORED message will block the delivery of any future message from srcUA to all dstUA on the same destination chain and can be retried until the message becomes SUCCESS” The only way that can get gummed up is if redemption’s over, right?
Alex the Entreprenerd (judge) commented:
My understanding is any sender can block the queue as the receiver will revert.
That said if redemption is over, there’s no loss beside the risk of burning funds from the FTM side.
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 RedemptionReceiver contract did not implement LayerZero's non-blocking approach (or a way to force-resume the queue), so any reverting message from any sender could permanently block the channel.
Impact
An attacker could permanently block the LayerZero channel between FTM and Optimism, making the RedemptionSender and Receiver unusable; the judge noted that if redemptions were already complete, the only remaining risk was burning funds from the FTM side.
What the attacker needed
Ability to send a LayerZero message; message causes receiver to revert
The fix
The contract should implement LayerZero's non-blocking approach and a forceResumeReceive function to remove malicious messages from the queue.
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.
LayerZero is a system that sends messages between blockchains. Normally, if one message fails, the system stops processing later messages until the failed one is fixed. This contract did not use the safer option that skips failed messages, so anyone could send a message designed to fail and stop all future messages.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.