NFTBridge
60,000 USDC
View results
Submission Details
Severity: medium
Invalid

There is no check for collection existence

Summary

There is no check for collection existence.

Vulnerability Details

The _white_list_collection function assumes that the collection to be removed exists in the list.

if enabled {
self.white_listed_list.write(collection, (enabled, no_value));
if prev.is_zero() {
self.white_listed_head.write(collection);
return;
}
// find last element
loop {
let (_, next) = self.white_listed_list.read(prev);
if next.is_zero() {
break;
}
let (active, _) = self.white_listed_list.read(next);
if !active {
break;
}
prev = next;
};
self.white_listed_list.write(prev, (true, collection));

https://github.com/Cyfrin/2024-07-ark-project/blob/273b7b94986d3914d5ee737c99a59ec8728b1517/apps/blockchain/starknet/src/bridge.cairo#L496C11-L514C72

If the collection doesn't exist in the list, the loop will traverse the entire list without finding the collection. After the loop, it will still execute self.white_listed_list.write(collection, (false, no_value));.

Impact

The function creates a new entry for a non-existent collection and marks it as inactive.

Tools Used

Manual review

Recommendations

Add a check to see if the collection was found, and only modify the state if it was found.

Updates

Lead Judging Commences

n0kto Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice

Appeal created

sabit Submitter
12 months ago
n0kto Lead Judge
12 months ago
n0kto Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.