Skip to content
Business logic Audit finding Intermediate

User can cancel or modify Dutch auctions, compromising market integrity and user trust

The relist function in Listings.sol lacks the checks present in modifyListings and cancelListings that prevent changes to Dutch auctions and liquidation listings. An attacker can use a second wallet to relist a Dutch auction as a liquid listing and then cancel it, bypassing the intended lock and manipulating the auction.

0xNirix Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-08-flayer-judging/issues/520

Found by

0xNirix

Summary

A lack of listing type preservation during relisting can be exploited by by users to modify or cancel Dutch auctions, violating core protocol principles.

Root Cause

In Listings.sol, there's a critical oversight in the relist function that allows bypassing restrictions on Dutch auctions and Liquidation listings. Here's a detailed walkthrough:

The modifyListings and cancelListings functions have checks to prevent modification of Dutch auctions: https://github.com/sherlock-audit/2024-08-flayer/blob/main/flayer/src/contracts/Listings.sol#L312 and https://github.com/sherlock-audit/2024-08-flayer/blob/main/flayer/src/contracts/Listings.sol#L430

Solidity
function modifyListings(address _collection, ModifyListing[] calldata _modifyListings, bool _payTaxWithEscrow) public nonReentrant lockerNotPaused returns (uint taxRequired_, uint refund_) {
    // ...
    if (getListingType(listing) != Enums.ListingType.LIQUID) revert InvalidListingType();
    // ...
}

function cancelListings(address _collection, uint[] memory _tokenIds, bool _payTaxWithEscrow) public lockerNotPaused {
    // ...
    if (getListingType(listing) != Enums.ListingType.LIQUID) revert CannotCancelListingType();
    // ...
}

However, the relist function lacks these checks:

Solidity
function relist(CreateListing calldata _listing, bool _payTaxWithEscrow) public nonReentrant lockerNotPaused {
    // Read the existing listing in a single read
    Listing memory oldListing = _listings[_collection][_tokenId];

    // Ensure the caller is not the owner of the listing
    if (oldListing.owner == msg.sender) revert CallerIsAlreadyOwner();

    // ... price difference payment logic ...

    // We can process a tax refund for the existing listing
    (uint _fees,) = _resolveListingTax(oldListing, _collection, true);

    // Validate our new listing
    _validateCreateListing(_listing);

    // Store our listing into our Listing mappings
    _listings[_collection][_tokenId] = listing;

    // Pay our required taxes
    payTaxWithEscrow(address(collectionToken), getListingTaxRequired(listing, _collection), _payTaxWithEscrow);

    // ... events ...
}

This function allows any non-owner to relist an item, potentially changing its type from Dutch or liquidation to liquid. The attacker suffers minimal loss due to:

a) Tax refund for the old listing:

Solidity
(uint _fees,) = _resolveListingTax(oldListing, _collection, true);

b) Immediate cancellation after relisting, which refunds most of the new listing's tax:

Solidity
function _resolveListingTax(Listing memory _listing, address _collection, bool _action) private returns (uint fees_, uint refund_) {
    // ...
    if (block.timestamp < _listing.created + _listing.duration) {
        refund_ = (_listing.duration - (block.timestamp - _listing.created)) * taxPaid / _listing.duration;
    }
    // ...
}

This oversight allows attackers to bypass the intended restrictions on Dutch auctions and Liquidation listings, violating the core principle of auction immutability with minimal financial loss.

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

  1. Attacker creates a Dutch auction or liquidation listing from Wallet A.
  2. Attacker uses Wallet B to call relist, converting the Dutch auction to a Liquid listing by modifying the duration.
  3. Attacker immediately cancels the new liquid listing using cancelListings at minimal cost.

Impact

The NFT holders and potential bidders suffer a loss of trust and market efficiency. The attacker gains the ability to manipulate auctions, potentially extracting value by gaming the system. This violates the core principle stated in the whitepaper like around expiry of a liquid auction - the item is immediately locked into a dutch auction where the price falls from its current floor multiple down to the floor (1x) over a period of 4 days. However, as seen in this issue, the lock can be broken by just relisting and then cancelling. The issue affects not only Dutch auctions but also liquidation listings which can be similarly canceled or modified and is not properly handled. For example, in case a liquidation listing is cancelled, the _isLiquidation[_collection][_tokenId] flag is not cleared causing further issues.

PoC

No response

Mitigation

No response

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

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 relist function does not verify that the existing listing is of a type that may be relisted, unlike modifyListings and cancelListings which check for liquid listings only.

Impact

The attacker could manipulate auctions with minimal financial loss, causing loss of trust and market efficiency; the issue also affects liquidation listings, and cancelling a liquidation listing may leave the _isLiquidation flag uncleared.

What the attacker needed

Two wallets; ability to create a Dutch auction or liquidation listing

How it was found

  1. Attacker creates a Dutch auction or liquidation listing from Wallet A.
  2. Attacker uses Wallet B to call relist, converting the Dutch auction to a Liquid listing by modifying the duration.
  3. Attacker immediately cancels the new liquid listing using cancelListings at minimal cost.

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 Dutch auction is a sale where the price starts high and drops over time. The contract tries to stop people from cancelling or changing such auctions early, but one function (relist) forgot to apply that rule. So someone can use a second wallet to relist the auction as a normal sale and then cancel it, getting around the restriction.

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 0xNirix

View all

10 more disclosed reports, best first.

More from Flayer

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.