Description:
The requirement msg.value >= 1 ether
means that callers can send more than 1 ETH, yet the contract does not explicitly handle any “excess” ETH. Without updating userBalances
(see issue #1) or enforcing an exact value, users might inadvertently overpay.
Root Cause:
The contract does not validate that exactly the expected amount is sent nor does it refund the surplus.
Impact:
Users may lose funds they did not intend to commit if they accidentally send too much ETH, and the surplus is never properly accounted for or returned.
Recommendation:
Enforce an Exact Amount: If the intent is to charge exactly 1 ETH per like, change the requirement to:
Or Refund Excess: Alternatively, if a deposit mechanism is intended, record the entire amount in userBalances
and consider refunding any extra if necessary.
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.