Submitted by klau5, also found by Moksha, fyamf, NexusAudits, Abdessamed, gajiknownnothing, Tigerfrake, ABAIKUNANBAEV, 0xAsen, pwnforce, Daniel_eth, atoko, avoloder, AllTooWell, 0xNirix, SBSecurity, Draiakoo, peanuts, rbserver, haxatron, said, mojito_auditor, shaflow2, bhilare_, kutugu, devival, Shaheen, and Breeje
The handler does not prevent tokens from being sent to incorrect chains and handlers. If a message is sent to an incorrect handler, the failure cannot be handled through receive_cross_chain_callback.
Handler.cross_chain_erc20_settlement does not check if to_chain and to_handler are whitelisted. Therefore, its possible to send messages to any chains and handlers that arent paired with this handler.
If a non-contract address is set as to_handler, the transaction will revert when trying to call Handler.receive_cross_chain_msg on the destination chain. As a result, its impossible to emit an event to signal the failure, making failure handling impossible.
Theres another problem. If a non-whitelisted handler requests a message, Handler.receive_cross_chain_msg will return false to indicate failure. Validators listen for the CrossChainHandleResult event to notify the source chain of the failure through receive_cross_chain_callback, allowing the handler to process the failure.
However, Handler.receive_cross_chain_callback only allows callback messages from whitelisted chains and handlers. This means that when a message is sent to an incorrect handler and fails, the callback notifies of the failure, but the source chains handler ignores and cannot handle the failure caused by the incorrect handler.
Therefore, Handler.cross_chain_erc20_settlement should check that to_chain and to_handler are whitelisted to prevent message transmission to incorrect handlers in the first place.
0xsomeone (judge) commented:
