Platform: Code4rena
Start Date: 28/10/2022
Pot Size: $165,500 USDC
Total HM: 2
Participants: 24
Period: 12 days
Judge: GalloDaSballo
Total Solo HM: 1
Id: 177
League: ETH
Rank: 3/24
Findings: 1
Award: $24,571.73
π Selected for report: 0
π Solo Findings: 0
π Selected for report: HE1M
Also found by: codehacker
24571.7345 USDC - $24,571.73
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
There is a function executeDiamondCutProposal
in the DiamondCutFacet
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:
require( s.diamondCutStorage.proposedDiamondCutHash == keccak256(abi.encode(_diamondCut.facetCuts, _diamondCut.initAddress)), "a4" ); // proposal should be created
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).
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.
#0 - miladpiri
2022-11-22T18:34:25Z
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. All in all, we are doubting assessing this issue #315 Low or Medium. We are mostly inetending to assess this as Low, but the judge's point of view can also help us!
#1 - c4-sponsor
2022-11-22T18:34:34Z
miladpiri requested judge review
#2 - c4-sponsor
2022-11-22T18:51:34Z
miladpiri marked the issue as disagree with severity
#3 - GalloDaSballo
2022-11-27T20:49:49Z
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. All in all, we are doubting assessing this issue #315 Low or Medium. We are mostly inetending to assess this as Low, but the judge's point of view can also help us!
Thank you @miladpiri , we do have a way to mark as dup but award a 50% / 25% score, will apply that modifier
#4 - c4-judge
2022-12-02T21:36:35Z
GalloDaSballo marked the issue as duplicate of #46
#5 - c4-judge
2022-12-02T21:36:45Z
GalloDaSballo marked the issue as partial-50
#6 - c4-judge
2022-12-02T21:38:13Z
GalloDaSballo marked the issue as full credit
#7 - GalloDaSballo
2022-12-02T21:39:08Z
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
#8 - c4-judge
2022-12-06T18:37:44Z
GalloDaSballo marked the issue as satisfactory