Skip to content
Business logic Audit finding Intermediate

Unable to check state() if proposalId == 0

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 be called to view proposal state if proposalId == 0.

Proof of Concept

There is no check to prevent queueing a proposalId with a value of 0 via the queue() function. However, in the state() function there is a check preventing using a proposalId == 0. For clarity: initialProposalId must be zero according to _initiate(), therefore, proposalId cannot be 0 according to check below.

function state(uint proposalId) public view returns (ProposalState) {
    require(proposalCount >= proposalId && proposalId > initialProposalId, "GovernorBravo::state: invalid proposal id");

Recommended Mitigation Steps

Implement check to preventing queueing a proposalId == 0.

nivasan1 (Canto) disputed and commented:

The ProposalId cannot be 0 as the proposal IDs are fixed and will be set via the cosmos-sdk.

Alex the Entreprenerd (judge) commented:

The warden has shown how, through a misconfiguration, a proposal could never be executable due to a revert in state().

While I believe the warden has already shown a remediation that would cover this scenario, I believe the Warden has shown a unique possible situation that can cause the system to stop working as intended.

While the sponsor says the proposalId will never be 0, there is no way to avoid that at the Smart Contract level, meaning that any caller can set the proposal to 0.

For these reasons, I think Medium Severity to be 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.

What is known

A medium-severity business logic bug in Canto. Code4rena made it public on 18 October 2022. Found in the 2022-06-canto audit contest (finding M-03).

About Business logic

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

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.