The LikeRegistry smart contract requires users to deposit 1 ETH when liking another user through the likeUser()
function. However, the contract lacks a mechanism for users to retrieve their deposited funds if they never receive a match. This creates a permanent lock of user funds in scenarios where matches do not occur.
In the current implementation, when a user likes another profile through the likeUser() function, they must send at least 1 ETH:
These funds are stored in the contract but are only distributed when a match occurs through the matchRewards() function. If a user never receives a match, their funds remain permanently locked in the contract with no withdrawal mechanism available.
Consider the following scenario:
Alice deposits 1 ETH to like Bob
Bob never likes Alice back
Alice's 1 ETH remains locked in the contract indefinitely
Alice has no mechanism to recover her funds, even if she decides to leave the platform
This vulnerability has several serious implications:
Users who do not receive matches have their funds permanently locked in the contract
The locked funds could accumulate to significant amounts over time
Users may be discouraged from participating due to the risk of permanent fund loss
The contract could be perceived as predatory, damaging platform reputation
In the event of contract deprecation, unmatched user funds would be irretrievable
Manual review
Implement a refund mechanism that allows users to withdraw their funds if they remain unmatched after a certain period. Here's a suggested implementation:
The proposed solution:
Tracks individual user deposits separately
Implements a waiting period before refunds become available
Allows users to withdraw funds from specific unmatched likes
Maintains platform integrity while protecting user funds
Includes proper event emission for transparency
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.