Seller’s ability to decrypt bids before reveal could result in a much higher clearing price than anticpated and make buyers distrust the system
The seller can decrypt all bids before revealing their private key, so they can see the bids and decide not to honour the auction or place their own bid to raise the clearing price. This means the reserve price is not respected and bidders may pay more than expected.
Submitted by c7e7eff, also found by c7e7eff, gz627, hansfriese, Lambda, and rvierdiiev.
Bids are encrypted with the seller’s public key. This makes that the seller can see all the bids before they reveal and finalize the auction. If the bids are unsatisfactory the seller can just decide not to honor the auction and not reveal their private key. Even worse, the seller, knowing the existing bids, can choose to fill the auction just beneath the optimal price increasing the clearing price.
Although there is a check in the bid() function where the bidder cannot submit a bid with the same address as the one used while creating the auction it is trivial to use another address to submit bids.
Whether this results in a net increase of the total amount received is not a limiting factor as they might very well be happy with a lower total amount of quote tokes if it means selling less of the base tokens.
Ultimately this means the reserve price for the auction is not respected which would make bidders distrust the system. Bidders that don’t realize this impact stand to pay a much higher price than anticipated, hence the HIGH risk rating.
Proof of Concept
Following test shows the seller knowing the highest price can force the clearing price (lowestQuote) to be 2e6 in stead of what would be 1e6. sellerIncreases can be set to true or false to simulate both cases.
function testAuctionSellerIncreasesClearing() public {
bool sellerIncreases = true;
(uint256 sellerBeforeQuote, uint256 sellerBeforeBase) = seller.balances();
uint256 aid = seller.createAuction(
baseToSell, reserveQuotePerBase, minimumBidQuote, startTime, endTime, unlockTime, unlockEnd, cliffPercent
);
bidder1.setAuctionId(aid);
bidder2.setAuctionId(aid);
bidder1.bidOnAuctionWithSalt(9 ether, 18e6, "bidder1");
bidder2.bidOnAuctionWithSalt(1 ether, 1e6, "bidder2");
uint256[] memory bidIndices = new uint[](2);
bidIndices[0] = 0;
bidIndices[1] = 1;
uint128 expectedClearingPrice = 1e6;
if (sellerIncreases){
//seller's altnerate wallet
bidder3.setAuctionId(aid);
bidder3.bidOnAuctionWithSalt(1 ether, 2e6, "seller");
bidIndices = new uint[](3);
bidIndices[0] = 0;
bidIndices[1] = 2;
bidIndices[2] = 1;
expectedClearingPrice = 2e6;
}
vm.warp(endTime + 1);
seller.finalize(bidIndices, 1 ether, expectedClearingPrice);
AuctionData memory data = auction.getAuctionData(aid);
emit log_named_uint("lowestBase", data.lowestBase);
emit log_named_uint("lowestQuote", data.lowestQuote);
}
Recommended Mitigation Steps
A possible mitigation would be to introduce a 2 step reveal where the bidders also encrypt their bid with their own private key and only reveal their key after the seller has revealed theirs. This would however create another attack vector where bidders try and game the auction and only reveal their bid(s) when and if the result would be in their best interest. This in turn could be mitigated by bidders losing (part of) their quote tokens when not revealing their bids.
0xean (judge) commented on duplicate issue #170:
Not sure that wash trading qualifies as H risk as its not very unique to this system and is a risk in many defi trading applications. Will leave open as M for sponsor comment.
Ragepit (sponsor) marked duplicate issue #170 as acknowledged and commented:
We’ve accepted this risk that a seller can bid on their own auction and make the clearing price higher because they are trusted to know the bid prices. The % profit may go up but the sold tokens will go down so there’s a trade-off for the seller.
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
Impact
The seller can raise the clearing price or refuse to reveal their key, so bidders may pay more than expected and lose trust in the system; the sponsor acknowledged this risk.
What the attacker needed
Seller controls the auction; seller can use another address; bids are encrypted with seller's key
The fix
A two-step reveal where bidders also encrypt with their own key and reveal after the seller, with penalties for not revealing, was suggested but not implemented; the sponsor accepted the risk.
How it was found
- Seller creates an auction.
- Two bidders submit encrypted bids.
- Seller uses an alternate wallet to submit a bid at a higher price.
- Seller finalizes the auction with a chosen set of bid indices and a higher clearing price.
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 this auction, bidders encrypt their offers using the seller's public key, which only the seller can unlock. Because the seller holds the key, they can peek at every offer before the auction ends. They could then cancel the sale or add a fake offer to push the final price up, which is unfair to honest bidders.
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.