Dria

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

A malicious user can create a buyer agent that bypasses the min/max fee

Summary

The malicious user can register a buyer agent that breaks the protocol invariants as long as the agent follows a normal agent's interface

Vulnerability Details

When registering a new agent the user passes in a fee. The fee rate is paid by the asset creators as a % of the listing price to the agent.

In the constructor of the buyer agent there is this check which requires the fee to be between 1 and 99 % incluside.

if (_royaltyFee < 1 || _royaltyFee > 100) {
revert InvalidFee(_royaltyFee);
}

When listing an asset for sale the address of the buyer is passed and as long as it complies with the `BuyerAgent` interface the transaction would succeed. This lets a malicious user create an agent where the fee is 100 % and leave no winnings for the seller.

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);
}

Just fee for the protocol would be taken out.

In the later case the malicious user could set the fee to 0 % and then no winning go to the protocol/dria.

Impact

Core invariant broken

Tools Used

Manual review

Recommendations

Create a mapping of address => bool that stores the newly created byer agent address and wheter he is valid. Add a modifier the the functions that are callable by the agent to require the msg.sender to be be a registered byer. That way only buyer agents deployed by the protocol would be able to execute functions.

Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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