Dria

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

Sellers loss their listing fee

Summary

During the sell phase, any seller can list an asset for transferring royalties so that the buyer can purchase that asset. In the buy phase, the operators or the owner of the BuyerAgent call the LLMOracleCoordinator and pay the oracle fees to make a purchase request. After the oracle validation, the operators can buy assets from the output. A malicious owner of one of these assets may revert the purchase.

Vulnerability Details

Let's consider the following situation:

  1. Five sellers list their assets and pay royalties to a specific buyer. [Sell phase]

  2. The operator of Swan calls oraclePurchaseRequest and pays for the oracle fees. [Buy phase]

  3. One of the sellers is malicious and sees that his asset is in the oracle output (the oracleResult function). The malicious seller revokes approval from the Swan contract by calling setApprovalForAll(swan, false) or transfers a single NFT to another address. [Buy phase]

  4. The operator of Swan calls the purchase function, and the call reverts at the step transfer asset from seller to Swan. [Buy phase]

// transfer asset from seller to Swan, and then from Swan to buyer
// this ensure that only approval to Swan is enough for the sellers
--> SwanAsset(_asset).transferFrom(listing.seller, address(this), 1);
SwanAsset(_asset).transferFrom(address(this), listing.buyer, 1);

Impact

In this attack, the malicious seller pays royalties to the buyer, but the buyer incurs a loss in tokens due to oracle fees, while the other sellers lose their royalties for this round (they may also relist in the next round and pay royalties again).

Tools Used

Manual review

Recommendations

Consider overriding the internal _setApprovalForAll function to disallow setApprovalForAll(swan, false) call and allow NFT transfers only to or from Swan.sol.

Updates

Lead Judging Commences

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

DoS in BuyerAgent::purchase

Support

FAQs

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