The LikeRegistry
contract contains a critical vulnerability in its ETH accounting mechanism. When users send ETH via the likeUser
function, the ETH is not properly tracked in the userBalances
mapping. As a result, the matchRewards
function, which relies on userBalances
to calculate rewards for matched users, always calculates rewards as zero. This leads to all ETH sent by users being permanently stuck in the contract, rendering the matching and reward distribution mechanism non-functional.
Contract: LikeRegistry.sol
Functions: likeUser
and matchRewards
ETH Tracking Issue:
In the likeUser
function, users send ETH (msg.value
) to express a "like" for another user. However, the contract fails to update the userBalances
mapping to reflect the ETH sent.
The userBalances
mapping is used in the matchRewards
function to calculate the rewards for matched users. Since userBalances
is never updated, it remains zero for all users.
Reward Calculation Issue:
The matchRewards
function calculates rewards based on the sum of userBalances
for the two matched users. Since userBalances
is always zero, the calculated rewards are also zero.
As a result, no ETH is sent to the MultiSig contract, and all ETH sent by users remains stuck in the LikeRegistry
contract.
likeUser
Function (Incorrect Implementation)matchRewards
Function (Incorrect Reward Calculation)Loss of Funds: All ETH sent by users via the likeUser
function is permanently stuck in the LikeRegistry
contract. Users receive no rewards for matches, and the contract's core functionality is broken.
Broken Functionality: The matching and reward distribution mechanism is non-functional, rendering the contract unusable for its intended purpose.
Reputation Damage: Users and stakeholders may lose trust in the platform due to the loss of funds and broken functionality.
Deploy the LikeRegistry
contract and the SoulboundProfileNFT
contract.
User A mints a profile NFT and sends 1 ETH via likeUser
to like User B.
User B mints a profile NFT and sends 1 ETH via likeUser
to like User A.
Observe that:
The matchRewards
function is triggered due to the mutual like.
The userBalances
mapping for both users remains zero.
The matchRewards
function calculates zero rewards and sends zero ETH to the MultiSig contract.
The 2 ETH sent by the users remains stuck in the LikeRegistry
contract.
Expected: ETH sent by users should be tracked in userBalances
, and matched users should receive rewards via the MultiSig contract.
Actual: ETH is not tracked, and no rewards are distributed. All ETH remains stuck in the contract.
Update the likeUser
function to properly track ETH in the userBalances
mapping:
Refund Excess ETH:
Ensure users send exactly 1 ETH or refund any excess ETH to prevent overpayment.
Add ETH Recovery Mechanism:
Implement a function to allow the contract owner to recover stuck ETH in case of emergencies.
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.