The OrderBook contract should collect a 3% fee on all trades to generate protocol revenue. Users create sell orders with a specified price in USDC, and when bought, the protocol deducts fees before transferring payment to the seller.
The fee calculation uses integer division that rounds down to zero for orders priced at 33 USDC units or less, allowing attackers to create dust orders that completely bypass fee collection while cluttering the order book storage.
Likelihood:
Any user can exploit this by creating orders priced at 33 or fewer USDC units
No special conditions or complex setup required - simply call createSellOrder with low prices
Attack can be automated to create hundreds of fee-free orders
Impact:
Complete loss of protocol revenue on dust orders (100% fee bypass)
Permanent state bloat as each order consumes 7 storage slots even after completion
Order book pollution degrading user experience and order indexing
Enables wash trading and market manipulation without fee costs
This test demonstrates how an attacker can exploit the integer division precision loss to completely bypass protocol fees. By creating orders priced at exactly 33 USDC units, the fee calculation (33 * 3) / 100 = 0, allowing 100 dust trades that generate zero revenue for the protocol while cluttering the order book with spam.
Note: This fixes the fee bypass issue but doesn't completely prevent order book spam. Users could still create 1 wei orders at $10+ prices. Additional measures like minimum token amounts or order book size limits may be needed for complete spam protection.
Protocol Suffers Potential Revenue Leakage due to Precision Loss in Fee Calculation
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.