Potential Denial of Service in Swan Purchase Function
A vulnerability has been identified in the Swan smart contract that allows sellers to prevent buyers from completing purchases during an entire round by manipulating asset permissions or ownership. This can result in a denial of service that prevents buyers from completing any asset purchases.
In Swan.sol:294
, the purchase function is vulnerable to manipulation by sellers. The relevant code section handles the asset transfer process:
The vulnerability exists because the seller can:
Revoke the Swan contract's permission to transfer the asset
Transfer the asset to a different address before the purchase is completed
Either action will cause the transferFrom operation to fail, resulting in a transaction revert. The purchases of assets are performed on a per-round basis, buying all assets for that round in a single function call to BuyerAgent.purchase()
. Therefore, a revert in a single asset will cause the whole transaction to fail.
The impact of this vulnerability is severe:
Buyers are unable to complete legitimate purchases
The marketplace functionality is disrupted for entire rounds
Sellers can manipulate the system to prevent sales while maintaining their listings
Manual Review
To address this vulnerability, consider implementing the following measures:
Asset Escrow System
Require sellers to transfer assets to the contract when creating listings
Hold assets in escrow until the listing is either completed or canceled
This prevents sellers from manipulating asset availability during active listings
Permission Enforcement
Since assets listed on Swan are expected to be instances of SwanAsset, a special case when the Swan contract is the spender of the asset could be specified:
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.