-
Notifications
You must be signed in to change notification settings - Fork 1
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
Governance.executeInstant
function: operations scheduled with predecessors delay time greater than their delay time can't be executed via executeInstant
#439
Comments
bytes032 marked the issue as low quality report |
By design. So, shcedule an operation as predessecor again with lower delay. |
miladpiri (sponsor) disputed |
GalloDaSballo changed the severity to QA (Quality Assurance) |
QA for now, will double check |
Hi @GalloDaSballo , Thank you for your time judging the contest, regarding this issue:
Could you kindly consider reevaluating this aspect of the submission? Thanks! |
@DevHals Thanks. I do not see any issue here. We have upgrade proposal1 (P1), and upgrade proposal2 (P2) which is dependant on P1. Since P1 has longer delay than P2, then P2 can not be executed now. So far, so good!
The scenario is unrealistic. |
I agree with the sponsor that this finding QA as it requires an admin mistake and the scenario is not realistic |
Lines of code
https://github.com/code-423n4/2023-10-zksync/blob/1fb4649b612fac7b4ee613df6f6b7d921ddd6b0d/code/contracts/ethereum/contracts/governance/Governance.sol#L129-L133
https://github.com/code-423n4/2023-10-zksync/blob/1fb4649b612fac7b4ee613df6f6b7d921ddd6b0d/code/contracts/ethereum/contracts/governance/Governance.sol#L204-L206
https://github.com/code-423n4/2023-10-zksync/blob/1fb4649b612fac7b4ee613df6f6b7d921ddd6b0d/code/contracts/ethereum/contracts/governance/Governance.sol#L189
https://github.com/code-423n4/2023-10-zksync/blob/1fb4649b612fac7b4ee613df6f6b7d921ddd6b0d/code/contracts/ethereum/contracts/governance/Governance.sol#L239-L241
Vulnerability details
Impact
When the
Governance
contract owner schedules an operation, he must provide the delay and the operation configuration that follows the following struct:where:
Call
structs, each representing a call to be made during the operation.When the security council calls
executeInstant
function to execute urgent operations (without checking its delay time if it has passed or not); a check is made first to ensure that the predecessor of this operation has been executed or the operation doesn't have a predecessor via _checkPredecessorDone function:So if the operation has a predecessor that has a delay greater than the operation delay ; then the
_checkPredecessorDone
will revert as the_predecessorId != bytes32(0)
and theisOperationDone(_predecessorId)
will return false; soexecuteInstant
will not be executed on this urgent operation and this will result in disabling this function for urgent updates.This issue is caused because theres's no check on the predecessor state upon scheduling operations when the operation hash is created.
Proof of Concept
Scheduling an operation:
Governance.scheduleTransparent function
Governance.hashOperation function
Executing an operation:
Governance.executeInstant function/L189
_checkPredecessorDone(_operation.predecessor);
Governance._checkPredecessorDone function
Tools Used
Manual Testing.
Recommended Mitigation Steps
Before scheduling operations: check that the
operation.predecessor
has a delay time (timestamps[predecessorId]
) < scheduled operation delay time (timestamps[operationId]
).Assessed type
Context
The text was updated successfully, but these errors were encountered: