Submitted by IllIllI
NFTMarketCreators.sol#L158-L160
NFTMarketCreators.sol#L196-L198
NFTMarketCreators.sol#L97-L99
According to the README.md:
Using the Royalty Registry an owner can decide to change the royalty information right before the sale is complete, affecting who gets what.
By updating the registry to include the seller as one of the royalty recipients, the creator can steal the sale price minus fees. This is because if code finds that the seller is a royalty recipient the royalties are all passed to the creator regardless of whether the owner is the seller or not.
https://github.com/code-423n4/2022-02-concur/blob/72b5216bfeaa7c52983060ebfc56e72e0aa8e3b0/contracts/MasterChef.sol#L127-L154
When true is returned as the final return value above, the following code leaves ownerRev as zero because isCreator is true.
In addition, if the index of the seller in _recipients is greater than MAX_ROYALTY_RECIPIENTS_INDEX, then the seller is omitted from the calculation and gets zero (_sendValueWithFallbackWithdraw() doesnt complain when it sends zero).
https://github.com/code-423n4/2022-02-foundation/blob/4d8c8931baffae31c7506872bf1100e1598f2754/contracts/mixins/NFTMarketFees.sol#L76-L79
This issue does a lot of damage because the creator can choose whether and when to apply it on a sale-by-sale basis. Two other similar, but separate, exploits are available for the other blocks in _getCreatorPaymentInfo() that return arrays but they either require a malicious NFT implementation or can only specify a static seller for which this will affect things. In all cases, not only may the seller get zero dollars for the sale, but theyll potentially owe a lot of taxes based on the sale price. The attacker may or may not be the creator - creators can be bribed with kickbacks.
Always calculate owner/seller revenue separately from royalty revenue.
NickCuso (Foundation) confirmed and commented:
