Skip to content
Business logic Audit finding Intermediate

Contributions can be smaller than minContribution and may receive no voting power

A contribution that pushes the crowdfund over its maximum is reduced after the minimum contribution check, so the final amount can fall below the minimum. This can result in the contributor receiving no voting power for their contribution.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52

Valid contribution is awarded no voting power.

Proof of Concept

ETHCrowdfundBase.sol#L195-L219

    uint96 minContribution_ = minContribution;
    if (amount < minContribution_) {
        revert BelowMinimumContributionsError(amount, minContribution_);
    }
    uint96 maxContribution_ = maxContribution;
    if (amount > maxContribution_) {
        revert AboveMaximumContributionsError(amount, maxContribution_);
    }

    uint96 newTotalContributions = totalContributions + amount;
    uint96 maxTotalContributions_ = maxTotalContributions;
    if (newTotalContributions >= maxTotalContributions_) {
        totalContributions = maxTotalContributions_;

        // Finalize the crowdfund.
        // This occurs before refunding excess contribution to act as a
        // reentrancy guard.
        _finalize(maxTotalContributions_);

        // Refund excess contribution.
        uint96 refundAmount = newTotalContributions - maxTotalContributions;
        if (refundAmount > 0) {
            amount -= refundAmount; <- @audit-issue amount is reduced after min check
            payable(msg.sender).transferEth(refundAmount);
        }

When processing a contribution, if the amount contributed would push the crowdfund over the max then it is reduced. This is problematic because this reduction occurs AFTER it checks the amount against the minimum contribution. The result is that these contributions can end up being less than the specified minimum.

Although an edge case, if amount is smaller than exchangeRateBps as it could result in the user receiving no voting power at all for their contribution.

Recommended Mitigation Steps

Enforce minContribution after reductions to amount.

0xble (Party) acknowledged and commented:

This was done intentionally.minContribution may be bypassed for the last contributor when the remaining contribution is less than the min otherwise the party may never be able to reach maxTotalContributions.

“Although an edge case, if amount is smaller than exchangeRateBps as it could result in the user receiving no voting power at all for their contribution.”

For this though we can add a check to ensure that votingPower != 0.

0xble (Party) confirmed and commented:

Thinking about this one more, it may be worth enforcing the min/max contribution checks after this happens to not allow for this case where contribution < minContribution. The way it currently is creates a potentially bad scenario, as pointed out, where the last contributor may receive no voting power or not be able to claim their party card if this was a ReraiseETHCrowdfund.

The motivation for allowing minContribution to be bypassed for the last contributor when the remaining contribution is less than minContribution was to allow parties to reach maxTotalContributions in a case where they otherwise wouldn’t be able to because the contribution to reach it would be below minContribution. However, in this scenario the crowdfund can still be won if either the crowdfund expires above minTotalContribution or a host finalizes at any point after minTotalContribution has been reached. So given the party has recourse if this were to happen, it makes more sense not to allow for this edge case where contribution < minContribution.

Will mitigate by enforcing minContribution after reductions to the contribution amount.


The original report as published on Code4rena, by 0x52. 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

The minimum contribution check is performed before the excess refund reduces the contribution amount, so the final amount can be below the minimum.

Impact

A contributor could receive no voting power for their contribution, and in a ReraiseETHCrowdfund they may not be able to claim their party card.

What the attacker needed

Contribution pushes total over max; remaining amount below minContribution

The fix

The project mitigated by enforcing the minimum contribution after reductions to the contribution amount.

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.

When you contribute to a crowdfund, the code first checks that your amount is at least a minimum. But if your contribution would exceed the maximum total, the code reduces your amount after that check. So you might end up contributing less than the minimum, and if the amount is very small, you get zero voting power.

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 0x52

View all

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