Nonce is not included in message consumption from L2, this can cause replay attacks or hash collisions when users consume messages from L2
When the user calls the depositTokens
function, it contains a function to send a message from L1 to L2 with the sendMessageToL2
function. This function has a return of msg.hash
and nonce
. Then when the user wants to withdraw NFT from L2 with the withdrawTokens
function, the _consumeMessageStarknet
function in the Messaging.sol
contract is called.
As can be seen from the code above, there is no nonce
checking and the use of nonce
as msg.hash
. This can cause a replay attack if in the future ArkNFT
will be deployed on a different chain or hash collision.
This can cause replay attack or hash collision when users consume messages from L2
Manual Review
Make sure the user who owns the Request
consumes the message from L2 according to the transaction nonce
of the message sent from L1 to L2. This can be done by adding a variable to the Request
struct and validating it when calling the _consumeMessageStarknet
function.
There is no impact here: Transaction cannot be replayed because the blockchain use the nonce in the signature. Hash is computed on-chain. Using or trying to have the same hash mean you need to buy the token, and they will be sent to their origin owner. Why an attacker would buy tokens to give them back ? No real impact.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.