Bridge.sol
contract currently lacks explicit mechanisms to prevent replay attacks, which could pose a security risk
The contract is susceptible to replay attacks without mechanisms to track and prevent the reuse of request hashes.
Request Hash Storage: The contract does not maintain a record of processed request hashes. This omission allows the possibility of replaying the same request if its hash is not verified for uniqueness.
Message Consumption: Although the _consumeMessageStarknet
function is utilized for message processing, it does not appear to mark requests as completed or prevent their reprocessing.
Absence of Nonce or Timestamp: The contract does not incorporate a nonce or timestamp in its requests, which are essential for ensuring that each request is unique and processed only once.
Without tracking the uniqueness of request hashes, attackers could potentially replay valid requests, resulting in unauthorized or duplicate actions which might result in the unintended transfer of assets, leading to financial losses
Manual review
A mapping is introduced to store hashes of processed requests:
Before processing any request, verify if the hash has already been processed. If it has, revert the transaction to prevent duplicate processing. Once a request is processed, store its hash to ensure it cannot be reused:
Consider implementing a mechanism to clear stored hashes after a specified period to manage storage efficiently.
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.