A reentrancy vulnerability exists in the claimFees
function of the FeeDistributionBranch
contract, where state updates occur before an external token transfer. This could allow an attacker to reenter and claim fees multiple times before the first claim completes.
The claimFees
function performs state updates through accumulateActor
before executing an external token transfer, violating the Checks-Effects-Interactions (CEI) pattern. This order of operations creates a reentrancy risk.
Attacker calls claimFees
Contract updates reward state via accumulateActor
Before safeTransfer
completes, attacker reenters claimFees
Original state updates are still valid, allowing another claim
Process repeats until funds are drained
The impact of this vulnerability is severe. An attacker could repeatedly withdraw the same fee amount multiple times in a single transaction, potentially draining all available fees from the contract. This would also corrupt the reward accounting system, leading to an inaccurate record of distributed rewards and undermining the entire fee distribution mechanism. The economic damage could be significant, affecting both the protocol and legitimate users expecting their rightful fee distributions.
Add OpenZeppelin's ReentrancyGuard:
Restructure to follow CEI pattern:
Make Distribution library functions atomic:
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.