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

No Storage Gap for Upgradeable Contracts

Vulnerability Details

In upgradable contracts, there should be a storage location for variables to get added freely without causing any storage collision. In Bridge.sol we can see that the contract inherits from a lot of contracts each of them has its own variables.

Bridge.sol#L30

contract Starklane is IStarklaneEvent, UUPSOwnableProxied, StarklaneState, StarklaneEscrow, StarklaneMessaging, CollectionManager {
// Mapping (collectionAddress => bool)
mapping(address => bool) _whiteList;
address[] _collections;
bool _enabled;
bool _whiteListEnabled;
...
}

If we checked StarklaneState for example we will find that it has its own variables.

State.sol#L13-L22

contract StarklaneState is Ownable {
// StarknetCore.
IStarknetMessaging _starknetCoreAddress;
// Starklane L2 address for messaging.
snaddress _starklaneL2Address;
// Bridge L2 selector to deposit token from L1.
felt252 _starklaneL2Selector;
...
}

Since the idea of upgrading the contract is either adding features or fixing issues, there can be new variables added. So any addition of new variables in one of the child contracts that Bridge inherits from them, will result in storage collision and corruption of all the contract states.

Impact

Inability to add new features / fix issues to the contract, which will require adding variables to contracts That Bridge inherit from it.

Tools Used

Manual Review

Recommendations

Adding Storage Gap to All Contracts that the Bridge contract Directly inherits from them, this includes UUPSOwnableProxied, StarklaneState, StarklaneEscrow, StarklaneMessaging, and CollectionManager.

uint256[50] private __gap;
Updates

Lead Judging Commences

n0kto Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

invalid-upgradeable-storage-gap-known-issue

Known issue: Lightchaser

Support

FAQs

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