The use of a user-provided salt
for generating the request hash could be exploited by malicious actors to front-run transactions
Let's say we have two users: Alice (honest user) and Bob (malicious actor).
Alice wants to deposit a valuable NFT (ID: 42) from collection 0x123... to L2 address 0x456...
Alice prepares a transaction with these parameters:
salt: 1234
collectionL1: 0x123...
ownerL2: 0x456...
ids: [42]. Alice submits this transaction to the Ethereum mempool.
Bob, running a bot that monitors the mempool, sees Alice's transaction.
Bob quickly prepares a similar transaction with the same parameters, but changes the ownerL2
to his own address:salt: 1234
collectionL1: 0x123...
ownerL2: 0x789... (Bob's address)
ids: [42]
Bob submits his transaction with a higher gas price, ensuring it's mined before Alice's transaction.
Bob's transaction is processed first:
The request hash is generated using Bob's parameters.
The NFT is transferred to the bridge contract.
A message is sent to L2 to mint the NFT to Bob's L2 address.
When Alice's transaction is processed:
It will revert due to the NFT no longer being in Alice's possession.
In this scenario, Bob has successfully front-run Alice's transaction and stolen her NFT. This is because The salt
is user-provided and visible in the mempool. The request hash doesn't include any user-specific data that can't be replicated by an attacker. There's no mechanism to ensure that the person who initiated the deposit is the same person who owned the NFT.
frontrun attack possible. Poor Alice NFT will be stolen
Manual Review
Use commit reveal scheme. OR
req.hash = Protocol.requestHash(salt, collectionL1, ownerL2, ids, msg.sender);
OR
req.hash = Protocol.requestHash(userNonce[msg.sender]++, collectionL1, ownerL2, ids);
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.