In a typical token trading system, the buyOrder()
function allows a buyer to purchase tokens from a seller at a fixed price. The expected behavior is that only external users (non-sellers) are able to fill an order posted by a seller.
However, the current implementation of buyOrder()
does not prevent the seller from calling the function themselves, effectively letting them buy their own order. This opens up the door for protocol fee manipulation, wash trading, and false volume generation.
Likelihood:
This occurs whenever a seller deliberately calls buyOrder()
on their own order.
This behavior is likely during protocol fee farming, volume manipulation, or testing price behavior.
Impact:
Protocol Fee Evasion: The seller pays themselves, effectively recycling funds, but still earns protocol rewards.
Wash Trading: Creates fake trading volume, harming protocol analytics and misleading users.
Misuse in Incentive Programs: If rewards are tied to buy volume or activity, this can be exploited.
Step-by-step walkthrough:
A user (0xSeller
) creates a sell order offering to sell 100 tokens for 100 USDC:
The order
is now active and available in the marketplace.
The seller (0xSeller
) then calls:
Since there's no restriction in the code to prevent the seller from buying their own order, the transaction succeeds:
0xSeller
pays 100 USDC to themselves.
The protocol still collects a protocol fee.
Trading volume is recorded even though no actual trade happened.
If the protocol has a reward system based on volume or participation, the seller falsely earns rewards.
Misrepresents real volume (wash trading)
Abuses incentives tied to buys/sells
Bypasses intent of fees or buyer-seller separation
This can lead to manipulation, protocol misuse, or bad analytics that impact both governance and users.
Add a simple check in buyOrder()
:
This ensures sellers cannot fill their own orders and enforces correct trade flows.
✅ Final Code Snippet (Mitigated Version)
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.