A critical vulnerability has been identified in the governance and timelock contract interaction. The vulnerability allows malicious users to bypass the governance voting process and directly execute proposals by leveraging the scheduleBatch and executeBatch functions in the timelock contract. This bypass occurs because the timelock contract does not validate whether a proposal has been approved by the governance contract before execution. As a result, any user with the PROPOSER_ROLE and EXECUTOR_ROLE can schedule and execute arbitrary operations without requiring a vote. It is important to note that the proposal also do not need to be created.
Affected Code: TimelockController::scheduleBatch & executeBatch
The vulnerability stems from the following issues:
Lack of Governance Validation in Timelock Contract: The scheduleBatch and executeBatch functions in the timelock contract do not verify whether the proposal being executed has been approved by the governance contract. This allows malicious users to directly schedule and execute operations without going through the governance voting process.
Role-Based Access Control (RBAC) Misconfiguration: The PROPOSER_ROLE and EXECUTOR_ROLE are not sufficiently restricted. Any user granted these roles can schedule and execute operations, even if the operations were not created through the governance contract.
The provided PoC demonstrates how a malicious user can bypass the governance process:
A legitimate proposal is created through the governance contract this is so that the attacker is given the PROPOSER_ROLE.
The malicious user, granted the PROPOSER_ROLE, schedules an operation directly through the timelock contract using the scheduleBatch function.
After the delay period, the EXECUTOR executes the operation using the executeBatch function.
The operation is executed successfully, bypassing the governance voting process.
The PoC code is as follows:
The vulnerability has severe implications:
Unauthorized Execution: Malicious users can execute arbitrary operations without governance approval, leading to potential loss of funds or unauthorized changes to the protocol.
Governance Bypass: The governance process is rendered ineffective, as proposals can be executed without requiring votes from token holders.
Loss of Trust: The vulnerability undermines the trustworthiness of the governance mechanism, potentially leading to reputational damage and loss of user confidence.
Manual Review
Hardhat
To fix the vulnerability, add the following checks to the scheduleBatch and executeBatch functions:
scheduleBatchEnsure the proposal is in the Succeeded state before queuing:
executeBatchEnsure the proposal is in the Queued state before execution:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.