A malicious seller can grief a buyerAgent by filling out the maxAssetsCount. Such attack is supposed to be discouraged by the royalties that the seller has to pay, however creating a listing with a low _price input (e.g. 0 or 1) will cause the royalties to be 0 meaning that it will cost nothing but gas fees for the attacker.
Any seller can call the list function to deploy, mint and list a Swan Asset NFT
As observed in this function, this function will deploy, mint and list the NFT as long as the buyer is in sell phase and the sell round has not reached maximum amount of listings(maxAssetCount).
This function will then call the transferRoyalties function.
As seen from these functions, asset.price has no lower limit meaning that it can be set to a low number such as 0 or 1. If a malicious seller sets the price to 0 or 1, even if the royaltyFee and platformFee are set to 99, due to how solidity handles divisions, buyerFee and driaFee will be set to 0.
Considering all of the above, a malicious seller can spam create listings via calling the list function with _price set to 0 or 1 to fill out the maxAssetCount of the buyerAgent for that sell period. Due to the royalty math, this malicious seller would also pay no fees to the protocol or the buyerAgent and only pay the gas fee for the transactions. This will lead to the maxAssetCount reaching the maximum amount preventing any honest sellers from listing their NFT. Effectively griefing that buyerAgent permanently, causing no NFTs to be able to be listed.
Adjust the Swan.test.ts to mimic listings with _price set to 0.
1) Add the following line in the test file
2) Adjust the following test as shown below
This test proves that it is possible to create listings with _price as 0, filling out the maxAssetCount.
Impact: High, the buyerAgent will be permanently griefed and will not be able to purchase any honest NFTs
Likelihood: High, attack costs no fees to the seller and it is easy to perform.
Manual review, hardhat
Implement a minimum fee for all listings to discourage these kind of griefing attacks. An example is shown below.
Alternatively, implement a minimum selling price. An example is shown below.
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.