Only the state() of the latest proposal can be checked
The state() function in a governance contract incorrectly requires the proposal ID to be less than or equal to the total proposal count, which means only the most recent proposal's state can be checked. This prevents older proposals from being executed, reducing the governor's availability.
Submitted by hake
state() function cannot view the state from any proposal except for the latest one.
Proof of Concept
require(proposalCount >= proposalId && proposalId > initialProposalId, "GovernorBravo::state: invalid proposal id");
Currently proposalCount needs to be bigger or equal to proposalId.
Assuming proposalId is incremented linearly in conjunction with proposalCount, this implies only the most recent proposalId will pass the require() check above. All other proposals will not be able to have their states checked via this function.
Recommended Mitigation Steps
Change above function to proposalCount <= proposalId (assuming proposalId is set linearly, which currently is not enforced by code).
Alex the Entreprenerd (judge) commented:
The warden has shown how, due to a mistake in logic, only the
stateof the latest proposal can be read.Because the function
stateis used inexecutewe can conclude that only one proposal can be queue for execution at a time, drastically reducing the availability of the Governor.For this reason I believe medium severity is appropriate.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the require statement uses the wrong comparison operator, checking proposalCount >= proposalId instead of proposalCount <= proposalId.
Impact
Only one proposal can be queued for execution at a time, drastically reducing the availability of the Governor.
What the attacker needed
None
The fix
The comparison should be changed to proposalCount <= proposalId (assuming proposalId is set linearly).
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract has a function to check the status of proposals. Due to a mistake in a check, it only works for the newest proposal, so older proposals can't be executed.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.