The LikeRegistry contract has a critical issue where the likeUser function does not update the userBalances mapping when a user sends ETH. As a result, the deposit funds are never recorded leading to operate matchReward on zero balances.
The likeUser function in the likeRegistry
contract never updates the usersbalances
mapping to credit the sender’s balance with the deposited ETH. Consequently, when a mutual like is detected, the matchRewards
function computes rewards using zero balances from both the users. This oversight prevents the proper accumulation and distribution of rewards and all the funds remains in the likeRegistry
contract, as the deposited funds are not tracked.
Here's the poc code to demonstrate the issue to run against foundry:
To run this test use the following command:
Mint two Users profile by calling the mintProfile.
Make the users like themselves by calling the LikeRegistry
function.
Call the withdrawFees function and you will get the error ”No fees to Withdraw.”
Incorrect Reward Calculation:
Since the userBalances
mapping never updated, the Reward calulation in matchRewards
always results in 0 ETH being available for distribution, even though users have sent funds.
Funds Minsmanagement:
The ETH sent by users will remain in the contract without being properly allocated, leading to potential fund mismanagement or unintended locking of user deposits.
Economic Incentive Failure: Users expecting to earn rewards for mutual likes will not receive any payouts, potentially undermining trust and participation in the platform.
Manual Review
Foundry
Update the User Balance: Modify the likeUser
function to update the userBalances
mapping with the ETH sent. For instance, immediately after the validation checks, add:
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.