`CollectionShutdown::execute()` doesn't ensure that all locked NFTs are sold
The CollectionShutdown::execute() function does not verify that all locked NFTs are included in the array of token IDs to be sold. An attacker could deposit an NFT after the admin's transaction is submitted, causing that NFT to remain locked and unsold, leading to indirect loss of funds for collection token holders.
IMAFVCKINSTARRRRRR Follow with McToady and zzykxx
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2024-08-flayer-judging/issues/502
Found by
IMAFVCKINSTARRRRRR, McToady, zzykxx
Summary
No response
Root Cause
CollectionShutdown::execute() doesn't ensure that all tokens of the collection being shutdown are added to the sudoswap pool in order to be sold.
This function takes as input an array of the token IDs to be sold via sudoswap pool. In case an NFT ID that's locked in the protocol is not in this array the NFT will stay locked and not sold.
Even if the function is only callable by admins the admins have no control on the order and the moment transactions are executed and such scenarios should be handled at the moment of execution.
Internal pre-conditions
No response
External pre-conditions
No response
Attack Path
- The protocol currently holds NFTs
55and56, admin calls CollectionShutdown::execute() by passing as a parameter[55,56]. - While the CollectionShutdown::execute() transaction is in the mempool a deposit of NFT
60is done via Locker::deposit(). - The CollectionShutdown::execute() transaction goes through and a sudoswap pool selling
55and56is created - NFT
60is locked in the protocol
Impact
NFTs that should be sold are locked in the procotol, which leads to an indirect loss of funds to collection tokens holders.
PoC
No response
Mitigation
In CollectionShutdown::execute() make sure all tokens currently locked in the protocol are added to the sudoswap pool.
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 function relies on a caller-supplied list of token IDs without checking that it covers all currently locked NFTs, so any NFT locked after the list is created is omitted.
Impact
NFTs that should be sold remain locked in the protocol, which leads to an indirect loss of funds to collection token holders.
What the attacker needed
Admin calls execute(); attacker deposits NFT during mempool wait
The fix
The function should be modified to ensure that all tokens currently locked in the protocol are added to the sudoswap pool.
How it was found
- The protocol holds NFTs 55 and 56; admin calls CollectionShutdown::execute() with parameter [55,56].
- While the execute() transaction is in the mempool, a deposit of NFT 60 is made via Locker::deposit().
- The execute() transaction goes through and a sudoswap pool selling 55 and 56 is created.
- NFT 60 remains locked in the protocol.
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 admin lists which NFTs to sell. If a new NFT is locked in the protocol after the admin prepares the list but before the transaction is processed, that NFT is not included and stays stuck. This means some NFTs are never sold, which can cause financial loss for people holding collection tokens.
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.