Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: medium
Valid

No NFT ownership check on `Soulmate.sol::writeMessageInSharedSpace`.

Summary There is no check on Soulmate.sol::writeMessageInSharedSpace. Although it does reference a mapping if a user does not exist in the mapping it would return a zero. Allowing for a non-owner of NFT id 0 to write to the shared space.

Vulnerability Details

An individual who does not own any NFT can still right in sharedSpace[0].

Impact

The owners of NFT 0 now have their shared space open to any malicious individual who wishes to write in their space, breaking the protocol for these users

Tools Used

Foundry

Recommendations

It is recommended to have a check to see if the owner does own a NFT before allowing them to write in the shared space.

function writeMessageInSharedSpace(string calldata message) external {
//@audit no chekc if owner actually has an nft, ie zero id anyone can write to it
+ if(balanceOf(msg.sender) == 0) {revert;} //AP
uint256 id = ownerToId[msg.sender];
sharedSpace[id] = message;
emit MessageWrittenInSharedSpace(id, message);
}
Updates

Lead Judging Commences

0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-write-message-nft-0-id

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.

Support

FAQs

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