MarketFees : Primary sales not detected in some scenarios
The fee-splitting loop in the marketplace contract stops early when one royalty share exceeds 100%, so the check that detects the seller as a royalty recipient is skipped. In that case a primary sale is treated as a secondary sale and the seller is paid a royalty on top of the sale proceeds.
Foundation Exhibition, Scheduling & Early Access Solo Audit by Lambda
Originally disclosed on Code4rena
When the seller is also a recipient of the creator royalties, a primary sale is assumed and sellerRev is set to 0:
if (creatorRecipients[i] == seller) {
// If the seller is any of the recipients defined, assume a primary sale
creatorRev += sellerRev;
sellerRev = 0;
}
However, this loop is exited prematurely when one of the creatorShares entries is greater than BASIS_POINTS:
if (creatorShares[i] > BASIS_POINTS) {
// If the numbers are >100% we ignore the fee recipients and pay just the first instead
totalShares = 0;
break;
}
Therefore, there can be scenarios where it is not detected that the seller is a recipient of the creator royalties and a secondary sale is assumed. For instance, if creatorRecipients is [address(Bob), address(Alice), seller] and creatorShares is [100, 10_001, 100], the loop will break in the second iteration and sellerRev will not be set to 0.
Link To Affected Code
Recommended Mitigation Steps
Continue looping to detect if the seller is a creator royalty recipient, even if one creatorShares entry was invalid.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the early break used to discard invalid royalty shares also aborts the seller-is-recipient detection, so the two concerns are not separated.
Impact
A seller who is also a royalty recipient could receive royalty payments on what should be a primary sale, taking funds that would otherwise go elsewhere.
What the attacker needed
Seller is also a royalty recipient; one royalty share above 100%
The fix
The loop should keep running to check whether the seller is a royalty recipient even after an invalid share is found.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A marketplace contract splits each sale between the seller and the people who get a cut of future resales (royalties). It tries to spot when the seller is one of those royalty people, because then the sale is a first sale and no royalty should be paid. A safety check that skips bad royalty percentages also skips that detection, so the seller can be paid twice.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.