Pieces Protocol

First Flight #32
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Invalid

[H-1] Seller Manipulation in `sellErc20` Function Preventing NFT Claiming

Summary

The sellErc20 function allows sellers to create multiple sell orders without restrictions, enabling them to manipulate the price of NFT fractions. This can prevent buyers from accumulating all required fractions to claim the full NFT.

Vulnerability Details

Scenario:

  1. The seller initially owns 1e18 fractions of the NFT in ERC20 tokens.

  2. The seller creates an order to sell 0.9e18 fractions at a price of 1e18.

    s_userToSellOrders[msg.sender].push(
    SellOrder({
    seller: msg.sender,
    erc20Address: tokenInfo.erc20Address,
    price: 1e18,
    amount: 0.9e18
    })
    );
  3. A buyer fulfills the order and acquires 0.9e18 fractions.

  4. The seller then creates another order for the remaining 0.1e18 fractions at an inflated price of 10000e18.

  5. As a result, the buyer is unable to purchase the final fraction at a reasonable price, blocking their ability to claim the full NFT.

Impact

  • Market Manipulation: Sellers can artificially inflate prices, making it impossible for buyers to collect all required fractions.

  • Unfair Trading Practices: Potential buyers may face financial losses due to sudden price increases.

  • Platform Integrity: The platform's credibility may be compromised due to unchecked manipulations.

Tools Used

  • Manual code review

  • Solidity static analysis tools

Recommendations

  1. Introduce Order Limits: Restrict the number of active orders a seller can create at a time.

  2. Price Constraints: Implement validation mechanisms to prevent drastic price fluctuations within short periods.

  3. Fractional Limits: Set minimum and maximum selling thresholds to prevent price exploitation.

  4. Buyout Mechanism: Allow buyers to purchase all remaining fractions at a fair market value to claim the NFT.

Updates

Lead Judging Commences

fishy Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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