LikeRegistry::likeUser
doesn't have a reversal mechanism. As a result, if a user inadvertently "likes" the zero-address, or another invalid non-zero address (e.g. by making a typo), the funds they are sending as a message value (>=1 ETH as per requirements) would be trapped in the contract.
The purpose of the LikeRegistry
contract is to enable users to like each other, and "match". At this point the funds each user have deposited go to a mutual contract (MultiSig.sol
), from which they can spend it together. The issue arises from the fact that until a match happens, the funds a user has sent remain trapped in the LikeRegistry
. Therefore, liking a non-existent address (or the zero-address) cannot possibly result in a match, which means the the funds are locked in the contract, with no way to recover them.
The impact is high, as the user's funds would be locked in the contract, and there is no way to recover them. The likelihood is medium - the user would have to make a mistake in the address they are liking, or pass the zero-address.
Manual review.
A low-effort improvement is to add a zero-address check in the LikeRegistry::likeUser
function:
A more resilient approach would be to add a reversal mechanism (an unlikeUser
function), so that the user can revoke a like, thereby receiving their ETH back. Such a mechanism would include removing the likes from the likes
mapping, and storing the exact ETH amount sent for the given liked
address, which could then be transferred back to the user.
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.
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.