If whitelist is off, someone can add a lot of collections to the whitelist DOSing the creation and whitelisting of legitimate collections. The DOS would occur in this function in Bridge.sol:
When the whitelist is off on any of the bridges, anyone can add whatever collection they like by bridging it from L1 -> L2 or vice versa. Let's take a look at this part of the Bridge::withdrawToken() function:
As you can see when the collection is not deployed it'll be automatically added to the whitelist. Now let's take a closer look at the _whiteListCollection
function:
As you can see, the function loops through all of the collections no matter if they are whitelisted or not.
So what could happen is that when the whitelist is off, a malicious actor can create a very big number of collections, in our example on L2, then bridge them to L1, which adds them both to the whitelist and to the collections array, causing the _whiteListCollection
function to revert due to an Out-of-Gas error.
This will DOS the whitelisting of collections and by extension DOS on the withdrawTokens()
function which would lead to legitimate users' tokens being stuck permanently in the contract. In our example, the tokens will be stuck in the L2 contract and won't be withdrawable on the L1 contract.
The impact and the possibility of this attack are increased since both sides of the bridge are deployed with the whitelist being off by default:
The _whiteListEnabled
bool is not set during initialization and bool's default value is false
. And on the L2 side:
This opens up the possibility that a malicious actor could perform the attack in between deployment and enabling the whitelist but it's also possible to be executed each time the whitelist is being off.
Once the attack is performed the bridge would be unusable by any new collections since there is no mechanism to remove collections from the collections array.
Users' tokens will get stuck permanently in the bridge contracts.
Manual review
Find a more efficient way to loop through the collections array or remove the array entirely. We're only interested in the whitelisted collection anyway.
If you decide to stick with the collections array, add a function that allows an admin to remove elements from it.
I'd also suggest that the bridges should be deployed with an enabled whitelist by default.
Likelyhood: High, once the whitelist option is disabled, collections will grow. Impact: High, withdraw won’t be possible because of Out-Of-Gas.
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.