LikeRegistry.sol
likeUser() requires msg.value >= 1 ether but accepts any amount above the minimum without refunding the excess. Users who accidentally send more than 1 ETH lose the difference permanently, compounded by H-01 which locks ALL deposited ETH.
Likelihood: High — Any user can overpay via UI error or programmatic mistake.
Impact: Medium — Loss limited to excess above 1 ETH per transaction.
Severity: Medium
SWC: SWC-105
CWE: CWE-20 (Improper Input Validation)
Evidence Grade: B
Alice intends to like Bob and sends 5 ETH instead of the required 1 ETH. The contract accepts the full 5 ETH without refunding the 4 ETH excess. Alice has no way to recover the overpayment.
forge test --match-test test_BONUS_excess_ETH_not_refunded -vvvv → PASS
Either enforce exact payment or refund the excess. Exact payment is simpler and safer:
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.