The Swan protocol's royalty distribution mechanism can silently fail during asset listing, allowing sellers to list assets without paying required royalties. This breaks the core economic model where every listing should generate royalty payments to both the buyer agent and platform.
The transferRoyalties
function handles fee distribution but lacks proper validation and error handling:
The bug is that the royalty distribution can fail silently if any of the token transfers fail, but the asset listing state would still be updated. This breaks the invariant that royalties must always be distributed when an asset is listed.
Proof of Concept:
Seller lists asset without sufficient token approval
transferFrom
fails silently
Asset gets listed but no royalties are distributed
Violates the specification assertion
This is a problem for the protocol for several reasons:
Integer Division Risk:
If asset.price * royaltyFee < 100
, buyerFee
becomes 0
If buyerFee * platformFee < 100
, driaFee
becomes 0
This can lead to royalty payments being completely skipped for low-value transactions
Fee Calculation Order:
No validation that buyerFee > driaFee
Could cause underflow in buyerFee - driaFee
calculation
Potential revert that leaves system in inconsistent state
Transfer Safety:
No checks for successful token transfers
Failed transfers could leave funds stuck in contract
State changes happen before ensuring transfers succeed
Impact
Allows bypassing royalty payments on small transactions
Can lead to locked funds
Creates accounting inconsistencies between actual transfers and recorded state
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.