The contract transfers seller tokens with safeTransferFrom
before recording the order in state. For example, in createSellOrder
:
This violates the Checks-Effects-Interactions pattern. If a malicious token implements callbacks (e.g. ERC777 hooks), it could re-enter the contract during the transfer and manipulate state before the order is recorded. SafeERC20 only reverts on failed transfers; it does not prevent reentrancy
Likelihood: Moderate
Core tokens (WETH, WBTC, WSOL) are standard ERC20s (no callbacks), but the owner can add arbitrary tokens. If a malicious token is added, reentrancy becomes feasible.
Without a nonReentrant
guard or reordering, any new token with callbacks could exploit these functions.
Impact: High
An attacker could, for example, trigger cancelSellOrder
or alter orders mid-execution, potentially freeing tokens or disrupting accounting. This could lead to theft of user tokens or corruption of order state.
Here, when createSellOrder
calls safeTransferFrom
, the malicious token’s transferFrom
re-enters and cancels order 1 before the contract records it, leaving inconsistent state.
Additionally, add a reentrancy guard to critical functions:
These changes ensure state is updated before transfers and prevent reentrant calls, eliminating the exploit vector.
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.