`GenesisUpgrade::upgrade` function can be called by anyone any no. of times, also through proxy due to no access control and can change important values in storage `protocolVersion` and `verifier`.
Audit: 2024-03-zksync-findings
Severity: MEDIUM

# Lines of code

https://github.com/code-423n4/2024-03-zksync/blob/main/code/contracts/ethereum/contracts/upgrades/GenesisUpgrade.sol#L14-L17


# Vulnerability details



## Vulnerability Details

Since `GenesisUpgrade` inherits `BaseZkSyncUpgradeGenesis` and `upgrade` function is overridden from this.
The comment in BaseZkSyncUpgradeGenesis::upgrade function says _This is a virtual function and should be overridden by custom upgrade implementations._
But when overriding no access control were introduced resulting in calling by everyone. Since parant function upgrade also doesn't have any access control when called by super. from child.
Since this function changes important params in `s` storage struct variable like `s.protocolVersion`,`s.verifier` and many others. Due to no access control these can be changed by anyone and can be exploited by it.

### Vulnerable Code

[GenesisUpgrade::upgrade function](https://github.com/code-423n4/2024-03-zksync/blob/main/code/contracts/ethereum/contracts/upgrades/GenesisUpgrade.sol#L14C5-L17C6)

```solidity
11:  contract GenesisUpgrade is BaseZkSyncUpgradeGenesis {
    /// @notice The main function that will be called by the upgrade proxy.
    /// @param _proposedUpgrade The upgrade to be executed.
    //@audit upgrade function doesn't have any access control
 14:   function upgrade(ProposedUpgrade calldata _proposedUpgrade) public override returns (bytes32) {
 15:       super.upgrade(_proposedUpgrade);//@audit calling parent's upgrade which also not has access control
        return Diamond.DIAMOND_INIT_SUCCESS_RETURN_VALUE;
    }
```

[BaseZkSyncUpgradeGenesis::upgrade function](https://github.com/code-423n4/2024-03-zksync/blob/main/code/contracts/ethereum/contracts/upgrades/BaseZkSyncUpgradeGenesis.sol#L47C4-L57C103)

```solidity
17:  abstract contract BaseZkSyncUpgradeGenesis is BaseZkSyncUpgrade {

      ...
//@audit No access control
47:  function upgrade(ProposedUpgrade calldata _proposedUpgrade) public virtual override returns (bytes32) {
        // Note that due to commitment delay, the timestamp of the L2 upgrade batch may be earlier than the timestamp
        // of the L1 block at which the upgrade occurred. This means that using timestamp as a signifier of "upgraded"
        // on the L2 side would be inaccurate. The effects of this "back-dating" of L2 upgrade batches will be reduced
        // as the permitted delay window is reduced in the future.
        require(block.timestamp >= _proposedUpgrade.upgradeTimestamp, "Upgrade is not ready yet");

54:        _setNewProtocolVersion(_proposedUpgrade.newProtocolVersion);//@audit changing imp. storage values
55:        _upgradeL1Contract(_proposedUpgrade.l1ContractsUpgradeCalldata);
56:        _upgradeVerifier(_proposedUpgrade.verifier, _proposedUpgrade.verifierParams);//@audit changing imp. storage values
57:        _setBaseSystemContracts(_proposedUpgrade.bootloaderHash, _proposedUpgrade.defaultAccountHash);

      ...

     }
}
```

## Impact

Due t