Skip to content
Business logic Audit finding Intermediate

Veto function should decrease proposalsPassed (and possibly proposalsCreated)

When a malicious proposal is vetoed, the proposer keeps the voting-power bonus earned from creating and passing that proposal. An attacker could therefore submit and pass proposals, get them vetoed, and still retain the extra community score.

neumo Follow with Trumpero

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-11-frankendao-judging/issues/9

Found by

neumo, Trumpero

Summary

When a proposal that has passed is vetoed, the proposer still has the bonus of proposalsCreated and proposalsPassed related to the proposal. Both should be decremented because veto is intended to be used for malicious proposals.

Vulnerability Detail

The function getCommunityVotingPower returns a bonus to users for voting, creating proposals and having them passed. https://github.com/sherlock-audit/2022-11-frankendao/blob/main/src/Staking.sol#L520-L541 The veto function is supposed to be used against malicious proposals (see comment in line 522): https://github.com/sherlock-audit/2022-11-frankendao/blob/main/src/Governance.sol#L520-L534 So the malicius proposer should not keep a bonus based in this proposal's creation and/or passing, and the function should decrease both the values of proposalsCreated and proposalsPassed.

Impact

Malicious proposer keeps bonus after his proposal is vetoed.

Code Snippet

N/A

Tool used

Manual Review

Recommendation

Put a check in the veto function that decreases the values of both proposalsCreated and proposalsPassed.

Solidity
if(proposal.verified){
	--userCommunityScoreData[proposal.proposer].proposalsCreated;
	--totalCommunityScoreData.proposalsCreated;
}
if (state(_proposalId) == ProposalState.Queued){
	--userCommunityScoreData[proposal.proposer].proposalsPassed;
	--totalCommunityScoreData.proposalsPassed;
}

Discussion

ZakkMan

Fixed: https://github.com/Solidity-Guild/FrankenDAO/pull/22

jack-the-pug

Fix confirmed

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

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 veto function does not decrement the proposer's proposalsCreated and proposalsPassed counters, so the bonus derived from them survives the veto.

What the attacker needed

Proposal must be created and pass; proposal must then be vetoed

The fix

The veto function was changed to decrement both the proposer's and the total proposalsCreated and proposalsPassed counters, and the fix was confirmed.

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.

Some systems give users extra voting power as a reward for creating proposals and getting them approved. This report says that when a bad proposal is cancelled by a veto, the reward is not taken back, so the person who made it keeps the extra power. The fix is to subtract those rewards when a veto happens.

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 neumo

View all

2 more disclosed reports, best first.

More from FrankenDAO

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.