See Bellow
The createAuction function in the AuctionFactory
contract deploys new FjordAuction
contracts using the create2
opcode, which allows for the deterministic generation of contract addresses. The address generated by create2
is derived from the deployer’s address, a user-provided salt, and the bytecode of the contract being deployed. The function implementation is as follows:
The predictability arises because the salt
provided by the caller, combined with other known factors (like the bytecode and the address of the AuctionFactory
), allows anyone to calculate the address of the auction contract before it is deployed. If the salt
used is predictable, such as a simple sequential number or timestamp, an attacker could preemptively determine the address where the auction contract will be deployed.
An attacker could exploit the predictable nature of the auction contract address to perform actions such as pre-funding the address or deploying another contract at the address before the intended auction contract is deployed. This could lead to disruptions in the auction process or manipulation of the auction outcomes.
Manual
The salt
used in the createAuction
function should be derived from unpredictable sources. One approach is to generate the salt
using a combination of random values and hashes of current blockchain state variables, such as block timestamps and numbers, ensuring that it is unique and difficult to predict.
Example implementation:
This approach adds a check to ensure that the predicted address does not already have a contract deployed at it, preventing address collisions and mitigating the risk of exploitation due to predictable contract addresses.
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.