The buy()
function in the Auction
contract is vulnerable to front-running attacks due to its strict validation of purchase amounts against remaining tokens. When a user attempts to purchase the exact remaining amount of tokens, an attacker can front-run their transaction with a small purchase, causing the victim's transaction to revert.
Let's take as an example the scenario where the user wants to buy the amount of 200(totalRemaining
):
Attacker front-runs user transaction and buy 1 unit only, now the totalRemaining is 199
Now user transaction reverts and user misses the opportunity of buy the 200 in that desired price
Users can be prevented from purchasing their desired token amount
Denial of Service through repeated front-running
Loss of opportunity to buy at specific price points, as auction price changes over time
Manual Review
Modify the buy()
function to handle partial fills by adjusting the purchase amount to the remaining balance:
Additionally, a minimum amount to be bought can be enforced.
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.