Normal Behavior:
When a user creates or amends a sell order, the contract calls safeTransferFrom to pull the specified amount of tokens from the user and records this amount as amountToSell in the order struct. When a buyer fills the order, the contract transfers exactly this recorded amount to the buyer.
Specific Issue:
The contract assumes that all ERC20 tokens are standard and that the amount requested in safeTransferFrom will be received by the contract. However, with fee-on-transfer tokens, rebasing tokens, or other non-standard ERC20s, the contract may receive less than the requested amount, while still recording the full amount in the order. This can result in unfillable orders, failed trades, or locked funds.
Likelihood:
This will occur whenever a non-standard ERC20 token (such as a fee-on-transfer or rebasing token) is added to the allowed list via setAllowedSellToken.
The owner may accidentally or intentionally allow such tokens, or token behavior may change after allowlisting.
Impact:
Buyers will be unable to fill orders because the contract does not actually possess the promised amount, causing transaction failures.
Funds may become locked in the contract, resulting in stuck orders and user losses.
Explanation:
This Proof of Concept demonstrates how a malicious or simply non-standard ERC20 token (such as a fee-on-transfer or rebasing token) can cause the contract to mis-account tokens, leading to unfillable and stuck orders.
Explanation:
By measuring the token balance before and after the transfer, the contract records the actual amount received, regardless of token mechanics. This ensures that orders can always be filled and prevents the possibility of locked or unaccounted funds.
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.