The buyOrder function is vulnerable to front-running attacks because it does not protect against malicious actors monitoring the mempool and outbidding legitimate users. An attacker can observe a legitimate user’s transaction in the mempool, copy their parameters, and submit a higher bid with a higher gas fee to ensure their transaction is mined first. This undermines the fairness of the marketplace and could discourage users from participating.
The buyOrder function processes transactions in a way that allows attackers to front-run legitimate users. Since Ethereum transactions are publicly visible in the mempool before they are mined, an attacker can monitor pending transactions and submit a competing transaction with a higher gas fee to ensure it is processed first. This is particularly problematic in auctions or marketplaces where the first valid transaction wins.
Medium Impact: Legitimate users may lose out on purchasing NFT fractions because attackers can front-run their transactions.
Marketplace Fairness: The fairness of the marketplace is undermined, as attackers can exploit the system to their advantage.
User Dissatisfaction: Users may be discouraged from participating in the marketplace if they perceive it as unfair or exploitable.
Aderyn, Foundry
To prevent front-running, consider implementing one of the following mechanisms:
Commit-Reveal Scheme
A commit-reveal scheme ensures that bids are hidden until the reveal phase, making it impossible for attackers to front-run legitimate users.
Implementation Example:
Dutch Auction or Minimum Bid Increment
A Dutch auction or minimum bid increment mechanism reduces the incentive for front-running by making it less profitable for attackers to outbid legitimate users.
Implementation Example:
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.