The Swan contract’s list and relist functions lack validation for the _price parameter, allowing users to set extremely low or high prices without restriction. This issue lead to unintended consequences, such as abuse of the platform for creating assets with zero or negligible price or artificially inflating prices. Without validation, this flexibility lead to revenue loss, impact platform economics, and potentially facilitate market manipulation.
The list and relist functions in the Swan contract allow sellers to specify the _price of an asset. However, there are no validations in place to restrict the value of _price. This lack of validation allows malicious users to:
List assets with a zero or negligible price, which may encourage spam listings or abuse of assets, potentially impacting the perceived legitimacy of the platform.
Set excessive prices that exceed reasonable limits, which can contribute to asset value manipulation and discourage legitimate buyers.
To prevent these potential issues, it is essential to enforce minimum and maximum price bounds within the list and relist functions.
The vulnerable code is shown below, where no checks are implemented on _price:
A malicious user can exploit the lack of _price validation by setting extremely low or high values.
Steps:
Deploy the Swan contract and initialize it.
Call the list or relist function with _price set to 0 or an extremely high value.
Observe that there is no validation preventing such extreme values.
The following Hardhat test demonstrates the lack of _price validation:
Running this test demonstrates that listing assets with a price of 0 or with an excessively high value (e.g., 1,000,000 ETH) is permitted. This confirms the lack of validation on the _price parameter.
Allowing arbitrary pricing values without validation can negatively impact the platform in several ways:
Spam Listings: Zero-priced assets could lead to spam listings, degrading the marketplace's quality.
Market Manipulation: Excessive prices can inflate or manipulate asset values, discouraging legitimate buyers and impacting the marketplace's credibility.
Revenue Loss: Listings with negligible prices might bypass intended economic mechanisms, resulting in potential revenue losses.
Manual review.
Introduce minimum and maximum bounds for _price in the list and relist functions. For example, ensure _price is greater than zero and less than a reasonable upper limit.
Example:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.