Open c4-bot-5 opened 7 months ago
alex-ppg marked the issue as primary issue
alex-ppg changed the severity to 3 (High Risk)
saxenism (sponsor) confirmed
saxenism marked the issue as disagree with severity
This is a good finding, but we consider this a medium
severity issue because in the current codebase admin
could also unfreeze (so no permanent freeze & so not high), but in the future we might wanna change this mechanism
alex-ppg marked the issue as satisfactory
alex-ppg marked the issue as selected for report
The submission and its relevant duplicates have identified a mistype in the codebase that causes certain functionality that is expected to be accessible to behave oppositely.
The exhibit represents an actual error in the code resulting in functionality missing, however, the functionality does contain an alternative access path per the Sponsor's statement and as such I consider this exhibit to be of medium risk.
alex-ppg changed the severity to 2 (Med Risk)
Lines of code
https://github.com/code-423n4/2024-03-zksync/blob/main/code/contracts/ethereum/contracts/state-transition/StateTransitionManager.sol#L165-L167
Vulnerability details
Vulnerability Details & POC
StateTransitionManager::unfreezeChain
function is meant for unfreeze the freezed chain of passed_chainId
param. WhilefreezeChain
function is meant for freeze the chain according to passed _chainId. ButfreezeChain
andunfreezeChain
both functions are calling same functionfreezeDiamond
by same lineIZkSyncStateTransition(stateTransition[_chainId]).freezeDiamond()
by mistake. So both these function will only freeze the chain.Also there is no other function inside
StateTransitionManager.sol
contract which is callingunfreezeDiamond
.unfreezeDiamond
is function defined inAdmin.sol
where the call is going sinceIZkSyncStateTransition
also inherits IAdmin which have freezeDiamond and unfreezeDiamond both functions. ButunfreezeDiamond
is not called fromunfreezeChain
function. So freezed chain will never be unfreeze.unfreezeChain
also have wrong comment instead of writing unfreezes it writes freezes. It seems like dev just copy pasted without doing required changes.Vulnerable Code
code/contracts/ethereum/contracts/state-transition/StateTransitionManager.sol#L165-L167
(https://github.com/code-423n4/2024-03-zksync/blob/main/code/contracts/ethereum/contracts/state-transition/chain-interfaces/IZkSyncStateTransition.sol#L15)
IZkSyncStateTransition is inheriting IAdmin and by IZkSyncStateTransition wrapping instance is prepared to call freezeDiamond.
IAdmin interfaces have both functions
It shows that by mistake unfreezeChain is calling freezeDiamond instaed of unfreezeDiamond which should be used to unfreeze th chain.
Impact
freezed chain will never be unfreeze. Since
freezeChain
andunfreezeChain
both functions are calling same functionfreezeDiamond
which is used to freeze the chain. AndunfreezeDiamond
no where called which should is made for unfreeze the freezed chain.Tools Used
Manual Review
Recommended Mitigation
In
StateTransitionManager::unfreezeChain
function callunfreezeDiamond
instead offreezeDiamond
onIZkSyncStateTransition(stateTransition[_chainId])
instance.Assessed type
Other