The matchRewards
function in the LikeRegistry
contract transfers the entire balance of matched users instead of only 1 ETH per match. This flaw allows users to lose more ETH than expected, making the system prone to fund mismanagement and unintended financial loss.
The matchRewards
function retrieves and transfers the entire balance of the matched users rather than only 1 ETH per match. This is due to the following lines:
These variables store the total user balance instead of just 1 ETH, leading to excessive ETH transfers when a match occurs. If a user has deposited more than 1 ETH across multiple likes, all of it will be used in a single match.
Once a user is matched, all of their stored ETH is moved to a MultiSig wallet, without any way to withdraw excess funds or reclaim unused ETH.
Users cannot cancel a pending match or opt out before their balance is deducted.
A user can match with the same person multiple times since there is no tracking of past matches, allowing potential reward farming and unintended fund loss.
Loss of Excess ETH: Users may lose more ETH than intended, as the contract does not enforce a 1 ETH limit per match.
No Fund Recovery: Once ETH is transferred to the MultiSig wallet, it cannot be withdrawn by users.
Potential Reward Exploitation: Users could repeatedly match with the same person to farm rewards, increasing the risk of fund misallocation.
Manual code review
Limit Transfers to 1 ETH per Match
Modify the balance deduction logic to only transfer 1 ETH per match:
Implement a Refund Mechanism
Add a function allowing users to withdraw unspent ETH before getting matched:
Track Previous Matches to Prevent Abuse
Introduce a mapping to prevent duplicate matches:
Before adding a new match:
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.