Skip to content
Business logic Audit finding Intermediate

## Auction can be ended with large limit order

The auction contract used a sentinel value of type(int128).max to indicate cancellation, but a limit order at that price passed all checks. An attacker could place such an order at the start of the auction, causing the auction to be finalised and the trader refunded, effectively preventing the auction from taking place.

ArbitraryExecution Follow

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2022-09-knox-judging/issues/153

Found by

ArbitraryExecution

In the function AuctionInternal._previewWithdraw, the number type(int128).max is used as a sentinel value for deciding whether the auction is canceled. However, an order for all contracts at a price of type(int128).max passes all requires checks for limit orders.

If such an order is placed at the start of the auction, the auction can be finalized and the trader will be refunded the entire amount when the auction is processed or canceled. This effectively prevents the auction from taking place.

Recommendation

Use AuctionStorage.Status instead of sentinel values for determining whether the auction is in the canceled state.

Discussion

0xCourtney

https://github.com/KnoxFinance/knox-contracts/pull/79

rcstanciu

Reply from @arbitrary-CodeBeholder


looks good

The original report as published on Sherlock, by ArbitraryExecution. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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 contract used a sentinel value (type(int128).max) to represent the cancelled state instead of a dedicated status field, allowing a valid order to collide with that sentinel.

Impact

This effectively prevents the auction from taking place.

What the attacker needed

Ability to place a limit order

The fix

Use AuctionStorage.Status instead of sentinel values for determining whether the auction is in the canceled state.

How it was found

  1. Place a limit order for all contracts at a price of type(int128).max at the start of the auction.
  2. The order passes all require checks for limit orders.
  3. The auction can then be finalised and the trader refunded the entire amount when processed or cancelled.

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 contract used a special maximum number to mean 'cancelled'. But a user could place a real order at that same maximum price, which the contract accepted. This let the attacker end the auction immediately and get their money back, stopping the auction from happening.

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 by ArbitraryExecution

View all

1 more disclosed report, best first.

More from Knox Finance

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.