DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: high
Invalid

Denial of Service (DoS) Vulnerability in `_transferPlots`

Summary

The _transferPlots function in the MarketplaceFacet contract is susceptible to a Denial of Service (DoS) attack due to its unbounded iteration over an array of plot IDs. An attacker could exploit this by submitting a transaction with an extremely large array, causing the transaction to consume excessive gas and potentially exceeding the block gas limit. This would result in the transaction failing and could prevent other users from interacting with the contract.

Vulnerability Details

The vulnerability lies in the following code snippet from the _transferPlots function:

for (uint256 i; i < ids.length; i++) {
// ... (plot transfer logic)
}

The loop iterates over the ids array, which contains the IDs of the plots to be transferred. If the length of this array is very large, the loop will execute many times, consuming a significant amount of gas.

Impact

A successful DoS attack could have several negative consequences:

  • Disruption of Service: Legitimate users would be unable to interact with the MarketplaceFacet contract, preventing them from buying, selling, or transferring plots.

  • Financial Losses: If the DoS attack occurs during a critical period, such as an auction or a sale, users could miss out on opportunities to participate, leading to potential financial losses.

  • Reputation Damage: A successful DoS attack could damage the reputation of the Beanstalk project, leading to a loss of trust from users and investors.

Tools Used

  • Manual code review

  • Solidity static analysis tools

Recommendations

To mitigate this vulnerability, consider the following recommendations:

  1. Limit the Number of Plots per Transaction: Introduce a maximum limit on the number of plot IDs that can be included in the ids array. This would restrict the maximum gas consumption of the _transferPlots function and prevent attackers from creating excessively large transactions.

  2. Batch Processing: Instead of processing all plot transfers in a single transaction, split them into smaller batches. This would distribute the gas consumption across multiple transactions, reducing the risk of exceeding the block gas limit.

  3. Gas Optimization: Explore ways to optimize the gas consumption of the plot transfer logic within the loop. This could involve using more efficient data structures or algorithms to reduce the overall gas cost of the function.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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