-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No commitment to data passed as input to the init contract during the execution of the diamond cut proposal #315
Comments
It is duplicate of #46 and we agree that #46 is medium severity, but this report is not well-written (low quality) and it is difficult to understand the scenario, that is why we were thinking to downgrade this to Low because of unclear statement. So, it was difficult to asses it as Medium or Low. It seems unfair to asses both #46 and #315 equally. |
miladpiri requested judge review |
miladpiri marked the issue as disagree with severity |
Thank you @miladpiri , we do have a way to mark as dup but award a 50% / 25% score, will apply that modifier |
GalloDaSballo marked the issue as duplicate of #46 |
GalloDaSballo marked the issue as partial-50 |
GalloDaSballo marked the issue as full credit |
I agree with the sponsor in making #46 primary (it get's an extra credit), but I think the submission is substantially the same:
For this reason am marking as dup of 46 |
GalloDaSballo marked the issue as satisfactory |
Lines of code
https://github.com/code-423n4/2022-10-zksync/blob/main/ethereum/contracts/zksync/facets/DiamondCut.sol#L46
https://github.com/code-423n4/2022-10-zksync/blob/main/ethereum/contracts/zksync/facets/DiamondCut.sol#L61
https://github.com/code-423n4/2022-10-zksync/blob/main/ethereum/contracts/zksync/libraries/Diamond.sol#L92
https://github.com/code-423n4/2022-10-zksync/blob/main/ethereum/contracts/zksync/libraries/Diamond.sol#L113
https://github.com/code-423n4/2022-10-zksync/blob/main/ethereum/contracts/zksync/libraries/Diamond.sol#L282
Vulnerability details
Description
There is a function
executeDiamondCutProposal
in theDiamondCutFacet
contract. It checks that proposal data passed as input to this call is equal to the data that is declared when the creation of this proposal using the following logic:But there are no checks on data that is used as input to the init contract during the execution of the diamond cut proposal.
Although such functionality may be in demand for the cases when part of the input data will be known only at the stage of execution of the proposal, in most cases init input data will be known at the stage of creation of the proposal, so it will be better to include such data to the proposal hash preimage. It will prevent a user from malicious input data that can be passed when executing the proposal and even from malicious input data that can be passed by an attacker through a potential leak of the governance private key (in the case when the governance private key was stolen attacker will not have an ability to maliciously run a fast upgrade and stole assets due to notice period, but in the case when trusted governance initiated the proposal, an attacker will have the ability to execute it with malicious init contract's input data).
Recommended Mitigation Steps
Use a combination of the data that is expected to be known at the stage of creation of the proposal (including such data as a part of the proposal hash preimage) with the data that is expected to be known only at the stage of the execution of the proposal.
The text was updated successfully, but these errors were encountered: