logic flaw, which allows user to become his/her own love (gf/bf), which defeats the whole purpose of soulmate protocol.
Here is the given soulmate:: mintSoulmateToken
The given function checks if in idToOwners
mapping, the first index is address(0), assign msg.sender as first soulmate. When first index is filled with other than zero address, it set second index as soulmate and mint the nft to the user who is at second index.
But if you check the highlighted line, it only checks if 2nd index is zero not the msg.sender if it's same as first index. Which allows same person to become his/her soulmate and mint the nft for himself.
In existing test file SoulmateTest.t.sol
add the following test to check this vulnerability
when you run command forge test --mt testSoloGamyAkaBeYourselfSoulmate -vv
in your terminal, it will show following snippet
Fail the whole purpose of soulmate protocol
Manual review
Here is the recommendation that can be used to fix the bug -
- Given the native anonymous nature of blockchain in general, this issue cannot be avoided unless an explicit whitelist is implemented. Even then we can only confirm soulmates are distinct individuals via kyc. I believe finding a soulmate is intended to be permisionless. - However, even though sufficient (500_000_000e18 in each vault) tokens are minted to claim staking and airdrop rewards, it would take 500_000_000 / 2 combined weeks for airdrop vault to be drained which is not unreasonable given there are [80+ million existing wallets](https://coinweb.com/trends/how-many-crypto-wallets-are-there/). Given there is no option to mint new love tokens, this would actually ruin the functionality of the protocol of finding soulmates and shift the focus to abusing a sybil attack to farming airdrops instead. Assigning medium severity for now but am open for appeals otherwise, since most if not all issues lack indepth analysis of the issue.
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.