Skip to content
Business logic Audit finding Intermediate

Users always pay fee on the full swapped amount in the `DeliHook`, even if the swap is smaller

The DeliHook contract always charges a fee on the full input amount of a swap, even when a price limit or insufficient liquidity means only part of the amount is actually swapped. This overcharges users by a significant amount, scaling with the difference between the specified and executed swap amounts.

0x73696d616f Follow with blockace and cergyk

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-09-bmx-deli-swap-judging/issues/154

Found by

0x73696d616f, blockace, cergyk

Summary

Users can specify a price limit in their swap, limiting the amount of funds actually swapped, or there may not be enough assets of one of the tokens to swap. The DeliHook doesn't take this into account, always paying fee over the full amount specified, overcharging the user by a very significant amount, link.

Root Cause

In DeliHook.sol:231, the fee is always calculated on the full input amount, regardless of the actual amount swappd.

Internal Pre-conditions

None.

External Pre-conditions

None.

Attack Path

  1. User does a swap, specifying a sqrt limit price that will be hit without using the full input/output amount. Or, alternatively, the pool runs out of one of the tokens.
  2. DeliHook will apply the fee on the full input amount, instead of just the amount swapped, link to where the fee is applied.

Impact

If the user specifies a sqrtPrice limit that only swaps 50% of the input/output funds, and the fee is calculated on 100% of the amount, it would be an error of 100%, high severity, and scales with the amount swapped.

PoC

None

Mitigation

Adjust the fee for the actual amount swapped.

The original report as published on Sherlock, by 0x73696d616f. 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

The fee is calculated on the full input amount rather than the actual amount swapped.

Impact

Users could be overcharged by a very significant amount, with the error scaling with the amount swapped; for example, if only 50% of the input is swapped but the fee is on 100%, the overcharge is 100% of the fee.

What the attacker needed

None

The fix

The fee should be adjusted to apply only to the actual amount swapped.

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.

When you swap tokens, you can set a limit on the price you are willing to accept. If the market hits that limit before your whole swap is done, only part of your tokens get swapped. This report says the fee is still taken as if the whole swap happened, so you pay more than you should.

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

View all

172 more disclosed reports, best first.

More from BMX Deli Swap

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.