The FeeCollector contract has a vulnerability where changing fee distribution rates via updateFeeType() can lead to incorrect distribution of previously collected fees. When fee type rates are updated, there is no mechanism to ensure that pending undistributed fees are handled according to the rates that were in effect when they were collected.
Admin updates fee rates before distribution:
Distribution occurs using new rates for all collected fees:
As a side note, it should be observed that _processDistributions() called from inside distributeCollectedFees() can revert at if (contractBalance < totalFees) revert InsufficientBalance();. So simply calling it before updateFeeType() may not be sufficient as a mitigation to the issue.
Incorrect Distribution: Fees collected under one rate structure could be distributed using different rates, violating the expected distribution rules at the time of collection.
Force distribute any pending fee first before updating with new fee values.
Alternatively, make an entry inside some variable so that they can be distributed later. This will require additional code to make sure new fee values do not effect this old fund of pending fees.
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.