in the _white_list_collection
function:
When removing a collection from the whitelist (setting enabled
to false), the function only updates the linked list if the collection is at the head or somewhere in the middle. It fails to handle the case where the collection to be removed is at the end of the list.
This could lead to a situation where a disabled collection at the end of the list is still considered part of the whitelist when iterating through it, as the previous element would still point to it.
This bug could cause issues with the whitelist management, potentially allowing disabled collections to be treated as whitelisted in some scenarios.
Flow/PoC:
Several collections are whitelisted.
The last collection in the list is removed from the whitelist using white_list_collection(last_collection, false)
.
Due to the bug, this collection remains linked in the list.
When deposit_tokens
is called, it checks if the collection is whitelisted using _is_white_listed
.
_is_white_listed
uses get_white_listed_collections
, which iterates through the linked list.
The removed collection is still in this list, so it's considered whitelisted.
This allows tokens from a supposedly non-whitelisted collection to be bridged.
This vulnerability could be exploited to bridge tokens from collections that should be restricted, potentially leading to unauthorized asset transfers between L1 and L2
To fix this, the function should ensure that when removing the last element in the list, the previous element's "next" pointer is set to zero. This would require keeping track of the previous element throughout the entire loop, not just when finding the collection to remove.
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.