The `likeUser()` function requires users to send at least 1 ETH (`require(msg.value >= 1 ether)`), but it does not refund any excess ETH if users send more than 1 ETH. The excess ETH remains in the contract and is effectively lost to the user, as there's no mechanism to recover it.
```solidity
function likeUser(address liked) external payable {
require(msg.value >= 1 ether, "Must send at least 1 ETH");
// @> If msg.value > 1 ether, excess is not refunded
// ...
}
```
### Root Cause
The function only checks the minimum value but doesn't handle cases where more than 1 ETH is sent. The excess ETH is included in the contract balance but not tracked or refunded.
Likelihood:
* Users may accidentally send more than 1 ETH due to UI errors or miscalculation
* Users may intentionally send more thinking it provides additional benefits
* This will occur whenever msg.value > 1 ether
Impact:
* Users lose excess ETH permanently
* Poor user experience and potential financial loss
* Excess ETH accumulates in the contract with no way for users to recover it
* If excess ETH is significant, it could be considered a form of fund loss
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.