The function collectFee transfers raacToken from msg.sender before updating the collected fees
If raacToken has an external contract with a callback function, this could lead to a reentrancy attack where the attacker could execute a reentrancy attack.
The attacker deploys a malicious contract that implements a callback function inside the raacToken.safeTransferFrom() method. This callback gets triggered during the token transfer.
collectFeeThe attacker invokes collectFee(amount, feeType), sending raacToken from their malicious contract.
_updateCollectedFees()Since safeTransferFrom() executes the transfer before _updateCollectedFees(), the attacker’s contract re-enters collectFee in the middle of execution.
collectFee AgainWhile collectFee is still running:
The attacker re-enters collectFee().
The contract still assumes the initial fee hasn't been collected yet.
The attacker manipulates the fee collection mechanism by invoking collectFee multiple times before the state is updated.
Because _updateCollectedFees(amount, feeType) has not yet executed, the contract doesn’t realize that the attacker has already collected fees multiple times. The attacker repeats this until they exhaust all contract funds.
Manual review
Use the checks-effects-interactions pattern by updating collected fees before transferring tokens.
Safer approach:
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.