Dria

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

Malicious `buyerAgent` owner can airdropping the NFTs he need and avoid paying protocol listing fee

Summary

Malicious buyerAgent owner can airdropping the NFTs he need and avoid paying protocol listing fee. This can be happened because :

  1. Owner of buyerAgent can list NFTs on their own buyerAgent

  2. Price of NFT can be set = 0 to avoid paying listing protocol fee. This the formula for listing protocol fee :

function transferRoyalties(AssetListing storage asset) internal {
// calculate fees
uint256 buyerFee = (asset.price * asset.royaltyFee) / 100;
uint256 driaFee = (buyerFee * getCurrentMarketParameters().platformFee) / 100;
// first, Swan receives the entire fee from seller
// this allows only one approval from the seller's side
token.transferFrom(asset.seller, address(this), buyerFee);
// send the buyer's portion to them
token.transfer(asset.buyer, buyerFee - driaFee);
// then it sends the remaining to Swan owner
token.transfer(owner(), driaFee);
}

Vulnerability Details

Schema

  1. Malicious buyerAgent owner make buyerAgent with description :

    backstory : “Mr.WinTheContest in gardening life”

    objective : “Become number 1 successful gardener”

  2. On sell phase, malicious buyerAgent owner list NFT with description “hoe” (or any relevant with his objective) to his own buyerAgent address with price of NFTs = 0 until reaches maximum value of assetsPerBuyerRound

  3. On the buy phase, malicious buyerAgent buy all NFTs and get all NFTs according to the his objective

  4. In this way, the protocol loses the protocol listing fee from the malicious buyerAgent owner (in other words the seller) and the malicious buyerAgent owner only pays the protocol fee when making a purchase to get NFTs according to his objective

Coded POC

create any test file and rename it —> copy this code —> run yarn test ‘path/test.test.ts’

Coded POC and result

Impact

The protocol loses the protocol listing fee and malicious buyerAgent easily get NFTs he need

Tools Used

Manual Review

Recommended Mitigation

Add check for msg.sender ≠ _buyer and price ≠ 0

function list(string calldata _name, string calldata _symbol, bytes calldata _desc, uint256 _price, address _buyer)
external
{
require(msg.sender != _buyer, "msg.sender == owner of buyerAgent");
require(_price != 0, "price cannot be zero");
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

Appeal created

0xdemon Submitter
7 months ago
inallhonesty Lead Judge
7 months ago
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.