DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Possibility of Creating Two Equal Auction Addresses

Summary

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.

Vulnerability Details

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:

address auctionAddress = address(
new FjordAuction{ salt: salt }(fjordPoints, auctionToken, biddingTime, totalTokens)
);

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.

Impact

The ability to generate the same contract address with create2 poses a risk in the following scenarios:

  1. 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.

  2. 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.

Recommendations

  1. Unique Salt Management: Ensure that the salt parameter is unique for each auction creation. Implement mechanisms to validate unique salts to avoid address collisions.

  2. 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.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.