Skip to content
DoS Audit finding Intermediate

ETHCrowdfundBase.sol : All funds are lost when fee recipient cannot receive ETH

The crowdfund finalisation function transfers the fee to a fixed funding split recipient before sending the rest to the party, and if that recipient rejects ETH the whole finalisation reverts. Since the crowdfund is already in the Won state, contributors cannot refund and the ETH stays stuck in the contract.

HollaDieWaldfee Follow

Originally disclosed on Code4rena

Submitted by HollaDieWaldfee

In the ETHCrowdfundBase contract a fundingSplitRecipient address is configured which receives a percentage of the funds in case the crowdfund is won.

Neither the fundingSplitRecipient address nor the fundingSplitBps percentage can be changed.

The issue is that the _finalize function can only succeed when the fees can be transferred to the recipient.

However the recipient contract may revert when it receives ETH. This causes all ETH in the ETHCrowdfundBase contract to be stuck.

Proof of Concept

When the crowdfund is won the finalize function needs to be called which calls _finalize:

Link

function _finalize(uint96 totalContributions_) internal {
    // Finalize the crowdfund.
    delete expiry;

    // Update the party's total voting power.
    uint96 newVotingPower = (totalContributions_ * exchangeRateBps) / 1e4;
    party.increaseTotalVotingPower(newVotingPower);

    // Transfer fee to recipient if applicable.
    address payable fundingSplitRecipient_ = fundingSplitRecipient;
    uint16 fundingSplitBps_ = fundingSplitBps;
    if (fundingSplitRecipient_ != address(0) && fundingSplitBps_ > 0) {
        uint96 feeAmount = (totalContributions_ * fundingSplitBps_) / 1e4;
        totalContributions_ -= feeAmount;
        fundingSplitRecipient_.transferEth(feeAmount);
    }

    // Transfer ETH to the party.
    payable(address(party)).transferEth(totalContributions_);
}

Here you can see that the feeAmount is transferred to the fundingSplitRecipient:

fundingSplitRecipient_.transferEth(feeAmount);

If the recipient contract reverts, the ETH cannot be transferred and the crowdfund cannot be finalized.

But the users can also not get a refund because the crowdfund is in the Won state. So there is no way to get the funds out of the contract which means they are lost. Also the users don’t get the voting power that they are supposed to get from the crowdfund.

This could be used in a griefing attack where the fundingSplitRecipient is set such that it can be made to revert.

Users that fall into this “trap” will lose all their funds. It can also just happen by mistake that a bad fundingSplitRecipient is set.

Tools Used

VSCode

Recommended Mitigation Steps

I recommend to pay the fees in a separate function such that it is separated from the _finalize function.

diff --git a/contracts/crowdfund/ETHCrowdfundBase.sol b/contracts/crowdfund/ETHCrowdfundBase.sol
index 4392655..5f68406 100644
--- a/contracts/crowdfund/ETHCrowdfundBase.sol
+++ b/contracts/crowdfund/ETHCrowdfundBase.sol
@@ -62,6 +62,8 @@ contract ETHCrowdfundBase is Implementation {
     error BelowMinimumContributionsError(uint96 contributions, uint96 minContributions);
     error AboveMaximumContributionsError(uint96 contributions, uint96 maxContributions);
     error ContributingForExistingCardDisabledError();
+    error NotFinalizedError();
+    error FundingFeesAlreadyPaidError();

     event Contributed(
         address indexed sender,
@@ -109,6 +111,8 @@ contract ETHCrowdfundBase is Implementation {
     /// @notice The address a contributor is delegating their voting power to.
     mapping(address => address) public delegationsByContributor;

+    bool public fundingFeesPaid;
+
     // Initialize storage for proxy contracts, credit initial contribution (if
     // any), and setup gatekeeper.
     function _initialize(ETHCrowdfundOptions memory opts) internal {
@@ -278,7 +282,20 @@ contract ETHCrowdfundBase is Implementation {
         uint96 newVotingPower = (totalContributions_ * exchangeRateBps) / 1e4;
         party.increaseTotalVotingPower(newVotingPower);

+        // Transfer ETH to the party.
+        payable(address(party)).transferEth(totalContributions_);
+    }
+
+    function sendFundingFees() external {
+        CrowdfundLifecycle lc = getCrowdfundLifecycle();
+
+        if (lc != CrowdfundLifecycle.Finalized) revert NotFinalizedError();
+        if (fundingFeesPaid) revert FundingFeesAlreadyPaidError();
+
+        fundingFeesPaid = true;
+
         // Transfer fee to recipient if applicable.
+        uint96 totalContributions_ = totalContributions;
         address payable fundingSplitRecipient_ = fundingSplitRecipient;
         uint16 fundingSplitBps_ = fundingSplitBps;
         if (fundingSplitRecipient_ != address(0) && fundingSplitBps_ > 0) {
@@ -286,8 +303,5 @@ contract ETHCrowdfundBase is Implementation {
             totalContributions_ -= feeAmount;
             fundingSplitRecipient_.transferEth(feeAmount);
         }
-
-        // Transfer ETH to the party.
-        payable(address(party)).transferEth(totalContributions_);
     }
 }

Alternatively it may also be an option to just send the fees to the party in case the transfer to the recipient fails.

0xble (Party) confirmed


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

Likely the fee transfer to an untrusted, unchangeable recipient is performed inside the same finalisation step as the main payout, so a revert there blocks the entire finalisation.

Impact

All ETH in the contract could be permanently stuck and contributors would not receive the voting power they were promised; the text notes this could be a deliberate griefing attack or an accidental misconfiguration.

What the attacker needed

Crowdfund configured with a fee recipient; fee recipient rejects ETH; crowdfund reaches Won state

The fix

The fee payment should be moved into a separate function so that finalisation and the main payout are not blocked by a failing fee recipient.

How it was found

  1. Configure a crowdfund with a funding split recipient that rejects ETH.
  2. Contributors fund the crowdfund until it is won.
  3. Call finalize, which calls _finalize and attempts the fee transfer.
  4. The fee transfer reverts, so finalisation fails and the contract stays in the Won state.

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.

A crowdfund contract holds money from many people. When the crowdfund succeeds, one function is meant to pay a fee to a fixed address and then pass the rest to the party. If that fee address refuses the payment, the whole function fails, and because the crowdfund already counts as won, nobody can ask for their money back.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by HollaDieWaldfee

View all

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

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.