An attacker can contribute to the ETH crowdfund using a flash loan and control the party as he likes
The ETH crowdfund contract allowed an attacker to use a flash loan to contribute a large amount just before finalisation, gaining majority voting power, and then immediately distribute the party's funds to repay the loan and retain control. This was possible because the party could distribute funds in the same block as finalisation, with no delay.
Then the attacker will have (1 + 10) / 20 = 55% voting power of the party and he can pass any proposal.
So he calls distribute() with 19 ether. distribute() can be called directly if opts.distributionsRequireVote == false, otherwise, he should create/execute the distribution proposal and he can do it within the same block.
After that, he can receive ETH using TokenDistributor.claim() and the amount will be 19 * 55% = 10.45 ether. (We ignore the distribution fee for simplicity)
He repays 10 ether to the flash loan provider and he can control the party as he likes now.
This attack is possible for both InitialETHCrowdfund and ReraiseETHCrowdfund.
Recommended Mitigation Steps
I think we should implement a kind of cooldown logic after the crowdfund is finalized.
Add a partyStartedTime in PartyGovernance.sol.
While finalizing the ETH crowdfund in ETHCrowdfundBase._finalize(), we set party.partyStartedTime = block.timestamp.
After that, PartyGovernance.distribute() can work only when block.timestamp > partyStartTime.
Looking into this more, the issue can only occur if a party sets an executionDelay of 0. In the POC, the party was created with default values (null) which is why this could happen in testing. However if changed to a nonzero value, it would require waiting delay duration before the proposal could be executed which would prevent the repayment of the flash loan in a single execution. Since parties are expected to have a nonzero execution delay, we are less concerned about the flash loan aspect of this attack.
This finding did prompt us to consider the risk of majority attacks more broadly, where an individual can contribute and become a majority voter in a party (flash loan or not) and take control of the party. We acknowledged the majority attack before audit and don’t consider it a vulnerability. Our reasoning is (1) our governance model prioritizes simplicity and speed of coordination which would be sacrificed by introducing more complex mechanisms to robustly protect against majority attacks and (2) the expectation is parties will have reasonable governance settings and active governance to veto malicious proposals to manage the risk of a majority attack and if they don’t (e.g. set an execution delay of 0) it is a deliberate choice on their part rather than a vulnerability.
The original report as published on Code4rena, by hansfriese. 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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely the lack of a delay between crowdfund finalisation and fund distribution, allowing a flash loan to be repaid within the same transaction.
Impact
The attacker could gain majority control of the party and steal funds, but the party stated this only works if the execution delay is zero; with a non-zero delay the flash loan repayment would be blocked.
What the attacker needed
A party with executionDelay set to 0; access to a flash loan provider; the crowdfund must be active
The fix
The report recommended adding a cooldown period after crowdfund finalisation before distributions are allowed, but the party did not confirm a fix.
How it was found
The attacker contributes 1 ether to the crowdfund and another user contributes 9 ether.
The attacker takes a flash loan of 10 ether and contributes it, which immediately finalises the crowdfund because the total exceeds the maximum.
The attacker now holds 55% of the voting power and calls distribute() to send 19 ether to the distributor.
The attacker claims their share (10.45 ether) from the distributor, repays the flash loan, and retains control of the party.
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.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
A flash loan is a loan that must be borrowed and repaid within the same transaction. The attacker borrowed money to temporarily become the biggest contributor to a crowdfund, which gave them most of the voting power. They then used that power to send the group's funds to themselves, repaid the loan, and kept control of the group.
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.