The LikeRegistry
contract allows users to express interest in others by sending ETH along with their "like." However, if a user likes multiple people and those likes are not reciprocated, the ETH they send remains locked in the contract indefinitely. There is no mechanism for users to recover funds if they are not matched. Over time, this results in a significant loss of funds for users who engage with the platform frequently but do not receive mutual likes. Also, there is no refund mechanism for excess eth sent to the contract
When a user submits a "like," they must send at least 1 ETH. However, if the recipient of the like does not like them back, there is no mechanism for the sender to withdraw their ETH. This results in funds becoming permanently locked in the contract. The users who were not reciprocated lose their ETH permanently to the contract unless an admin function allows withdrawals or refunds which does not exist. The contract accumulates stuck ETH over time, which can lead to centralization risks or funds being trapped indefinitely. secondly, If a user sends more than 1 ETH, only the minimum requirement is checked. Extra ETH is not credited or tracked in userBalances
. The user permanently loses any extra ETH sent.
This poc shows that excess eth cannot be refunded and there is no mechanism to recover eth if users are not liked back as users balance shows zero, meaning that the eth they sent is in stucked in the contract
This issue leads to long-term loss of funds for users who frequently use the protocol but do not receive mutual likes. Since there is no mechanism to refund ETH for unreciprocated likes, the contract accumulates funds. Users who engage more frequently will be affected, as their ETH contributions will continue to be locked without any means of retrieval.
This discourages engagement with the protocol. Users who realize their funds are irrecoverable may stop participating, leading to a decline in user activity and trust in the platform.
Manual review
To address this issue, the contract should implement a withdrawal function that allows users to recover ETH if their like is not reciprocated. This can be achieved by modifying the likeUser
function to only transfer ETH upon a confirmed match, rather than requiring an upfront payment that may never be refunded.
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.