Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: medium
Valid

An attacker can block a buyer from purchasing essential assets.

Summary

An attacker can use the list() function to create assets with _price = 0, avoiding any fees. By creating many such listings, the attacker can fill up the buyer’s maxAssetCount limit, preventing them from buying assets from other users.

Vulnerability Details

/// @notice Keeps track of assets per buyer & round.
mapping(address buyer => mapping(uint256 round => address[])) public assetsPerBuyerRound;

This mapping in swan.sol is used to ensure that buyers do not exceed the maxAssetCount when listing or relisting assets.

// asset count must not exceed `maxAssetCount`
if (getCurrentMarketParameters().maxAssetCount == assetsPerBuyerRound[_buyer][round].length) {
revert AssetLimitExceeded(getCurrentMarketParameters().maxAssetCount);
}

If a buyer agent has a low royaltyFee, or while creating an asset _price = 0 fee will be zero so an attacker could create many listings for that buyer. This would allow the buyer to reach the maxAssetCount limit, preventing them from purchasing assets from other users.

if the _price = 0 while creating a list the buyerFee and driaFee also, becoming Zero means an attacker can create unlimited assets to prevent others from selecting him for buying assets.

function transferRoyalties(AssetListing storage asset) internal {
// calculate fees
uint256 buyerFee = (asset.price * asset.royaltyFee) / 100;
uint256 driaFee = (buyerFee * getCurrentMarketParameters().platformFee) / 100;

https://github.com/Cyfrin/2024-10-swan-dria/blob/c8686b199daadcef3161980022e12b66a5304f8e/contracts/swan/Swan.sol#L177C1-L181C1

https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/Swan.sol#L168

Impact

The buyer will be unable to purchase necessary assets, and other users won’t be able to select the buyer for their assets either.

Recommendations

There are two ways to solve this issue:

1- A minimum price for a listing

2- adding a restriction to limit the number of assets a user can list for each buyer in a given round.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

DOS the buyer / Lack of minimal amount of listing price

Support

FAQs

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