OrderBook::buyOrder
function is vulnerable to front-running attack as it does not specify a minimum amount of tokens to buy. In case of a front-run, the buyer will receive less tokens than expectedOrderBook::buyOrder
function is used to buy an order, however it does not specify a minimum amount of tokens to be received and that makes it vulnerable to front-running attacks
The seller sees the buyOrder transaction in the mempool, it calls the OrderBook::amendSellOrder
to sell less tokens for the same amount of money and when the buyOrder is executed, the buyer receives less tokens than expected
Likelihood:
This vulnerability can occur every time the buyOrder is called and the seller sees the pending transaction in the mempool and front-runs it
Impact:
The buyer will receive less tokens than expected
As we can see in the following PoC, Dan received 1e6 tokens instead of 2e8 that he wanted to buy
I see 2 different solutions. The first solution is to remove the amendSellOrder functionality. In this case, the seller will be unable to modify the amount of tokens for sale. If the team wants to keep this functionality, my second solution is to add a minAmountTokens parameter to the function the will be responsible for the amount of tokens to be received by the buyer
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.