The protocol is supposed to only allow soulmates with the same NFT ID to write in a shared space. However, any user without a soulmate can write a message in the shared space dedicated for soulmates with an NFT ID of 0.
The default value for uint256 is 0, which means that the mapping Soulmate::ownerToId
returns 0 for both users with a valid NFT ID of 0 and users who do not own any NFT ID. Hence, virtually, any user without an NFT can call Soulmate::writeMessageInSharedSpace
and write a message to sharedSpace[0]
.
The following PoC can be added to SoulmateTest.t.sol
to verify this issue.
As shown below, the user with an NFT ID of 0 (soulmate1) reads a message that is written by a random user.
The impact of this vulnerability is HIGH because valid legitimate users who own an NFT with an ID of 0 are impacted. Furthermore, the protocol did not intend to allow any random users who don`t have soulmates to spam messages and virtually share the message space among them.
Foundry
There are several options to mitigate this issue. The simplest fixes would be
Use 1 as the 1st minted NFT`s ID, instead of 0.
Allow a user to write a message in as shared space only if the user has a soulmate by adding a check in Soulmate::writeMessageInSharedSpace
.
Medium Severity, This has an indirect impact and influence on the possibility of divorce between soulmates owning the first soulmate NFT id0, leading to permanent loss of ability to earn airdrops/staking rewards.
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.