The settledPrice maybe exceed maximumPrice
The _buy function in BuyCrowdfundBase.sol sets settledPrice to totalContributions when callValue is zero, without checking if totalContributions exceeds maximumPrice. This could make the minimum proportion of participants smaller than expected.
Submitted by bin2chen
BuyCrowdfundBase.sol \_buy() When callValue = 0 is settledPrice to totalContributions ignoring whether totalContributions > maximumPrice resulting in the minimum proportion of participants expected to become smaller
Proof of Concept
function _buy(
IERC721 token,
uint256 tokenId,
address payable callTarget,
uint96 callValue,
bytes calldata callData,
FixedGovernanceOpts memory governanceOpts
)
...
settledPrice_ = callValue == 0 ? totalContributions : callValue; //**** not check totalContributions>maximumPrice****//
if (settledPrice_ == 0) {
// Still zero, which means no contributions.
revert NoContributionsError();
}
settledPrice = settledPrice_;
(AuctionCrowdfund.sol finalize() similar)
Recommended Mitigation Steps
add check
function _buy(
IERC721 token,
uint256 tokenId,
address payable callTarget,
uint96 callValue,
bytes calldata callData,
FixedGovernanceOpts memory governanceOpts
)
...
settledPrice_ = callValue == 0 ? totalContributions : callValue;
if (settledPrice_ == 0) {
// Still zero, which means no contributions.
revert NoContributionsError();
}
+++ if (maximumPrice_ != 0 && settledPrice_ > maximumPrice_) {
+++ settledPrice_ = maximumPrice_;
+++ }
settledPrice = settledPrice_;
merklejerk (PartyDAO) confirmed and commented:
We will cap the callValue to maximumPrice.
HardlyDifficult (judge) commented:
This is a potential violation of user expectations - agree with Medium risk.
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 code fails to enforce the maximumPrice cap when settledPrice is derived from totalContributions.
Impact
The minimum proportion of participants could become smaller than expected, potentially violating user expectations.
What the attacker needed
CallValue is zero; totalContributions exceeds maximumPrice
The fix
The code was fixed by capping the callValue to maximumPrice.
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.
In a crowdfunding contract, people contribute money to buy an NFT. The code calculates a final price per share. If no direct payment is made, it uses the total contributions as the price, but it forgets to cap that price at a maximum limit. This means the price per share could be higher than intended, so each participant gets a smaller share than they expected.
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.