TokeDivider contains a reentrancy vulnerability in the buyOrder function, which can be exploited by draining the contract’s balance through malicious fallback.
Affected code line 292 -296
When transferring Ether to the seller using the call method, external code is triggered in the seller’s fallback or receive function. If the external contract is malicious, it can repeatedly invoke the buyOrder function before the state is updated, allowing it to drain all the funds from the contract. The above code shows the order.seller enabling malicious contract to exploit the vulnerability by calling buyOrder within the fallback
Attacker is able to;
Drain all funds in the TokenDivider contract
Cause denial-of-service (DOS) by depleting contact’s liquidity
Foundry
Use checks-effects interaction pattern by updating the buyOrder function to ensure state changes occur before external calls. Incorporate the ReentrancyGuard from OpenZeppelin to prevent nested calls
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.