NFT Dealers

First Flight #58
Beginner FriendlyFoundry
100 EXP
Submission Details
Impact: medium
Likelihood: high

Non whitelisted user/wallet cannot list NFT

Author Revealed upon completion

Root + Impact:

Description

  • According to the protocol's functionality and user roles as stated in the documentation, both whitelistedand non whitelistedusers should be able to list their nft in the marketplace. however non whitelistedusers are not able to list their nft by calling the NFTDealers::listfunction because of it's onlyWhitelistedaccess control modifier.

  • This limits/breaks a core functionality of the protocol as a marketplace.

function list(uint256 _tokenId, uint32 _price) external onlyWhitelisted {

Risk

Likelihood:

  • This happens when a user not whitelisted for mint but owns an nft wants to list/sell on the NFTDealers marketplace

Impact:

  • Users and owners of the nft that are not whitelisted to mint will be unable to list and sell their nft on the marketplace.

  • This makes the protocol unusable for non whitelisted users.

Proof of Concept

Add the following to the NFTDealersTest.t.soltest suite

function testNonWhitelistedUserCannotList(address randomNonWhitelisted) external {
vm.assume(randomNonWhitelisted != address(0) && randomNonWhitelisted != owner && randomNonWhitelisted != userWithCash);
uint256 tokenId = 1;
vm.startPrank(owner);
nftDealers.revealCollection();
nftDealers.whitelistWallet(userWithCash);
vm.stopPrank();
vm.startPrank(userWithCash);
usdc.approve(address(nftDealers), 20e6);
nftDealers.mintNft();
IERC721(nftDealers).transferFrom(userWithCash, randomNonWhitelisted, tokenId);
vm.stopPrank();
vm.prank(randomNonWhitelisted);
vm.expectRevert();
nftDealers.list(tokenId, 30e6);
}

Recommended Mitigation

The access control modifer onlyWhitelistedof the NFTDealers::listfunction should be removed to give access to non whitelisted users.

- function list(uint256 _tokenId, uint32 _price) external onlyWhitelisted {
+ function list(uint256 _tokenId, uint32 _price) external {

Support

FAQs

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

Give us feedback!