Normally, the buyOrder
function transfers funds from the buyer to the seller and updates the order status to inactive after checks.
However, due to lack of a nonReentrant
modifier, an attacker could exploit the token being a malicious ERC20 that reenters the contract unexpectedly during safeTransfer
.
Likelihood:
Happens when a malicious ERC20 token with reentrancy vector is allowed or mimicked in test environments
Buy action is one of the most commonly executed operations, increasing exposure
Impact:
Reentrancy before state changes can bypass order deactivation or corrupt balances
May result in multiple token transfers for a single USDC payment, draining escrow
Attacker deploys malicious ERC20 with reentrancy in transfer()
Attacker creates order, buyer buys triggering buyOrder()
During transfer, attacker reenters and calls buyOrder again
Leads to repeated withdrawals
Import reentrancyguard library from openzeppline and applu nonReentrant to function buyOrder() and cancelSellOrder()
Create Mutexes or Locks in code blocks and follow Checks-Effects-Interactions.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
View preliminary resultsAppeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.