Normal behavior: When a contract interacts with external addresses (e.g., ERC20 transfers), it should update critical state variables before making those calls to prevent reentrancy attacks, or use a reentrancy guard modifier.
Specific issue: In functions such as amendSellOrder, the contract makes external calls (e.g., safeTransfer, safeTransferFrom) before updating the order's state variables. If a malicious token is allowed (accidentally or via governance), it could attempt a reentrant call during its transfer logic, potentially leading to state inconsistencies or exploitation.
Likelihood:
Reason 1: If a non-standard or malicious ERC20 token is allowed, it can execute arbitrary code within transfer or transferFrom functions.
Reason 2: This is a recognized class of vulnerability, and many security researchers and attackers scan for such patterns in DeFi protocols.
Impact:
Impact 1: Reentrancy could allow state manipulation, causing order amounts, ownership, or funds to become inconsistent or exploited.
Impact 2: Even if only standard tokens are allowed, this is a bad precedent and may be overlooked in future upgrades or with governance changes.
Explanation: This PoC highlights the risk of external calls before state update, which can be exploited if a malicious token is whitelisted.
Explanation: Always update state before external calls, and strongly consider a reentrancy guard for any function that interacts with external contracts.
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.