The listOffer function in the contract is vulnerable to front-running attacks. An attacker can exploit this vulnerability by observing pending transactions in the mempool and submitting their own transaction with higher gas fees to manipulate the order of execution, potentially causing financial losses for users by taking advantage of changes in market conditions or the behavior of other users' transactions.
The listOffer function allows users to list their offers in the marketplace. However, due to the lack of mechanisms to prevent front-running, an attacker can monitor the mempool for listOffer transactions and submit their own competing transaction with a higher gas price. This allows the attacker to have their transaction mined before the victim's transaction, potentially manipulating the market or capturing arbitrage opportunities at the expense of the original user.
The front-running vulnerability can lead to the following impacts:
Financial Loss for Users: Users may lose out on favorable market conditions or arbitrage opportunities due to front-running.
Market Manipulation: Attackers can manipulate the order of transactions, affecting the integrity and fairness of the marketplace.
User Trust: The presence of such vulnerabilities could erode user trust in the platform, leading to decreased usage and reputation damage.
Manual Code Review
Introduce a commit-reveal scheme for the listOffer function to prevent attackers from knowing the offer details in advance. Here's an example implementation:
Commit Phase:
Private Function _listOffer:
Add a delay mechanism to prevent immediate listing:
Encourage users to use randomized gas prices by providing a utility function:
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.