Open code423n4 opened 1 year ago
Interested in the sponsors thoughts
Even though we add that modifier, it is technically not mandatory.
At most QA or Low.
miladpiri marked the issue as disagree with severity
Because the bytecode is verified, I must agree with the sponsor that the finding has validity, but impact is reduced, downgrading to QA - Low
L
GalloDaSballo changed the severity to QA (Quality Assurance)
Lines of code
https://github.com/code-423n4/2023-03-zksync/blob/21d9a364a4a75adfa6f1e038232d8c0f39858a64/contracts/BytecodeCompressor.sol#L35
Vulnerability details
Impact
Missing access control will give any user the freedom to mark known any bytecode (as far as the criteria for bytecode and bytecode hash are satisfied).
Proof of Concept
Marking bytecode hash as known is done through the function
markFactoryDeps
inKnownCodeStorage.sol
by onlyBootloader
. https://github.com/code-423n4/2023-03-zksync/blob/21d9a364a4a75adfa6f1e038232d8c0f39858a64/contracts/KnownCodesStorage.sol#L31 https://github.com/code-423n4/2023-03-zksync/blob/21d9a364a4a75adfa6f1e038232d8c0f39858a64/contracts/KnownCodesStorage.sol#L59While it is possible to publish any bytecode (as far as it has valid bytecode hash and valid compressed version) through the function
publishCompressedBytecode
inBytecodeCompressor
. https://github.com/code-423n4/2023-03-zksync/blob/21d9a364a4a75adfa6f1e038232d8c0f39858a64/contracts/BytecodeCompressor.sol#L35It seems that this function is missing access control check of
Bootloader
.Tools Used
Recommended Mitigation Steps
Recommended to add
OnlyBootloader
modifer to the functionpublishCompressedBytecode
.