Normally, buyers are expected to purchase orders listed by sellers at a known and agreed-upon price (priceInUSDC
) and quantity (amountToSell
). Buyers approve the USDC token and call buyOrder(orderId)
expecting that the purchase terms remain static during transaction execution.
An attacker can frontrun a buyOrder
transaction that is targeted to his own open limit order in the book by calling amendSellOrder
right before it executes. This allows the attacker to increase the priceInUSDC
or decreaseamountToSell
, resulting in the buyer unintentionally overpaying. If the buyer has given a larger token allowance (as is typical), the contract will pull a higher amount of USDC than anticipated.
Likelihood:Medium
Reason 1: This only occurs if a buyer submits buyOrder
and has given a larger-than-needed USDC allowance.
Reason 2: An attacker can only frontrun buyOrder()
transactions to their own open limit orders since protocol only allows amending your own orders
Impact:High
Impact 1: Buyer can be forced to overpay, resulting in unexpected fund loss.
An attacker can frontrun a buyOrder by calling amendSellOrder and increasing the priceInUSDC or decreasing amountToSell. If the buyer has given a large USDC allowance, they’ll unknowingly overpay when their transaction executes, resulting in unintended fund loss.
Require buyers to pass the expected priceInUSDC
and expectedTokenAmount as parameter to buyOrder
. If the on-chain price doesn’t match, revert the transaction. This prevents price manipulation between transaction submission and execution.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
View preliminary resultsAppeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.