Skip to content
Business logic Audit finding Intermediate

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.

hake Follow

Originally disclosed on Code4rena

Submitted by hake

https://github.com/Plex-Engineer/lending-market/blob/755424c1f9ab3f9f0408443e6606f94e4f08a990/contracts/Governance/GovernorBravoDelegate.sol#L115

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).

nivasan1 (Canto) confirmed

Alex the Entreprenerd (judge) commented:

The warden has shown how, due to a mistake in logic, only the state of the latest proposal can be read.

Because the function state is used in execute we 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.


The original report as published on Code4rena, by hake. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by hake

View all

5 more disclosed reports, best first.

More from Canto

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.