If a collection has been shutdown but later re-initialized, it cannot be shutdown again
A collection that was shut down and later re-initialised cannot be shut down again because the shutdown vote count is not reset to zero. This prevents the shutdown process from starting a second time.
Source: https://github.com/sherlock-audit/2024-08-flayer-judging/issues/318
Found by
0x37, 0xAlix2, Audinarey, BugPull, Hearmen, OpaBatyo, dany.armstrong90, merlinboii, novaman33, robertodf
Summary
If a collection has been shutdown, it can later be re-initialized for use in the protocol again. But any attempts to shut it down again will fail due to a varaible not being reset when the first shutdown is made.
Vulnerability Detail
When a collection's shutdown has collected >= quorum votes, the admin can initiate the execution of shutdown which essentially sunsets the collection from the locker and lists all the NFTs in a sudoswap pool so owners of the collection token can later claim their share of the sale proceeds.
When the call to sunsetCollection() in Locker.sol is made, it deletes both the _collectionToken and collectionInitialized mappings' entries so that the collection can later be re-registered and initialized if there is interest:
// Delete our underlying token, then no deposits or actions can be made
delete _collectionToken[_collection];
// Remove our `collectionInitialized` flag
delete collectionInitialized[_collection];
The issue is that nowhere during the shutdown process is the params.shutdownVotes variable reset back to 0. The only way for it to decrease is if a user reclaims their vote, but then the shutdown won't finalize at all. In normal circumstances, the variable is checked against to ensure it is 0 before starting a collection shutdown, in order to prevent starting 2 simulteaneous shutdowns of the same collection.
if (params.shutdownVotes != 0) revert ShutdownProcessAlreadyStarted();
Thus, since it is never reset back to 0 when the shutdown is executed, if the collection is later re-initialized into the protocol and an attempt to shutdown again is made, the call to start() will revert on this line.
Impact
A collection that has been shutdown and later re-initialized can never be shutdown again.
Code Snippet
if (params.shutdownVotes != 0) revert ShutdownProcessAlreadyStarted();
Tool used
Manual Review
Recommendation
Reset variable back to 0 when all users have claimed their tokens and the process of shutting down a collection is completely finished.
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
The shutdown vote count variable is not reset to zero when a collection is shut down, so it remains non-zero and blocks future shutdown attempts.
What the attacker needed
Collection previously shut down; collection re-initialised; shutdown votes reach quorum
The fix
Reset the shutdown vote count to zero when the shutdown process is completely finished and all users have claimed their tokens.
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.
When a collection is shut down, the system forgets to clear a counter that tracks votes for shutdown. If the collection is later brought back, trying to shut it down again fails because the counter still has old votes, making the system think a shutdown is already in progress.
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.