A critical step is missing in the _white_list_collection
function, which leads to an infinite loop. Specifically, the instruction to update the prev
variable with the value of next
is absent. This omission prevents the loop from progressing as intended, causing the program to become stuck in an endless cycle.
The _white_list_collection
function is designed to enable or disable an NFT collection within the system. This function can be triggered through two primary scenarios:
Creation of a New NFT Collection: When a new NFT collection is created and needs to be added to the whitelist.
Admin Control: When an admin wants to enable or disable an existing NFT collection.
While the function correctly handles the enabling of a collection, the logic for disabling a collection is flawed.
Here is the relevant code snippet from the _white_list_collection
function:
In the code, the function first checks if the current
status of the collection is different from the desired status (enabled
). If the statuses differ, the function attempts to update the whitelist configuration.
Enabling Logic: When the collection is to be enabled, the function works correctly.
Disabling Logic: The issue arises when the function tries to disable a collection. Inside the loop that traverses the linked list, the prev
variable is supposed to be updated with the value of next
so that the loop can move forward to the next element in the list. However, this crucial step is missing, causing the loop to repeatedly check the same element, leading to an infinite loop.
Due to this infinite loop, an admin is unable to disable an NFT collection. This bug effectively locks the admin out of performing this action, which could have severe implications for the manageability and functionality of the NFT collections.
Manual Review
To resolve this issue, the missing line of code prev = next
should be added at the end of the loop. This will ensure that the prev
variable is correctly updated, allowing the loop to proceed to the next element and eventually exit as expected.
Likelyhood: High, owner can only unwhitelist the 2 first collections. Impact: Medium/High, owner has to empty the list to remove any collection, and replace all the new ones.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.