Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: low
Invalid

An user can avoid paying the protocol(dria) fee while listing assets and get desired assets(using another account) with very little price.

Summary -
An user can manipulate the protocol functions by being both buyer and lister with 2 different accounts(for more ease).They first create a buyer agent(by using the function createBuyer), Then they list an asset to their buyer account(by using the function list,they list this asset from there second account) and set the asset price very low(1 wei), the protocol fee(dria fee) = 0 due to rounding, then the buyer can buy this asset at this low price(main cost will be the gas cost and the oracle fees for the BuyerAgent.sol functions) , the user can keep repeating this again and again,hence upgrading their buyer agent with assets of there choice as many times as they want and never pay the protocol(dria) fee

Vulnerability Details
1) Buyer creates an ai agent(by using the function createBuyer)lets say for example named - goku, description is that he is a saiyan, _feeroyalty = 5% (for example),then they list themselves an asset(from there other account)(by using the function list example asset name(Ultra Instinct Power up) for 1 wei, the dria fees will be = 0 as when the user uses the function listand hits the line transferRoyalties(listings[asset]);(note - buyer is in the sell phase already ) https://github.com/Cyfrin/2024-10-swan-dria/blob/main/contracts/swan/Swan.sol#L258
In the above function transferRoyalties now, Poc of how dria fee will be = 0

asset.price = 1 wei

asset.royaltyFee = 5 (representing 5%)

platformFee = 1 (representing 1%) (just an example of platform fees it will be the same outcome for any value set by the protocol)

Calculating buyerFee:

buyerFee = (asset.price * asset.royaltyFee) / 100
= (1 wei * 5) / 100
= 5 / 100
= 0 wei

Since 5 / 100 is less than 1 wei, it gets truncated down to 0 wei.

Calculating driaFee:

driaFee = (buyerFee * platformFee) / 100
= (0 wei * 1) / 100
= 0 / 100
= 0 wei

Since buyerFee is 0, driaFee also results in 0 wei.
Conclusion:

With asset.price set to 1 wei, both buyerFee and driaFee evaluate to 0 wei. Therefore, no meaningful platform fee is transferred, allowing the buyer to bypass the intended fee mechanism. Also the user can keep reapting this again and again getting as many assets as they want without paying the protocol fee.

Impact -

This user can now make its buyer agent buy assets for very little amount(main cost is transaction fee and oracle fee)

and while using the function Listthe user will always give 0 (dria)fee

One of the protocols main purpose is they want people to make ai agents, and they want other people to list assets to this agent according to the agents description and earn platform(dria) fees on this-
This scenario manipulates this purpose in a negative way(is also cheap to do and also upgrades the ai agent for low amount of money)

Tools Used -
Manual analysis

Recommendations-

Introduce a require statment for minimum asset value so that the dria fee can never be = 0\

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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