DatingDapp

First Flight #33
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: medium
Valid

M-02. Ineffective blockProfile

Summary

In the SoulboundProfileNFT contract, the blockProfile function allows the owner to block a user's profile by burning their NFT. However, after the profile is burned, the blocked address can still mint a new profile. This makes the blockProfile function ineffective, as it does not prevent a blocked user from creating a new profile.

Vulnerability Details

  • The blockProfile function burns the user's NFT, but it deletes the mapping of the user's profile from profileToToken and the _profiles mapping.

  • This allows the blocked user to later mint a new profile since the profileToToken[msg.sender] == 0 check is passed when they call mintProfile.

  • The current implementation does not block the user from creating a new profile after being blocked, rendering the "block" feature ineffective.

Impact

  • Users who are blocked by the contract owner can circumvent the blocking mechanism by minting a new profile after their old profile is burned.

  • The purpose of the blockProfile function, which is to prevent further use of the platform by a specific user, is compromised.

  • This leads to a potential abuse where a user can repeatedly mint new profiles even after being blocked.

Tools Used

Manual review

Recommendations

Add a Blocked User Tracking Mechanism: Implement a mapping to track blocked users, ensuring they cannot mint a new profile after being blocked. For example:

mapping(address => bool) public blockedUsers;
function blockProfile(address blockAddress) external onlyOwner {
require(profileToToken[blockAddress] != 0, "No profile found");
// Block the user
blockedUsers[blockAddress] = true;
uint256 tokenId = profileToToken[blockAddress];
_burn(tokenId);
delete profileToToken[blockAddress];
delete _profiles[tokenId];
emit ProfileBurned(blockAddress, tokenId);
}
function mintProfile(string memory name, uint8 age, string memory profileImage) external {
require(!blockedUsers[msg.sender], "You are blocked from minting a profile");
// Rest of the minting logic
}
Updates

Appeal created

n0kto Lead Judge 5 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding_blocked_user_can_recreate_a_profil

Likelihood: Low, any blocked users. Impact: High, not really blocked.

Support

FAQs

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