Skip to content
Business logic Audit finding Intermediate

GroupBuy: Lost ETH when the NFT is bought for less than the minimum reserve price

The purchase function allows an NFT to be bought for less than the minimum reserve price, but the claim function still deducts the full reserve price from each contributor's contribution, causing excess funds to be lost. An attacker could exploit this to make contributors lose their ETH when the NFT is bought at a discount.

Lambda Follow with gzeon

Originally disclosed on Code4rena

Submitted by Lambda, also found by gzeon

The purchase function does not require that an NFT is bought for exactly minReservePrices[_poolId] * filledQuantities[_poolId], the price is only not allowed to be greater:

if (_price > minReservePrices[_poolId] * filledQuantities[_poolId])
            revert InvalidPurchase();

This makes sense because it is not sensible to pay more when the purchase also succeeds with a smaller amount. However, the logic within claim does assume that the NFT was bought for minReservePrices[_poolId]. It decreases from contribution the quantity times the reserve price for all bids:

contribution -= quantity * reservePrice;

Only the remaining amount is reimbursed to the user, which can lead to a loss of funds.

Proof Of Concept

Let’s say that filledQuantities[_poolId] = 100 and minReservePrices[_poolId] (i.e., the lowest bid) was 1 ETH. However, it was possible to buy the NFT for only 50 ETH. When a user has contributed 20 * 1 ETH, he does not get anything back when calling claim, although only 10 ETH (0.5 ETH * 20) of his contributions were used to buy the NFT. The overall loss of funds for all contributors is 50 ETH.

Recommended Mitigation Steps

Set minReservePrices[_poolId] to _price / filledQuantities[_poolId] after a purchase.

stevennevins (Tessera) disagreed with severity and commented:

Not sure I agree with the severity. The mechanism is essentially users pre-state their X interest at Y quantity and so a user can never “pay” at a price greater than they essentially agreed to. We will look into ways to better handle the change and as it related to #19. I would mark this as Medium.

mehtaculous (Tessera) confirmed

HickupHH3 (judge) commented:

Funds are considered lost if the NFT was bought at a discounted price, and cannot be recovered, right? Would keep at High severity if it’s the case.

stevennevins (Tessera) commented:

Yeah correct, confirmed.

stevennevins (Tessera) mitigated:

https://github.com/fractional-company/modular-fractional/pull/207

Status: Mitigation not confirmed. Full details in reports from gzeon and IllIllI. Also included in Mitigation Review section below.


The original report as published on Code4rena, by Lambda. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 claim function uses the original minimum reserve price instead of the actual purchase price when calculating each contributor's share.

Impact

Contributors could lose funds when the NFT is bought for less than the minimum reserve price, and the loss cannot be recovered.

What the attacker needed

A pool with filled quantities; NFT bought below reserve price

The fix

The minReservePrices should be updated to the actual price divided by filledQuantities after a purchase, as mitigated in a pull request.

How it was found

  1. Set filledQuantities and minReservePrices for a pool.
  2. Purchase the NFT for a price lower than minReservePrices * filledQuantities.
  3. Call claim as a contributor who contributed at the reserve price.
  4. Observe that the contributor receives no refund despite the lower purchase price.

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.

In a group buying system, people pool money to buy an NFT. The code lets the NFT be bought for less than the agreed minimum price, but when refunding, it still subtracts the full minimum price from each person's contribution, so they get less back than they should. This means some of their money is lost.

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.

More by Lambda

View all

64 more disclosed reports, best first.

More from Tessera - Versus contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.