DatingDapp

First Flight #33
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

Users Can Match With Multiple People at Once

Summary

The dating app lets users who are already matched keep liking and matching with other people. This breaks the app's promise of "meaningful matches" since users can have many matches at the same time.

Vulnerability Details

function likeUser(address liked) external payable {
require(msg.value >= 1 ether, "Must send at least 1 ETH");
require(!likes[msg.sender][liked], "Already liked");
// No check if sender is already matched
// No check if liked person is already matched
likes[msg.sender][liked] = true;
if (likes[liked][msg.sender]) {
// Creates new match even if users are matched with others
matches[msg.sender].push(liked);
matches[liked].push(msg.sender);
matchRewards(liked, msg.sender);
}
}

Impact

  • Match funds get split between different matches

  • Users can match with many people at once

  • Breaks the "one meaningful match" idea

Recommendations

contract LikeRegistry {
+ uint256 public constant MAX_ACTIVE_MATCHES = 1;
function likeUser(address liked) external payable {
require(msg.value >= 1 ether, "Must send at least 1 ETH");
require(!likes[msg.sender][liked], "Already liked");
require(msg.sender != liked, "Cannot like yourself");
require(profileNFT.profileToToken(msg.sender) != 0, "Must have a profile NFT");
require(profileNFT.profileToToken(liked) != 0, "Liked user must have a profile NFT");
+ // Check if either user is already in a match
+ require(matches[msg.sender].length == 0, "Already in a match");
+ require(matches[liked].length == 0, "Target already matched");
likes[msg.sender][liked] = true;
emit Liked(msg.sender, liked);
if (likes[liked][msg.sender]) {
matches[msg.sender].push(liked);
matches[liked].push(msg.sender);
emit Matched(msg.sender, liked);
matchRewards(liked, msg.sender);
}
}
}
Updates

Appeal created

n0kto Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.