# In the `Listings.sol#relist()` function, `listing.created` is not set to `block.timestamp`.

In Flayer's Listings.relist(), listing.created is taken from user input instead of block.timestamp, letting an attacker set it to max and permanently block CollectionShutdown.execute().

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

**Target:** Listings.sol relist() / CollectionShutdown.sol
**Root cause:** relist() stores the caller-supplied listing struct directly without overwriting listing.created with block.timestamp, so an attacker controls the created field.
**Steps:**
1. Attacker calls `listings.relist({_listing: CreateListing({collection, tokenIds, listing: Listing({owner, created: uint40(type(uint32).max), duration: MIN_LIQUID_DURATION, floorMultiple})}), _payTaxWithEscrow: false})` on a floor item.
2. The listing is stored with created = max instead of block.timestamp.
3. CollectionShutdown._hasListings(collection) checks listing.created and always returns true for this token.
4. CollectionShutdown.execute() reverts, blocking shutdown for the collection.
**How found:** Researcher noticed relist() copies the user-supplied Listing struct into storage without normalizing created, then traced how CollectionShutdown._hasListings uses listing.created to gate execute().
**Exploitation:** Attacker relists a floor token with created set to type(uint32).max; the malicious timestamp persists in storage, causing _hasListings to always report an active listing and making CollectionShutdown.execute() revert for that collection.
**Insight:** When a function accepts a struct from calldata and writes it to storage, check every field that downstream logic trusts (timestamps, owners, flags) for missing server-side normalization.

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

**Relist test setting created to uint32 max**

```
listings.relist({
            _listing: IListings.CreateListing({
                collection: address(erc721a),
                tokenIds: _tokenIdToArray(_tokenId),
                listing: IListings.Listing({
                    owner: _relister,
-->                 created: uint40(type(uint32).max),
                    duration: listings.MIN_LIQUID_DURATION(),
                    floorMultiple: _floorMultiple
                })
            }),
            _payTaxWithEscrow: false
        });

        vm.stopPrank();

        // Confirm that the listing has been created with the expected details
        IListings.Listing memory _listing = listings.listings(address(erc721a), _tokenId);

        assertEq(_listing.created, block.timestamp);
    }
```

**Mitigation setting created to block.timestamp**

```
_listings[_collection][_tokenId] = listing;

+++     _listings[_collection][_tokenId].created = uint40(block.timestamp);        

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

