Submitted by cmichel
The postIncomingMessages function calls _callReceiverContract(fromChainHash, messages[i], startingCounter + 1) which gives control to a contract that is potentially attacker controlled before updating the incomingMessageCounter.
The attacker can re-enter into the postIncomingMessages function and submit the same messages again, creating a replay attack.
Note that the startingCounter is the way how messages are prevented from replay attacks here, there are no further nonces.
Attacker can submit two cross-chain messages to be executed:
Some node submits the postIncomingMessages(params) transaction, transfers 1000 USDC, then calls the attackers contract, who can themself call postIncomingMessages(params) again, receive 1000 USDC a second time, and stop the recursion.
Add a messageInProgressLocker modifier to postIncomingMessages as was done in MessageProxyForMainnet.
cstrangedk (SKALE) resolved:
Resolved via https://github.com/skalenetwork/IMA/pull/1054
