The LikeRegistry
contract had a vulnerability in its fee calculation logic, where the total fees collected were not accurately updated based on the fixed fee percentage.
The contract's matchRewards
function is responsible for calculating and deducting a fixed percentage fee from the total rewards distributed to matched users. However, due to incorrect calculations or state updates, the totalFees
variable were not accurately reflect the cumulative fees collected over time.
If the fixed fee percentage is set at 10%, and two users are matched with a total reward of 2 ETH, the expected fee should be 0.2 ETH. If the contract fails to add this amount to totalFees
, it results in an underreported fee collection
Below is the POC:
I run the below POC by forge test --match-test testFeeCalculationInvariant -vvv
and this was the result
If the user balances are not updated then there would be 0 rewards send to multisig wallet.
Foundry invariant testing
Update the user balances when user calls the function likeUser. After incorporating this line I ran the POC again and this was the result
Likelihood: High, always. Impact: High, loss of 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.