The LikeRegistry contract is designed to facilitate user interactions—such as liking a profile and matching users—by accepting ETH payments through its likeUser
function. However, the contract also includes a generic receive()
function that allows it to accept ETH from any source. In the absence of a mechanism for users to recover funds mistakenly sent (either through direct transfers, transaction failures, or other errors), these ETH become permanently locked in the contract. This situation can lead to user loss of funds and may damage user trust in the platform.
The LikeRegistry contract accepts ETH via its receive()
function:
The intended mechanism for sending ETH is via the likeUser
function:
If a user accidentally sends ETH to the contract—whether by a direct transfer, through a failed likeUser
call (e.g., if a require condition fails), or due to a smart contract interaction mistake, there is currently no function for the user to withdraw these funds. As a result, the funds remain permanently locked in the contract.
Let's examine a real-world scenario:
Results of failed transaction:
ETH is transferred to contract
Like is not registered
No way to recover funds
User loses access to their ETH permanently
ETH is transferred to contract
Like is not registered
No way to recover funds
User loses access to their ETH permanently
Accidental Overpayment or Direct Transfer:
A user might mistakenly send more than the required 1 ETH when calling likeUser
, or send ETH directly to the contract address.
Resulting Consequences:
The accidentally sent ETH is trapped in the contract because there is no recovery mechanism.
Users are unable to retrieve these funds, resulting in a permanent loss.
Manual Review
Implement a recovery mechanism that allows users to withdraw any ETH that was sent accidentally. One possible solution is to track accidental deposits and provide a withdrawal function. For example:
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
Not the best design, but if you send money accidentally, that's a user mistake. Informational.
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.