NFT Owner can stuck Crowdfund user funds
The NFT owner could transfer a worthless NFT to the crowdfund contract before finalisation, causing the contract to treat it as a gift and set the last bid to the total contributions, thereby preventing contributors from receiving a refund. This allowed the owner to extort contributors by threatening to dump the NFT.
Originally disclosed on Code4rena
Submitted by csanuragjain
Consider a scenario where few users contributed in auction but no one has placed any bid due to reason like NFT price crash etc. So there was 0 bid, the NFT owner could seize the crowdfund users fund until they pay a ransom amount as shown below.
Proof of Concept
- NFT N auction is going on
- CrowdFund users have contributed 100 amount for this auction
- Bidding has not been done yet
- A news came for this NFT owner which leads to crashing of this NFT price
- CrowdFund users are happy that they have not bided and are just waiting for auction to complete so that they can get there refund
- NFT owner realizing this blackmails the CrowdFund users to send him amount 50 or else he would send this worthless NFT to the Crowdfund Auction contract basically stucking all crowdfund users fund. CrowdFund users ignore this and simply wait for auction to end
- Once auction completes finalize function is called
function finalize(FixedGovernanceOpts memory governanceOpts)
external
onlyDelegateCall
returns (Party party_)
{
...
if (nftContract.safeOwnerOf(nftTokenId) == address(this)) {
if (lastBid_ == 0) {
// The NFT was gifted to us. Everyone who contributed wins.
lastBid_ = totalContributions;
if (lastBid_ == 0) {
// Nobody ever contributed. The NFT is effectively burned.
revert NoContributionsError();
}
lastBid = lastBid_;
}
// Create a governance party around the NFT.
party_ = _createParty(
_getPartyFactory(),
governanceOpts,
nftContract,
nftTokenId
);
emit Won(lastBid_, party_);
}
...
}
- Before calling finalize the lastBid was 0 since no one has bid on this auction but lets see what happens on calling finalize
- Since NFT owner has transferred NFT to this contract so below statement holds true and
lastBid\_is also 0 since no one has bidded
if (lastBid_ == 0) {
lastBid_ = totalContributions;
- This means now
lastBid\_is changed to totalContributions which is 100 so crowdfund users funds will not be refunded and they will end up with non needed NFT.
Recommended Mitigation Steps
Remove the line lastBid\_ = totalContributions; and let it be the last bid amount which crowdfund users actually bided with.
merklejerk (PartyDAO) disputed and commented:
This is working as designed. Contributors to a crowdfund essentially enter an agreement to pay up to a maximum price of their combined contributions for an NFT.
csanuragjain (warden) commented:
@merklejerk But in this case it is not “up to a maximum price” but rather always the maximum price using the PoC.
merklejerk (PartyDAO) confirmed and commented:
Hmm. I reread the PoC and now I’m converting this to confirmed. The real issue here is not so much that the party is paying maximum price, but that the party did not ever bid on the item but also paid maximum price. :facepalm:
merklejerk (PartyDAO) disagreed with severity and commented:
Still disagree with severity since this is unlikely to happen with a legitimate collection. It should be Medium at most.
HardlyDifficult (judge) decreased severity to Medium and commented:
Agree with Medium risk here. This could be a violation of party user expectations since auctions generally target the min possible bid - a form of leaking value.
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 finalize function sets lastBid_ to totalContributions when the NFT was gifted (lastBid_ == 0), without checking whether any actual bid was placed, so contributors are forced to pay the maximum even though no bid occurred.
Impact
Contributors could lose their entire contribution and receive a worthless NFT instead of a refund, but the attack requires the NFT owner to act maliciously and is unlikely with a legitimate collection.
What the attacker needed
NFT owner acts maliciously; No bids placed before finalisation; Crowdfund contributions exist
The fix
The fix was to remove the line that sets lastBid_ to totalContributions, so that the last bid remains the actual bid amount placed by contributors.
How it was found
- An NFT auction is running and crowdfund users have contributed 100.
- No bids have been placed yet.
- The NFT owner transfers the NFT to the crowdfund contract.
- The finalize function is called.
- Because lastBid_ is 0 and the contract owns the NFT, lastBid_ is set to totalContributions (100).
- The crowdfund users' funds are not refunded and they receive the NFT instead.
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 crowdfund, people pool money to buy an NFT. If nobody bids, the money should be returned. But the NFT owner could send the NFT to the contract for free, and the code would then treat that as if the group had bid all their money, so they lose their funds and get a worthless NFT instead.
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.