# The `relist` function does not check whether the listing is a liquidation listing causing users to pay taxes and refunds being paid to the listing owner who did not pay taxes

Flayer's relist lacks a liquidation-status check, so relisting a liquidated listing refunds taxes to the original owner who never paid them, draining protocol funds.

- Payout: Audit contest
- Severity: high
- Program: Flayer
- Found by: 0x37
- Disclosed: 2024-08-06
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-08-flayer-judging/issues/547
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AH-16
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:liquidation

**Target:** Listings.relist in Flayer Locker/Listings contract
**Root cause:** Liquidated listings are created without the original owner paying taxes, but relist unconditionally calls _resolveListingTax with a refund, crediting the non-paying original owner.
**Steps:**
1. Liquidate a listing so _isLiquidation[collection][tokenId] is set and no tax was paid by original owner.
2. Call `relist(_listing, _payTaxWithEscrow)` on the liquidated tokenId as a different caller.
3. relist invokes `_resolveListingTax(oldListing, _collection, true)` which computes and pays a tax refund to oldListing.owner.
4. Relister pays new listing tax while original owner receives undeserved refund.
**How found:** Reviewer noticed liquidated listings bypass tax payment at creation and traced relist's unconditional _resolveListingTax refund path, spotting the missing _isLiquidation check.
**Exploitation:** Attacker relists a liquidated listing; the contract refunds taxes to the original owner who never paid them, extracting protocol funds on each relist.
**Insight:** When a state flag (liquidation) changes how a listing was created, audit every downstream function that assumes the normal creation path paid taxes/fees; refund logic keyed on owner is a common leak.

## Proof of concept (copied exactly from the original report)

**relist function missing liquidation check**

```
function relist(CreateListing calldata _listing, bool _payTaxWithEscrow) public nonReentrant lockerNotPaused {
  // Load our tokenId
  address _collection = _listing.collection;
  uint _tokenId = _listing.tokenIds[0];

  // 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();

  // Load our new Listing into memory
  Listing memory listing = _listing.listing;

  // Ensure that the existing listing is available
  (bool isAvailable, uint listingPrice) = getListingPrice(_collection, _tokenId);
  if (!isAvailable) revert ListingNotAvailable();

  // We can process a tax refund for the existing listing
@>(uint _fees,) = _resolveListingTax(oldListing, _collection, true);
  if (_fees != 0) {
    emit ListingFeeCaptured(_collection, _tokenId, _fees);
  }

  // Find the underlying {CollectionToken} attached to our collection
  ICollectionToken collectionToken = locker.collectionToken(_collection);

  // If the floor multiple of the original listings is different, then this needs
  // to be paid to the original owner of the listing.
  uint listingFloorPrice = 1 ether * 10 ** collectionToken.denomination();
  if (listingPrice > listingFloorPrice) {
    unchecked {
      collectionToken.transferFrom(msg.sender, oldListing.owner, listingPrice - listingFloorPrice);
    }
  }

  // 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);

  // Emit events
  emit ListingRelisted(_collection, _tokenId, listing);
}
```

