The buyOrder
function assumes the full amount of tokens specified in the order (order.amountToSell) will be transferred to the buyer (https://github.com/CodeHawks-Contests/2025-07-orderbook/blob/fdef247b2f2bd7c0f9c19310406c8e072d9ffda4/src/OrderBook.sol#L207). This is true only if the token implements a standard ERC-20 transfer behavior, i.e., it does not apply a transfer fee. However, tokens with fee-on-transfer mechanics (such as SafeMoon, Reflect Finance, etc.) will deduct a portion of the tokens during transfer, causing the buyer to receive less than the promised amount.
The setAllowedSellToken function enables the owner to allow arbitrary tokens for selling without verifying whether they are fee-on-transfer tokens. As a result, the owner may allow such a token, breaking trade integrity.
Likelihood:MEDIUM
this will occur Whenever the owner whitelists a token without knowing it applies transfer fees
-When a user places an order using a whitelisted fee-on-transfer token
Impact:
-Buyers will receive fewer tokens than expected, resulting in silent value loss
-Protocol reputation is damaged due to inconsistent trade outcomes and user distrust
-Buyer receives only 90 tokens after paying full price, silently losing value
You can implement isFeeOnTransferToken off-chain or use a static whitelist of trusted, well-known non–fee-on-transfer tokens like WETH, WBTC, USDC e.t.c
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.