Skip to content
DoS Audit finding Intermediate

Any change in bucket size will DOS order cancellation leading to frozen user funds and halts the entire auction

When administrators change the bucket sizes used for tracking liquidity depth, existing limit orders can no longer be cancelled because the cancellation code looks up storage keys built with the new sizes. This locks user funds and can also break the auction cleanup routine, pausing all trading.

0xShoonya Follow with blockace, heavyw8t and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-09-dango-dex-judging/issues/307

Found by

0xShoonya, blockace, heavyw8t, klaus

Summary

The DEX protocol's order cancellation mechanism fails when bucket sizes for liquidity depth tracking are updated after an order is created. When administrators modify bucket sizes through BatchUpdatePairs, existing orders become uncancellable and cannot be matched either because the system attempts to decrease liquidity depths using mismatched bucket configurations. This results in a complete denial of service for order cancellations and the auction system, effectively pausing the entire auction system. The vulnerability has a High severity due to freezing user funds, effectively causing a loss of all funds stuck in orders and breaking a core functionality, as well as causing a loss of yield for LP's and the protocol since no revenue can be earned while the protocol is paused.

Root Cause

The vulnerability stems from asymmetric handling of bucket sizes between order creation and cancellation phases. During order creation, increase_liquidity_depths() uses the current pair.bucket_sizes to create depth entries with specific bucket size keys. However, during cancellation, decrease_liquidity_depths() reloads the current pair.bucket_sizes from storage, which may differ from the bucket sizes used during order creation if administrators have updated them via BatchUpdatePairs.

https://github.com/sherlock-audit/2025-09-dango-dex/blob/main/left-curve/dango/dex/src/liquidity_depth.rs#L72-L106

The critical failure occurs in decrease_liquidity_depths() when it calls DEPTHS.modify() on storage keys that were created with different bucket sizes. Unlike may_update(), the modify() method requires the storage key to exist, causing transaction failures when bucket configurations have changed.

Internal Pre-conditions

  • Administrators must have updated bucket sizes via BatchUpdatePairs while some orders are still GTC, which is very likely

External Pre-conditions

NA

Attack Path

  1. User creates limit order with TimeInForce::GoodTilCanceled, triggering increase_liquidity_depths() with current bucket sizes

  2. Depth entries are created using the bucket sizes active at order creation time

  3. Administrator updates bucket sizes via BatchUpdatePairs, replacing the previous configuration

  4. User attempts to cancel order through normal cancellation mechanisms

  5. System reloads current bucket sizes from PAIRS storage during cancel_order()

  6. decrease_liquidity_depths() fails because DEPTHS.modify() cannot find storage keys created with the old bucket sizes

  7. Transaction reverts due to missing storage keys, preventing order cancellation

  8. User funds remain locked

  9. Auction system fails when cron::auction() attempts to clean up passive orders using mismatched bucket sizes

  10. Protocol pauses trading as the auction failure triggers the error handling mechanism, setting PAUSED to true and halting all trading activity

Impact

Users lose the ability to cancel their limit orders and reclaim deposited funds when bucket sizes are modified after order creation. The DEPTHS.modify() operation fails because it attempts to access storage keys that were created with different bucket size configurations, causing transaction reversions. This creates a permanent lock on user funds, ForceCanclealso won't work as this uses the same function to decrease the liquidity depth

The vulnerability also affects the auction system in cron::auction(), which uses the same decrease_liquidity_depths() function when cleaning up passive orders. If bucket sizes have changed, the auction process may fail entirely, triggering the protocol's pause mechanism and halting all trading activity, leading to a loss of yield for LP's and the protocol.

PoC

No response

Mitigation

Consider implementing a mechanism to preserve bucket size information at order creation time. One approach could be storing the bucket sizes used during order creation within the Order struct itself, allowing cancellation logic to reference the original configuration.

The original report as published on Sherlock, by 0xShoonya. 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 cancellation path reloads the current bucket sizes from storage instead of the sizes used when the order was created, so it modifies storage keys that do not exist.

Impact

Users could permanently lose access to funds locked in orders, and the auction failure may pause all trading, costing liquidity providers and the protocol yield.

What the attacker needed

Admin changes bucket sizes; an existing open limit order; no special attacker access needed

The fix

The order should record the bucket sizes in force at creation so cancellation can reference the original configuration.

How it was found

  1. A user places a good-til-cancelled limit order, which records liquidity depth entries under the current bucket sizes.
  2. An administrator updates the bucket sizes through the batch pair update function.
  3. The user tries to cancel the order, and the system reloads the new bucket sizes.
  4. The liquidity depth decrease fails because the storage keys from the old sizes are missing, so the transaction reverts.
  5. The auction cleanup hits the same failure, triggering the pause mechanism and halting trading.

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.

The exchange keeps a tally of available liquidity in fixed-size groups called buckets. An order records its liquidity under the bucket sizes in force at the time. If an admin later changes those sizes, cancelling the order looks for the wrong tally entries, fails, and the money stays stuck. The same failure can stop the automated auction, which pauses trading.

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 0xShoonya

View all

8 more disclosed reports, best first.

More from Dango DEX

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.