Asymmetric fee structure allows market participants to get the same outcome for less fee
The protocol charges a trade fee based on the collateral amount, but in a prediction market selling one outcome is equivalent to buying the opposite outcome. An attacker can choose the path with lower fees to achieve the same position, reducing protocol revenue.
Source: https://github.com/sherlock-audit/2025-10-index-fun-order-book-contest-judging/issues/534
Found by
PUSH0
Summary
When matching an order using swapping (either by matching two users or matching a user versus a market maker), a trade fee is charged. This fee is taken from the collateral amount traded.
We show that, for the same desired outcome, there are two trade paths leading to them, where fee structure is asymmetric (one of the paths charges less fee).
Root Cause
When matching an order using swapping (either by matching two users or matching a user versus a market maker), a trade fee is charged. This fee is taken from the collateral amount traded.
// Calculate trade fee from user (buyer)
uint256 buyerFeeRate = _getEffectiveTradeFeeRate(order.user);
uint256 tradeFee = (paymentAmount * buyerFeeRate) / 10000;
uint256 netPayment = paymentAmount - tradeFee;
// @audit code example for `_executeAgainstMatcher()`, buy order only. Sell order and matching two orders have the same fee structure
However, this makes the fee dependent on the trade price, which may be very large or very little depending on the trade price.
A unique property of the condition market is that selling a certain outcome is equivalent to buying other outcomes. If a market has YES/NO outcomes (or any two-outcome markets), then selling 1000 YES tokens for a price of $p$ is equivalent to 1000 NO tokens for the price of $1-p$. Indeed, taking an example:
- If you sell 1000 tokens YES for $300, you end up with $300, but you have no more YES tokens.
- If you buy 1000 tokens for $700, then you end up with a balance of -$700, but you have 1000 tokens of a full collection. This inevitably redeems to $1000 when the market is resolved, and that gets you back to a net total of $300.
Now, the problem is that the fee is always taken as a percentage of the trade collateral size. That means, for the above two orders at a 1% fee:
- Selling 1000 YES for $300 earns the treasury $3
- Buying 1000 NO for $700 earns the treasury $7
But they should yield the same outcome.
We show that, whenever trade fee > claim fee, path (2) can yield the better outcome for certain prices. We also show an example of an exploitable trade in the Attack Path section
Internal Pre-conditions
Technically always exist. Directly exploitable on market makers when claim fee < trade fee (condition easily achievable due to the custom fee structure for certain users i.e. the userTradeFeeRate and userFeeRate mechanism)
External Pre-conditions
Always exist. More prominent when market skews to a certain outcome (very common, happens in most if not all regular prediction markets)
Attack Path
Even taking claim fees into account, this becomes exploitable in the border price ranges. We show one such example using one user and a market maker.
Let's say the price becomes 1 YES = 0.92 USDC. Assuming we are already holding 1000 YES, and we want to exit position. Let trade fee = 2% and claim fee = 1%:
- Selling 1000 YES gives a raw proceedings of 920 USDC. 901.6 goes to the user, and 18.4 USDC go to the treasury as fee.
- Buying 1000 NO gives a raw proceedings of 80 USDC to the market maker. An extra 1.6327 USDC go to the treasury as fee, and 80 USDC go to the maker. We spent 81.6327 USDC, but we now have 1000 YES and 1000 NO.
For the second outcome, 1000 YES and 1000 NO always redeems to 1000 USDC of collateral. Deduct a 1% claim fee and that makes 990 USDC of collateral claimed. Minus the 81.6327 spent on the order, and we have a net total of 908.3673 USDC, more than the 901.6 in outcome 1.
Note that the same effect exist when two users are matched against each other. For example:
- User A buys 1000 YES from user B for 900 USDC. The treasury takes 90 USDC.
- Uesr A sells 1000 NO to user B for 100 USDC. The treasury takes 10 USDC.
Impact
- There exist a trading path that yields the same outcome for lesser fees.
- Protocol revenue will be less.
PoC
No response
Mitigation
Charge fee as a percentage of the outcome volume traded, not on the collateral amount traded.
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 fee is calculated on the collateral amount traded rather than on the outcome volume, making it asymmetric for equivalent trades.
Impact
Traders can pay less fee for the same outcome, reducing protocol revenue; the text notes this is exploitable when claim fee < trade fee and market skews.
What the attacker needed
Claim fee < trade fee; market skews to one outcome
The fix
The fee should be charged as a percentage of the outcome volume traded, not the collateral amount.
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.
In a prediction market, you can get the same result by either selling your 'yes' shares or buying the opposite 'no' shares. The fee is taken as a percentage of the money you put in, so the two paths cost different fees. This means a trader can pick the cheaper path and the platform earns less.
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.