Skip to content
Business logic Audit finding Intermediate

MaxContribution check can be bypassed to give a card high voting power

evan Follow with hansfriese

Originally disclosed on Code4rena

Submitted by evan, also found by hansfriese

ReraiseETHCrowdfund tries limit the voting power of each card by doing a min/maxContribution check in claim and claimMultiple.

            uint96 contribution = (votingPower * 1e4) / exchangeRateBps;
            uint96 maxContribution_ = maxContribution;
            // Check that the contribution equivalent of total pending voting
            // power is not above the max contribution range. This can happen
            // for contributors who contributed multiple times In this case, the
            // `claimMultiple` function should be called instead. This is done
            // so parties may use the minimum and maximum contribution values to
            // limit the voting power of each card (e.g.  a party desiring a "1
            // card = 1 vote"-like governance system where each card has equal
            // voting power).
            if (contribution > maxContribution_) {
                revert AboveMaximumContributionsError(contribution, maxContribution_);
            }

https://github.com/code-423n4/2023-04-party/blob/main/contracts/crowdfund/ReraiseETHCrowdfund.sol#L270-L282

            // Check that the contribution equivalent of voting power is within
            // contribution range. This is done so parties may use the minimum
            // and maximum contribution values to limit the voting power of each
            // card (e.g. a party desiring a "1 card = 1 vote"-like governance
            // system where each card has equal voting power).
            uint96 contribution = (votingPowerByCard[i] * 1e4) / exchangeRateBps;
            if (contribution < minContribution_) {
                revert BelowMinimumContributionsError(contribution, minContribution_);
            }

            if (contribution > maxContribution_) {
                revert AboveMaximumContributionsError(contribution, maxContribution_);
            }

https://github.com/code-423n4/2023-04-party/blob/main/contracts/crowdfund/ReraiseETHCrowdfund.sol#L357-L369

However, this check can be bypassed due to the following code segment

        else if (party.ownerOf(tokenId) == contributor) {
            // Increase voting power of contributor's existing party card.
            party.addVotingPower(tokenId, votingPower);
        }

https://github.com/code-423n4/2023-04-party/blob/main/contracts/crowdfund/ReraiseETHCrowdfund.sol#L295-L298

Consider the following situation. Suppose ReraiseETHCrowdfund sets maximumContribution to only allow at most 3 units of voting power in each card. Some user X can contribute the maximum amount twice as 2 different contributor addresses A & B (both of which he controls). When the crowdfund has finalized, X can first call claim as A, then transfer the partyGovernanceNFT from A to B (note that while the crowdfundNFT can’t be transferred, the partyGovernanceNFT can be transferred), and finally call claim as B to get a card with 6 units of voting power.

Impact

The degree of impact really depends on the use case of the party. Some parties would like each card to represent a single vote - this would obviously violate that. Generally, it’s not a great idea to allow a single card to hold a high amount of votes, so I’ll leave this as a medium for now.

Recommended Mitigation Steps

One solution is to restrict the maximum voting power on partyGovernanceNFT’s side. It can check the votingPower of each card before adding more votingPower to it.

0xble (Party) commented:

@evan - Couldn’t this also be mitigated by checking the voting power held by a card before adding voting power to it?

0xble (Party) confirmed and commented:

Considering a refactor to only check contribution > maxContribution in claim() if disableContributingForExistingCard is true, which would mitigate this.

The reasoning is the check was added for the case to support parties that wish to have a “1 card, 1 vote”-type governance system and must have fixed voting power per card. To do this we would expect disableContributingForExistingCard to be enabled. If it is not, the creator would be indicating it doesn’t matter.

0xble (Party) commented:

We’ve decided to refactor the way claiming works in the ReraiseETHCrowdfund, partially because a large number of findings like this being submitted around that one area that highlighted for us the need to rework its logic.

The change will make it so (1) crowdfund NFTs are minted per contribution instead of per address and (2) claiming works more like a 1:1 conversion of your crowdfund NFT into a party card instead of how it works now. In the future we will also add the ability to split/merge party cards.

This should mitigate this finding because the voting power transferred from crowdfund NFT to party card is known to be within the min/max contribution limit (otherwise the contribution that created the crowdfund NFT would have reverted) so there is no longer a min/max contribution check required when claiming.


The original report as published on Code4rena, by evan. 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 Party Protocol. Code4rena made it public on 23 June 2023. Found in the 2023-04-party audit contest (finding M-02), also found by 1 other warden.

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 evan

View all

11 more disclosed reports, best first.

More from Party Protocol

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.