Submitted by 0xRajeev, also found by cmichel
The prepare() function  hashes the invariantData parameter data to check the mapping entry is 0 for that digest as a measure to prevent duplicate prepare()s. However, an attacker can abuse this check to front-run a targeted victims prepare Tx with the same parameters and with some dust amount to prevent the users actual prepare Tx from succeeding.
The impact of this the potential griefing attack vector if user address is not msg.sender. This is with the assumption that relayers are only relevant on the receiving side where the user may not have the receivingAssetId i.e. no reason for msg.sender of prepare() to be the relayer and not the user.
Recommend adding msg.sender == invariantData.user check on sending chain side similar to the check for router address on the receiving side.
LayneHaber (Connext) confirmed and patched:
LayneHaber (Connext) acknowledged:
