Submitted by 0xTheC0der, also found by d3e4 and oakcobalt
Sending OFTs with a composed message via LayerZero V2 involves 2 transactions on the destination chain (Canto) according to the documentation (see also README):
The above steps are processed in separate transactions (not atomic) and step 2 requires the OFTs to be already transferred to the ASDRouter contract.
Furthermore, due to the permissionless nature of the execution step, the lzCompose() method does not enforce any constraints on the msg.sender; therefore, allows anyone to invoke it.
Attack path:
An adversary can monitor the ASDRouter contract for whitelisted incoming USDC-like OFTs and immediately use those on their own (redeem asD) by crafting & invoking a call to lzCompose() before an executor does. As a consequence, user funds are directly stolen.
Similarly, if lzCompose() fails for any reason, an adversary can re-try before the user to use the OFTs.
The dual transaction nature of the current composed message process is confirmed by the LayerZero documentation:
Moreover, crafting a successful call to lzCompose() once OFTs are deposited is demonstrated by the existing test case lzCompose: successful deposit and send on canto.
Immediate, but not a satisfying fix: Restrict the lzCompose() method to trusted/whitelisted executors.
Alternative: Design change by directly implementing _lzReceive() (building an OApp) such that a composed message is not needed anymore.
Invalid Validation
3docSec (judge) commented:
dsudit01 (Canto) confirmed and commented:
