A critical vulnerability exists in the Swan::list() function, enabling attackers to carry out a Denial of Service (DoS) attack on any BuyerAgent. This vulnerability allows an attacker to:
Fill all available asset slots for a BuyerAgent by repeatedly listing assets at a price of zero.
Bypass any listing fees, as there is no minimum price enforcement, making zero-price listings feasible.
Reach the maximum asset count for a BuyerAgent, effectively preventing legitimate users from listing new assets under that BuyerAgent.
This vulnerability has the following impacts:
Denial of Service: Legitimate sellers are unable to list assets when all slots are occupied by the attacker’s.
Zero-Cost Attack: The attacker incurs no cost due to the zero-price listings.
Persistent Blockage: The BuyerAgent remains blocked until the next operational round begins.
The provided test demonstrates the feasibility of this attack:
The attacker lists multiple assets with zero prices, filling all available slots for a BuyerAgent.
This prevents legitimate users from listing their assets under that BuyerAgent.
The attack requires no expense due to zero-price listings and remains effective until the operational round changes.
The following PoC demonstrates the DoS vulnerability. Run it with forge test --mt testDoSAgent to observe the exploit.
The cost of performing a DoS attack can be calculated as:
priceToDos = minimumPriceAsset*maxAssetCount
To mitigate this attack, consider implementing a minimumPriceAsset constraint within Swan::list() to enforce a minimum listing price. For cases where maxAssetCount is low, setting a minimum threshold for maxAssetCount can further reduce vulnerability.
list()Adding a minimum price requirement to list() will prevent attackers from listing zero-price assets.
Add validations in the initialize() function to enforce positive values for minimumPriceAsset and minimumAssetCount and ensure that maxAssetCount meets a minimum threshold.
By enforcing these constraints, the protocol can prevent zero-cost DoS attacks.
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.