The function withdrawFees() is vulnerable to reentrancy attack since it doesn’t respect the CEI pattern
A malicious owner could implement an USDC token contract to withdraw all the USDC funds inside the contract, not just the fees that orders have generated
Few requirements are needed :
The owner has to be the malicious contract, otherwise it can’t call withdrawFees function on his callback (since onlyOwner modifier is used)
The malicious contract needs to override transfer() function
Likelihood:
if the owner is using a malicious token contract instead of the official USDC contract
if USDC balance of the Orderbook contract is greater than the totalFees amount
Impact:
all the USDC funds of the contract can be stolen
Respect the CEI pattern
`withdrawFees()` function performs an external transfer using `iUSDC.safeTransfer()` before resetting totalFees. This breaks the `Checks-Effects-Interactions (CEI)` pattern and can lead to incorrect internal state if the transfer fails for any reason.
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.