The likeUser
function is designed to implement a pay-to-like mechanism, where users pay 1 ETH to express interest in another user. However, while the function checks that msg.value >= 1 ether
, it **does not actually updaate **the ETH to the liked user.
userBalances
is not updated – The contract tracks balances via userBalances
, but the liked user's balance is not incremented when they receive a like. This means their balance remains unchanged, even though they were supposed to receive 1 ETH.
likeUser(likedUserAddress)
and send 1 ETH (msg.value = 1 ether
).userBalances[likedUserAddress]
, which remains 0 instead of increasing by 1 ETH.
Impact
Breaks expected functionality – The documentation states that liking a profile requires a payment, but the current implementation does not enforce this.
Funds are not transferred – The liked user does not receive the 1 ETH payment, making the feature ineffective.
manual review and foundry
Modify the function to ensure that ETH is properly transferred to the liked user
This ensures that the ETH sent by the liker update the intended recipient and that the pay-to-like mechanism functions as expected.
// Update liked user's balance
Likelihood: High, always. Impact: High, loss of funds
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.