Inappropriate support of EIP-2981
The NFT marketplace contract always passes a fixed sale price of 10,000 basis points when querying EIP-2981 royalty information, instead of the actual sale price. This means recipients entitled to less than 1 basis point of the sale price may receive no royalties, and collections with a total royalty rate below 10% are scaled up to 10%.
Submitted by WatchPug
if (nftContract.supportsERC165Interface(type(IRoyaltyInfo).interfaceId)) {
try IRoyaltyInfo(nftContract).royaltyInfo{ gas: READ_ONLY_GAS_LIMIT }(tokenId, BASIS_POINTS) returns (
address receiver,
uint256 /* royaltyAmount */
) {
if (receiver != address(0)) {
recipients = new address payable[](1);
recipients[0] = payable(receiver);
// splitPerRecipientInBasisPoints is not relevant when only 1 recipient is defined
if (receiver == seller) {
return (recipients, splitPerRecipientInBasisPoints, true);
}
}
} catch // solhint-disable-next-line no-empty-blocks
{
// Fall through
}
}
The current implementation of EIP-2981 support will always pass a constant BASIS_POINTS as the _salePrice.
As a result, the recipients that are supposed to receive less than 1 BPS of the salePrice may end up not receiving any royalties.
Furthermore, for the NFTs with the total royalties rate set less than 10% for some reason, the current implementation will scale it up to 10%.
Recommended Mitigation Steps
- Instead of passing a constant of 10,000 as the
_salePrice, we suggest using the actual_salePrice, so there the royalties can be paid for recipients with less than 1 BPS of the royalties. - When the total royalties cut is lower than 10%, it should be honored. It’s capped at 10% only when the total royalties cut is higher than 10%.
NickCuso (Foundation) acknowledged and commented:
Yes, these are valid points and something we will consider revisiting in the future.
RE recommendations:
- This can only impact < 0.01% of the payment so not a concern ATM. It may be more appropriate to better honor exact amounts, but it’s a non-trivial change to an important code path so we will leave it as-is for now. With payments that small, it’s probably more appropriate to be using a contract to manage the payouts - e.g. https://www.0xsplits.xyz/ could handle this well.
- I agree. ATM we always enforce exactly 10% so that there is a consistent experience with our market and on our website. We will revisit this in the future, and the idea of capping it to 10% but accepting lower is a great one.
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 code passes a constant `BASIS_POINTS` (10,000) as the `_salePrice` argument to `royaltyInfo` instead of the actual sale price, and then applies a fixed 10% cap without honouring lower total royalty rates.
Impact
Recipients with a royalty share below 1 basis point may receive no payment, and collections with a total royalty rate under 10% are overcharged to 10%; the project acknowledged these points but left the behaviour unchanged for now.
What the attacker needed
NFT contract implements EIP-2981; Royalty recipient share below 1 basis point; or total royalty rate below 10%
The fix
The contract should pass the actual sale price to `royaltyInfo` and should honour total royalty rates below 10%, capping only when the rate exceeds 10%; the project acknowledged the issue but did not fix it at the time.
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.
When an NFT is sold, the marketplace asks the NFT contract how much royalty to pay. The marketplace always asks using a fixed example sale price of 10,000 units, not the real price. So if a creator should get a tiny slice (less than 1 unit out of 10,000), that slice rounds down to zero and they get nothing; and if a collection set royalties below 10%, the marketplace still pays 10%.
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.