The createAuction function in the AuctionFactory contract uses the create2 opcode to deploy the FjordAuction contract. This approach allows for deterministic contract addresses based on the salt parameter. A concern arises regarding whether it is possible to create two contracts with the same address if the same salt and parameters are used.
The create2 opcode in Solidity generates a contract address based on the deployment bytecode and a unique salt value. This address is deterministic and can be computed off-chain given the same salt and initialization parameters. The createAuction function passes a salt to create2:
If two separate transactions or calls use the same salt and deployment parameters, they will generate the same auctionAddress. This is due to the deterministic nature of create2.
The ability to generate the same contract address with create2 poses a risk in the following scenarios:
Security Vulnerabilities: If a contract at the generated address is assumed to be unique and is instead replaced or manipulated due to address collisions, this could introduce security vulnerabilities or unexpected behavior in the system.
Operational Risks: For systems relying on unique contract addresses for functionality, creating multiple contracts with the same address can lead to operational issues, confusion, and potential system failures.
Unique Salt Management: Ensure that the salt parameter is unique for each auction creation. Implement mechanisms to validate unique salts to avoid address collisions.
Address Collision Checks: Before creating a new auction contract, implement checks to ensure that the intended address does not already exist or is not in use by another contract, if feasible within the system's design.
By implementing these recommendations, the risk associated with address collisions due to the deterministic nature of create2 can be effectively mitigated, ensuring the integrity and security of the deployed contracts.
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.