Users can swap at the best price by splitting swap into several small swap
Hurricane Follow with MysteryAuditor, ami and 3 others
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2025-09-dango-dex-judging/issues/291
Found by
Hurricane, MysteryAuditor, ami, blockace, haxagon, heavyw8t
Summary
In the swap of geometric pair, the protocol matches the passive orders to the user's swap order. However, users can swap at the best price by splitting swap into several small swap.
Root Cause
In the geometric.swap_exact_amount_in function, it creates the passive orders and matches them to the user created swap order from L61.
L61: if input.denom == *base_denom {
ask_exact_amount_in(input.amount, passive_bids)
} else if input.denom == *quote_denom {
bid_exact_amount_in(input.amount, passive_asks)
}
The reflect_curve function creates the params.limit numbers of ask and bid orders.
The bid orders' price are decreasing and ask orders' price are increasing.
By splitting the swap into several small swaps, users can swap at the best passive order.
Let's consider the following scenario:
- There is the token1: token2 pair(geometric)
- reserve of token1: 1000
- reserve of token2: 10000
- 1 token1 = 10 usd, 1 token2 = 1 usd
- swap_fee_rate is 0 for the simplicity
- params.spacing: 1
- params.limit: 3
- params.ratio: 10%
- Alice is going to swap 300 token1 to token2 in one transaction:
reflect_curvefunction creates 5 passive bids: (price, size): (10, 100), (9, 111.11), (8, 125)- As a result, Alice receives 2712 amount of token2: 100 * 10 + 111.11 * 9 + 89 * 8 = 1000 + 1000 + 712 = 2712
- If Bob swaps 300 token1 using 3 times of swapping of 100 token1 in one transaction:
- Bob receives 1000 token2 in one swap of 100 token1
- Totally, Bob receives 3000 token2 As a result, Bob receives more tokens than Alice.
Internal pre-conditions
None
External pre-conditions
- None
Attack Path
None
Impact
This causes unfair swapping for users.
PoC
None
Mitigation
Add the cooldown period for swapping or don't allow for users to execute several swap in one transaction.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A high-severity business logic bug in Dango DEX. Sherlock made it public on 8 October 2025. Found in the 1066 audit contest (finding H-2), also found by 5 other wardens.
About Business logic
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
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.