The LikeRegistry contract is intended to pool user payments and distribute rewards when two users mutually like each other. However, due to a logical oversight in the likeUser
function, users’ ETH deposits are never recorded in the userBalances
mapping. This omission disrupts the reward mechanism and may result in user funds being locked within the contract, undermining both its functionality and financial integrity.
Missing Balance Update:
When users call the likeUser
function and send ETH, the deposited amount (msg.value
) is not added to the userBalances
mapping. Consequently, even though funds are received, they are not attributed to the sender’s balance.
Broken Reward Calculation:
The matchRewards
function attempts to pool funds from two matched users by reading their balances from userBalances
. Since these balances remain at zero, the calculated rewards are always zero. This leads to the failure of the intended reward distribution process.
Fund Locking and Economic Disruption:
Without updating userBalances
, the contract’s economic model is broken. Deposited funds are effectively trapped in the contract, as there is no mechanism for users to withdraw their unaccounted funds, which can result in financial losses.
Severity Level:
High. Although this vulnerability does not allow for an attacker to directly steal funds, it critically undermines the core functionality of the contract and risks locking substantial user funds, potentially leading to significant financial and reputational harm.
Loss or Locking of Funds:
Users’ deposits may remain permanently locked in the contract, as they are not properly recorded or allocated, leading to potential loss of funds.
Disruption of Core Functionality:
The fundamental feature of rewarding mutual likes fails because the reward mechanism relies on user balances that are never updated. This failure disrupts the intended economic model and user incentives.
Reputational and Legal Risks:
The mishandling of user funds can erode trust in the platform, potentially exposing the project team to legal challenges and reputational damage.
Manual Code Review:
A detailed line-by-line analysis of the contract was performed to understand its intended flow and identify logical discrepancies.
Implement Balance Updates:
Modify the likeUser
function to update the userBalances
mapping with the deposited amount. For example:
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.