A malicious actor could front-run the initializefunction in Bridge.sol.
The initializefunction is public which means anyone can call the function. Attackers could keep track of the contract deployments and be the first to call initialize function which rendered the deployed contract likely malicious, causing the deployer to redeploy the contract which the attacker will keep track of and front-run the initialize call function again and again.
The attacker gains full control over the contract, including the ability to change critical settings, withdraw funds, or execute privileged functions. Furthermore, a willing attacker could continuously monitor every deployment of this contract and front run the initializefunction causing huge gas cost to be wasted, ultimately a huge financial loss for the deployer.
Manual Review
An alternative would be perform all the initialization on the constructor. But, if the initializefunction must be used no matter what, then consider removing the transfer ownership logic in the initializefunction (this makes the deployer of the contract the current owner because of openzeppelin Ownable modifier), then create a function to use the transferOwnership function from openzeppelin somewhere in Brdige.sol:
So, after deployment, the deployer of the contract should call this function if any more ownership change is necessary.
If frontrun at the first deployment, protocol will deploy again, no real impact: informational. Moreover it is already deployed and initialize on mainnet. For the upgrades, `initialize` can/will change for the next update since the owner is already set. A lot of protocol make that change. That’s why I consider it like a future feature and it is out of scope.
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.