Description:
Currently, when a match occurs, the funds allocated for liking multiple users are combined into a single multiSig wallet for the first match.
For example, if User A likes three users (User B, User C, and User D), the first match (e.g., between User A and User B) creates a vault that incorrectly includes all the funds User A has used to like other users. As a result:
Future vaults for User A’s matches with User C and User D will receive fewer funds than they should because User A has already contributed all their funds to the first vault.
User A effectively benefits from the funds of Users C and D, as they have ownership of the first vault without having contributed the correct amount specific to that match.
This issue arises because the userBalances mapping only tracks total user funds without differentiating whom the funds were intended for when the like action was performed.
In the function LikeRegistry::matchRewards()
, once a vault is created, the total rewards amount (excluding the protocol fee) is transferred to it. However, this amount is incorrectly derived from the entire balance of both matched users, regardless of how many users they previously liked.
Impact:
Critical. This issue misallocates funds every time a user likes more than one person. Some vaults receive more funds than they should, while others receive less. This misallocation affects fairness and could lead to users benefiting from funds they didn't contribute correctly.
Proof of Concept:
In the test testLikedMatchedUser(), three users are involved:
Alice (User A)
Bob (User B)
Fred (User C)
Alice likes both Bob and Fred, but when a match occurs between Alice and Bob, the vault incorrectly locks 3 ETH instead of only the 2 ETH that should be associated with their match. This means funds allocated for Alice → Fred are stuck in the vault.
Recommended Mitigation:
Instead of tracking a single balance per user, funds should be mapped per liked user to ensure correct allocation upon matching.
Modify the userBalances mapping to track who the funds were meant for, preventing unintended fund allocation when matches occur.
Then, update the matchRewards() function to only transfer funds allocated for the matched user, rather than the entire user balance.
This ensures that when User A matches with User B, only the funds allocated for that specific like are transferred to the vault, preserving fairness and preventing misallocation.
Likelihood: Medium, if anyone has 2 matches or more before reliking. Impact: Medium, the user won't contribute to the wallet.
Likelihood: Medium, if anyone has 2 matches or more before reliking. Impact: Medium, the user won't contribute to the wallet.
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.