The createBuyer function in Swan.sol allows creation of buyer agents with unconstrained parameters for spending limits and royalty fees. This enables creation of economically invalid buyers that can disrupt protocol operations and manipulate market dynamics through fee exploitation.
Specifically in the createBuyer function of Swan.sol: https://github.com/Cyfrin/2024-10-swan-dria/blob/c8686b199daadcef3161980022e12b66a5304f8e/contracts/swan/Swan.sol#L326-L336
The Problem:
The function lacks validation on the _feeRoyalty parameter
Unlike other parts of the contract where fees are checked (e.g., platformFee <= 100), buyer royalty fees aren't validated
This could allow creation of buyer agents with invalid royalty fees
PoC:
For the protocol this is a problem because:
Zero spending limit buyers can be created, which would be unable to participate in purchases but still consume protocol resources
If _amountPerRound is set below required oracle fees, the buyer agent would be created but unable to execute any purchases due to insufficient funds for oracle operations
Uncapped royalty fees could lead to:
Excessive fee extraction from trades
Broken economics when fees exceed 100%
Potential overflow in fee calculations during purchase operations
The lack of these validations allows creation of buyer agents that can disrupt protocol operations or create economically invalid scenarios. This impacts both protocol stability and user experience.
Economic manipulation through excessive fee extraction
Creation of non-viable buyers that cannot cover oracle costs
Add parameter validation to ensure:
Royalty fees are capped at 100%
Spending limits cover minimum oracle operation costs
Economic viability checks for new buyers
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.