The LikeRegistry
contract in its current form has a functionality for users to "like" each other and matchRewards when mutual likes occur. However, the likeUser
function lacks a mechanism to update the userBalances
mapping, which tracks the balance of each user.
As a result, when a mutual like happens and the contract attempts to send balances to the deployed multisig wallet in the matchRewards
function, it will not be able to calculate accurate balances and may lead to can't send balances to the multisig wallet.
Missing Update to userBalances in likeUser Function
The contract has a userBalances mapping, which is designed to track the balance of each user in the contract.
When a user "likes" another, they send ETH to the contract. This ETH should be added to the liking user's balance, but this step is missing from the likeUser function.
The matchRewards function relies on the balances stored in userBalances to calculate the rewards when two users mutually like each other. Since userBalances is not updated in likeUser, can't send to multisig wallet.
This vulnerability can make it impossible to send balances to multisig wallets.
ETH remains in the contract state permanently.
I manually review the code using VS Code.
** Update** userBalances
in likeUser
Function
The most immediate solution is to update the userBalances
mapping when a user likes another. Specifically, the balance of the sender (the "liker") should be incremented by the ETH they send when calling the likeUser
function.
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.