Beginner FriendlyFoundryGameFi
100 EXP
View results
Submission Details
Severity: low
Valid

Incorrectly list martenitsaToken on marketplace for sell to cause DoS

Summary

Incorrectly list martenitsaToken on marketplace for sell to cause DoS

Vulnerability Details

function listMartenitsaForSale(uint256 tokenId, uint256 price) external {
require(msg.sender == martenitsaToken.ownerOf(tokenId), "You do not own this token");
require(martenitsaToken.isProducer(msg.sender), "You are not a producer!");
require(price > 0, "Price must be greater than zero");
Listing memory newListing = Listing({
tokenId: tokenId,
seller: msg.sender,
price: price,
design: martenitsaToken.getDesign(tokenId),
forSale: true
});
tokenIdToListing[tokenId] = newListing;
emit MartenitsaListed(tokenId, msg.sender, price);
}

Incorrectly list martenitsaToken on marketplace for sell to cause DoS. For example, the martenitsaToken for sell are not approved for marketpalace, or the martenitsaToken for sell are transfered to another address. The list will be invalid.
POC:

function testNotApprovedBuyMartenitsa() public listMartenitsa {
vm.prank(bob);
vm.expectRevert();
marketplace.buyMartenitsa{value: 1 wei}(0);
}

add this test function in MartenitsaMarketplace.t.sol,
then run forge test --mt testNotApprovedBuyMartenitsa

Impact

Tools Used

Foundry

Recommendations

Transfer token to marketpalce when list for sell

Updates

Lead Judging Commences

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

Listed MartenitsaToken can be transferred before the sale

Support

FAQs

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