The buyOrder()
function do the following operations:
Transfers USDC from buyer to protocol and seller
Transfers the sold token to the buyer
These are multiple external token transfers that interact with untrusted user-controlled addresses, but the function lacks a nonReentrant
modifier.
Likelihood:
Reentrancy may be triggered by a malicious token contract using a receive()
or fallback()
function.
This would happen during token transfers, especially if the state is updated after or during external calls.
Impact:
Double-purchase of the same order
Theft of funds via recursive execution
Inconsistent state in orders
or orderFills
mappings
MaliciousToken
simulates a malicious actor. It initiates the attack by calling buyOrder()
.
During the external call (like token transfer), the fallback function is triggered. The fallback re-calls buyOrder()
recursively before the first call finalizes. Without nonReentrant
, this can exploit state inconsistencies or double spending.
Add a reentrancy guard modifier to key functions like buyOrder
.
Apply the modifier to functions like:
Or you might import and apply ReentrancyGuard
from OpenZeppelin
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.