The `likeUser()` function does not check if two users are already matched before processing a mutual like. If a user calls `likeUser()` again after already being matched with someone, the same address will be added to the `matches` array again, and `matchRewards()` will be called again. This creates duplicate entries and could lead to multiple reward distributions if the balance tracking bug is fixed.
```solidity
// Check if mutual like
if (likes[liked][msg.sender]) {
matches[msg.sender].push(liked); // @> Can push same address multiple times
matches[liked].push(msg.sender);
emit Matched(msg.sender, liked);
matchRewards(liked, msg.sender); // @> Can be called multiple times for same pair
}
```
### Root Cause
There's no mapping or check to track if two users are already matched. The code only checks if a like exists (`likes[liked][msg.sender]`), but doesn't verify if they've already been matched and processed.
Likelihood:
* Users can call `likeUser()` multiple times with the same address
* Once mutual likes exist, any subsequent call will trigger match processing again
* This will occur whenever a user accidentally or intentionally calls `likeUser()` again after matching
Impact:
* Duplicate entries in the `matches` array, causing gas waste and data inconsistency
* `matchRewards()` could be called multiple times for the same pair
* If the balance tracking bug is fixed, this could lead to double-spending of user balances
* Multiple multisig wallets could be deployed for the same pair
* Event emissions will be duplicated, causing off-chain tracking issues
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.