buyFromPrivateSaleFor() Will Fail if The Buyer Has Insufficient Balance Due to an Open Offer on The Same NFT
The buyFromPrivateSaleFor() function fails when a buyer has an open offer on the same NFT because the offer locks their funds, preventing the purchase. An attacker could not exploit this; it is a usability bug that blocks legitimate buyers.
Submitted by leastwood
NFTMarketPrivateSale.sol#L143-L150
The buyFromPrivateSaleFor() function allows sellers to make private sales to users. If insufficient ETH is provided to the function call, the protocol will attempt to withdraw the amount difference from the user’s unlocked balance. However, if the same user has an open offer on the same NFT, then these funds will remain locked until expiration. As a result, the user cannot make use of these locked funds even though they may be needed for a successful sale.
Recommended Mitigation Steps
Consider adding a _cancelBuyersOffer() call to the buyFromPrivateSaleFor() function. This should be added only to the case where insufficient ETH was provided to the trade. By cancelling the buyer’s offer on the same NFT, we can guarantee that the user has access to the correct amount of funds.
NickCuso (Foundation) confirmed and commented:
Yes - completely agree. This was an oversight on our end - and as a result it created an inconsistent experience for users. Since we leveraged an outstanding offer balance for a
buypurchase, the same behavior should occur when using Private Sales so that user’s are not in a state where they cannot make the purchase due to incorrectly having their funds locked up.As you point out without this change, it’s possible that the buyer using private sales continues to have their funds locked up for an Offer that can now only be accepted by themselves. It’s an awkward state that should be avoided.
We have made the recommended change.
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
Impact
The buyer cannot complete a private sale purchase because their funds are locked by their own offer, creating an inconsistent user experience.
What the attacker needed
Buyer has an open offer on the same NFT; buyer attempts a private sale purchase with insufficient ETH
The fix
The recommended change was to add a call to cancel the buyer's offer on the same NFT when insufficient ETH is provided, and this was implemented.
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.
This is a smart contract bug where a buyer cannot complete a purchase because their own money is temporarily locked by an offer they made on the same item. The function tries to take extra funds from their balance, but those funds are reserved for the offer, so the purchase fails.
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.