Functions that transfer funds (transferFeeClaim and batchTransferFeeClaim) in contract IDIVA.solcould be vulnerable to reentrancy attacks, especially if they call external contracts or functions that allow for callback execution.
transferFeeClaim and batchTransferFeeClaim transfer fees before updating internal balances.
If a malicious contract can reenter during the transfer, it can repeatedly drain the fee allocation.
The exploit relies on calling back into transferFeeClaim from within an external call.
Exploiters could repeatedly drain funds from the contract, causing significant financial losses.
Proof of Concept (PoC) demonstrating the Reentrancy Risk in transferFeeClaim and batchTransferFeeClaim.
Actors
Attacker: A malicious contract exploiting reentrancy.
Victim: The protocol (fee claim balance being drained).
Protocol: The vulnerable functions in IDIVA.
Proof of Concept (PoC)
Step-by-Step Exploit
Attacker contract requests a fee claim.
Protocol initiates transfer before updating balance.
Attacker reenters by triggering another transfer before the balance is updated.
Repeated calls drain the fee allocation.
Exploit Contract
Expected Outcome
The attacker drains all fee allocations by reentering before balances update.
The fee claim should have been updated before the external transfer, preventing reentrancy.
Mitigation Strategies
✅ Use Reentrancy Guard:
Apply nonReentrant modifier from OpenZeppelin’s ReentrancyGuard.
✅ Check-Effects-Interactions Pattern:
Update balances before making external calls.
✅ Use Pull Payments:
Let users withdraw funds instead of directly sending them.
Manual code review, static analysis tool
Use the checks-effects-interactions pattern: Perform state updates before external calls to prevent reentrancy.
Utilize reentrancy guards (e.g., nonReentrant modifier from OpenZeppelin) on functions transferring funds.
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.