The function receiveMarketFee in FeeDistributionBranch contract call IERC20(asset).safeTransferFrom(msg.sender, address(this), amount) to transfer tokens from the caller to the contract which makes it vulnerable to reentrancy attacks.
After the external call, the function updates the state by calling market.depositFee(asset, amountX18) or _handleWethRewardDistribution(market, address(0), amountX18). If a reentrancy attack occurs, the attacker could manipulate the state or exploit the function multiple times before the state changes are applied
An attacker could call the function multiple times before the state is updated, effectively receiving fees or rewards multiple times for a single transaction.
It is always advisable to use openzeppelin reentrancy guard modifier to avoid or prevent reentrancy error when dealing with a contract that involves external call to another contract and since _handleWethRewardDistribution requires assets to be in the contract.
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.