The sendToL1 function in the provided code does not validate if the msg.sender is the actual signer of the message. This allows any user to potentially steal funds by re-sending a previously signed message.
The sendToL1 function first recovers the signer's address from the provided signature and then proceeds with the execution of the transaction. However, it does not check if the msg.sender (the caller of the function) matches the recovered signer's address. This means that any user can impersonate the signer by re-sending a previously signed message and steal funds from the contract.
Concrete example : An attacker can send Token on the vault, ask for a withdraw, and replay infinitely this withdraw to steal all tokens.
Foundry (in test file) PoC:
This vulnerability allows any user to steal funds by replaying a previously signed withdraw transaction. The potential impacts include:
Unauthorized fund transfers: An attacker can resend a previously signed message, tricking the contract into executing the transaction and transferring funds to their desired target address.
Financial loss: Users who expect their transactions to be secure may fall victim to unauthorized fund transfers, resulting in financial losses.
Manual review
To mitigate this vulnerability, it is crucial to validate that the msg.sender matches the actual signer of the message. This can be done by comparing the recovered signer's address with msg.sender before executing the transaction. If they do not match, the function should revert and reject the transaction.
Here is an updated version of the sendToL1 function with the signer validation:
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.