VetoProposal : proposals cannot be vetoed in all states in which it should be possible to veto proposals
The VetoProposal contract only allowed vetoing proposals in the Voting state, but the underlying governance contract permits vetoing in Voting, Passed, and Ready states. This meant users could not veto proposals that had already passed or were ready for execution, limiting the intended functionality.
HollaDieWaldfee Follow with hansfriese
Originally disclosed on Code4rena
Submitted by HollaDieWaldfee, also found by hansfriese
The VetoProposal contract allows to veto proposals with the voteToVeto function.
The proposal can only be vetoed when it is in the Voting state, otherwise the voteToVeto function reverts.
The issue is that the Voting state is not the only state in which it should be possible to veto the proposal. It should also be possible to veto the proposal in the Passed and Ready states.
(We can see this by looking at the downstream PartyGovernance.veto function)
It has been confirmed to me by the sponsor that the voteToVeto function should not restrict the situations in which vetos can occur.
The impact of this issue is that the situations in which vetos can occur is more limited than it should be. Users should have the ability to veto proposals even in the Passed and Ready states but they don’t.
Proof of Concept
By looking at the VetoProposal.voteToVeto function we see that it’s only possible to call the function when the proposal is in the Voting state. Otherwise the function reverts:
// Check that proposal is active
(
PartyGovernance.ProposalStatus proposalStatus,
PartyGovernance.ProposalStateValues memory proposalValues
) = party.getProposalStateInfo(proposalId);
if (proposalStatus != PartyGovernance.ProposalStatus.Voting)
revert ProposalNotActiveError(proposalId);
But when we look at the PartyGovernance.veto function which is called downstream and which implements the actual veto functionality (the VetoProposal.voteToVeto function is only a wrapper) we can see that it allows vetoing in the Voting, Passed and Ready states:
function veto(uint256 proposalId) external onlyHost onlyDelegateCall {
// Setting `votes` to -1 indicates a veto.
ProposalState storage info = _proposalStateByProposalId[proposalId];
ProposalStateValues memory values = info.values;
{
ProposalStatus status = _getProposalStatus(values);
// Proposal must be in one of the following states.
if (
status != ProposalStatus.Voting &&
status != ProposalStatus.Passed &&
status != ProposalStatus.Ready
) {
revert BadProposalStatusError(status);
}
}
// -1 indicates veto.
info.values.votes = VETO_VALUE;
emit ProposalVetoed(proposalId, msg.sender);
}
Therefore we can see that the VetoProposal.voteToVeto function restricts the vetoing functionality too much.
Users are not able to veto in the Passed and Ready states even though it should be possible.
Tools Used
VSCode
Recommended Mitigation Steps
The issue can be fixed by allowing the VetoProposal.voteToVeto function to be called in the Passed and Ready states as well.
Fix:
diff --git a/contracts/proposals/VetoProposal.sol b/contracts/proposals/VetoProposal.sol
index 780826f..38410f6 100644
--- a/contracts/proposals/VetoProposal.sol
+++ b/contracts/proposals/VetoProposal.sol
@@ -30,7 +30,11 @@ contract VetoProposal {
PartyGovernance.ProposalStatus proposalStatus,
PartyGovernance.ProposalStateValues memory proposalValues
) = party.getProposalStateInfo(proposalId);
- if (proposalStatus != PartyGovernance.ProposalStatus.Voting)
+ if (
+ proposalStatus != PartyGovernance.ProposalStatus.Voting
+ && proposalStatus != PartyGovernance.ProposalStatus.Passed
+ && proposalStatus != PartyGovernance.ProposalStatus.Ready
+ )
revert ProposalNotActiveError(proposalId);
0xble (Party) confirmed and commented via duplicate issue #20:
This is valid, proposals should be allowed to be vetoed even after they’ve passed but have not yet been executed.
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
The VetoProposal contract added an extra check that only allowed vetoing during the Voting state, while the underlying PartyGovernance contract allowed vetoing in Voting, Passed, and Ready states.
Impact
Users could not veto proposals in the Passed and Ready states, so the veto functionality was more limited than intended.
What the attacker needed
A proposal in Passed or Ready state
The fix
The fix is to allow the voteToVeto function to be called when the proposal is in the Passed or Ready state as well.
How it was found
- Call voteToVeto on a proposal that is in the Passed or Ready state.
- The function checks the proposal status and reverts because it is not Voting.
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.
In this system, a proposal goes through stages: first people vote on it (Voting), then it passes (Passed), and then it becomes ready to execute (Ready). The veto function is supposed to work in all three stages, but a wrapper contract only allowed it during Voting. So if a proposal had already passed, you couldn't cancel it even though the rules say you should be able to.
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.