Skip to content
Business logic Audit finding Intermediate

Malicious actor can win an auction unfavorably to the protocol by block stuffing

The auction for bad debt allows a bidder to win by preventing others from bidding for a short window. An attacker can stuff blocks with dummy transactions to stop overbids and win at the least favourable price for the protocol.

DeliChainSec Follow

Originally disclosed on Code4rena

Submitted by DeliChainSec

https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L158-L202 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L467-L470 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Shortfall/Shortfall.sol#L213

When the protocol bad debt is auctioned off with 10% incentive at the beginning, a user who gives the best bid wins. The auction ends when at least one account placed a bid, and the current block number is bigger than nextBidderBlockLimit:

function closeAuction(address comptroller) external nonReentrant {
        Auction storage auction = auctions[comptroller];

        require(_isStarted(auction), "no on-going auction");
        require(
            block.number > auction.highestBidBlock + nextBidderBlockLimit && auction.highestBidder != address(0),
            "waiting for next bidder. cannot close auction"
        );

nextBidderBlockLimit is set to 10 in the initializer, which means that other users have only 30 seconds to place a better bid. This is a serious problem because stuffing a whole block with dummy transactions is very cheap on Binance Smart Chain. According to https://www.cryptoneur.xyz/en/gas-fees-calculator, 15M gas - whole block - costs $14~$15 on BSC. This makes a malicious user occasionally cheaply prohibit other users to overbid them, winning the auction at the least favorable price for the protocol. Because BSC is a centralized blockchain, there are no private mempools and bribes directly to the miners (like in FlashBots); hence, other users are very limited concerning the prohibitive actions.

Impact

The protocol overpays for bad debt, losing value.

Proof of Concept

  1. Pool gathered $100,000 in bad debt and it’s eligible for auction.
  2. A malicious user frontruns others and places the first bid with the least possible amount (bad debt + 10% incentive).
  3. The user sends dozens of dummy transactions with increased gas prices, only to fill up whole block space for 11 blocks.
  4. At the end, the user sends a transaction to close the auction, getting the bad debt + 10% incentive.

Recommended Mitigation Steps

There are at least three options to resolve this issue:

  1. Make the bidding window much higher at the beginning; like 1000 blocks.
  2. Make the bidding window very high at the beginning and decrease it; the more attractive the new bid is.
  3. Make the bidding window dependent on the money at stake, to disincentivize block stuffing.

chechu (Venus) confirmed


The original report as published on Code4rena, by DeliChainSec. 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 auction's short bidding window (10 blocks) combined with cheap block space on BSC allows a bidder to block others from overbidding.

Impact

The protocol overpays for bad debt, losing value.

What the attacker needed

Bad debt eligible for auction; attacker can send many transactions; BSC block space is cheap

The fix

The bidding window should be made longer, decreasing over time, or dependent on the amount at stake to discourage block stuffing.

How it was found

  1. Pool gathers bad debt eligible for auction.
  2. Attacker frontruns others and places the first bid at the minimum amount.
  3. Attacker sends many dummy transactions with higher gas to fill blocks for 11 blocks.
  4. Attacker closes the auction and wins the bad debt plus incentive.

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.

An auction lets people bid for bad debt. The rules say if no one bids better within a short time, the last bidder wins. An attacker can fill the blockchain with useless transactions so no one else can bid, then win cheaply.

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.

More from Venus Prime

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.