##Description
Normally, when a buyer interacts with the buyOrder function, they assume the order details ( the amount of tokens being sold and the price) are stable and trustworthy, having read them moments before.
However, the buyOrder function does not validate that the order's amountToSell or priceInUSDC match the buyer’s expectations. A malicious seller can frontrun the buyer and amend their order just before the buyer’s transaction is mined, reducing the token amount but keeping the price unchanged, causing the buyer to overpay and receive fewer tokens.
##Risk
Likelihood: HIGH
This will occur when a buyer places a transaction to buy an order and the seller frontruns the buyer in the same block by modifying the order using amendSellOrder.
Since mempool access is public and sellers control their own orders, this is trivial to perform and profitable in many scenarios.
Impact:
Buyers may lose significant value by receiving fewer tokens than expected while paying the full USDC price.
Trust in the protocol’s fairness and correctness is compromised, especially in high-volume or volatile token markets.
##Proof of Concept
-Alice creates an order to sell 2 WBTC for 180_000 USDC
-Dan reads order off-chain and prepares a transaction to buy it
-Alice frontruns and reduces the amount to 1 WBTC, keeping price the same
-Dan sends USDC and calls buyOrder without re-reading
-Dan ends up receiving only 1 WBTC for 180,000 USDC
##Recommended Mitigation
This ensures the buyer’s expectations match the actual on-chain order state and prevents value loss from frontrunning modifications.
A malicious seller can front-run a buy order for their order, and decrease the amount of assets to be sold. If the price is unchanged, the buy transaction fulfills, but the buyer gets lesser amount than expected.
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.