Skip to content
DoS Audit finding Intermediate

Attacker may DOS auctions using invalid bid parameters

Bids in a sealed-bid auction contract were not validated for their public key, commitment or encrypted base amount, so a bidder could submit bids that the finalize loop silently skips. An attacker could fill all 1000 bid slots with such invalid bids and prevent the auction from being finalised, denying service to the seller and honest bidders.

Trust Follow with _141345_, 0x1f8b and 27 others

Originally disclosed on Code4rena

Submitted by Trust, also found by 141345, 0x1f8b, 0xdapper, c7e7eff, chaduke, codexploder, corerouter, cryptonue, fs0c, gz627, HE1M, hihen, joestakey, KIntern_NA, ktg, ladboy233, Lambda, minhtrng, Picodes, RaymondFam, RedOneN, rvierdiiev, simon135, skyle, slowmoses, TomJ, V_B, wagmi, and yixxas.

https://github.com/code-423n4/2022-11-size/blob/706a77e585d0852eae6ba0dca73dc73eb37f8fb6/src/SizeSealed.sol#L258-L263 https://github.com/code-423n4/2022-11-size/blob/706a77e585d0852eae6ba0dca73dc73eb37f8fb6/src/SizeSealed.sol#L157-L159 https://github.com/code-423n4/2022-11-size/blob/706a77e585d0852eae6ba0dca73dc73eb37f8fb6/src/SizeSealed.sol#L269-L280

Buyers submit bids to SIZE using the bid() function. There’s a max of 1000 bids allowed per auction in order to stop DOS attacks (Otherwise it could become too costly to execute the finalize loop). However, setting a max on number of bids opens up other DOS attacks.

In the finalize loop this code is used:

ECCMath.Point memory sharedPoint = ECCMath.ecMul(b.pubKey, sellerPriv);
// If the bidder public key isn't on the bn128 curve
if (sharedPoint.x == 1 && sharedPoint.y == 1) continue;
bytes32 decryptedMessage = ECCMath.decryptMessage(sharedPoint, b.encryptedMessage);
// If the bidder didn't faithfully submit commitment or pubkey
// Or the bid was cancelled
if (computeCommitment(decryptedMessage) != b.commitment) continue;

Note that pubKey is never validated. Therefore, attacker may pass pubKey = (0,0). In ecMul, the code will return (1,1): if (scalar == 0 || (point.x == 0 && point.y == 0)) return Point(1, 1); As a result, we enter the continue block and the bid is ignored. Later, the bidder may receive their quote amount back using refund().

Another way to reach continue is by passing a 0 commitment.

One last way to force the auction to reject a bid is a low quotePerBase:

uint256 quotePerBase = FixedPointMathLib.mulDivDown(b.quoteAmount, type(uint128).max, baseAmount);
// Only fill if above reserve price
if (quotePerBase < data.reserveQuotePerBase) continue;

baseAmount is not validated as it is encrypted to seller’s public key. Therefore, buyer may pass baseAmount = 0, making quotePerBase = 0.

So, attacker may submit 1000 invalid bids and completely DOS the auction.

Impact

Attacker may DOS auctions using invalid bid parameters.

Recommended Mitigation Steps

Implement a slashing mechanism. If the bid cannot be executed due to user’s fault, some % their submitted quote tokens will go to the protocol and auction creator.

0xean (judge) commented:

leaving open for sponsor review, issue is somewhat similar to the baseAmount 0 revert, but is unique enough to stand alone.

RagePit (SIZE) commented:

While possibly an issue in extreme cases, we implemented the minimumBidQuote for this reason. As anyone looking to DOS this way would have to lockup minimumBidQuote*1000 tokens for the duration of the auction

RagePit (SIZE) commented:

Separate from the unintended #64 issue where the DOS would require no funds locked


The original report as published on Code4rena, by Trust. 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 bid submission path does not validate the public key, commitment or encrypted base amount, so malformed bids are accepted and later skipped by the finalize loop, consuming the fixed bid cap.

Impact

An attacker could block an auction from being finalised, though the sponsor notes that doing so would require locking up the minimum bid amount across all 1000 bids for the auction's duration.

What the attacker needed

Ability to submit bids; enough funds to lock minimum bid across 1000 bids

The fix

The report recommends a slashing mechanism so that quote tokens are forfeited when a bid cannot be executed due to the bidder's fault; the sponsor instead points to the existing minimum bid amount as the deterrent.

How it was found

  1. Submit a bid whose public key is the zero point, which the elliptic curve multiplication turns into a sentinel value.
  2. Observe that the finalize loop hits the continue branch and ignores that bid.
  3. Alternatively submit a zero commitment or an encrypted base amount of zero so the quote per base falls below the reserve.
  4. Repeat until all 1000 bid slots are filled with invalid bids.
  5. The auction can no longer be finalised, and the attacker reclaims their quote via refund.

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.

This is a smart contract for a sealed-bid auction, where people submit encrypted offers. The code that closes the auction goes through every bid and quietly skips any it cannot process, but it never checks that a bid is well formed when it is submitted. Someone could therefore fill every allowed bid slot with junk offers, so the auction can never be closed properly.

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 Trust

View all

77 more disclosed reports, best first.

More from Size

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.