Fee Bypass in `ValueFacet.removeValueSingle`
The removeValueSingle function in ValueFacet computes the real fee using an uninitialised variable (removedBalance) that is still zero, so the fee is always zero. An attacker can withdraw single-token removals without paying the protocol fee, causing a complete loss of intended fees.
Source: https://github.com/sherlock-audit/2025-04-burve-judging/issues/311
Found by
0L5S6W, 0x23r0, AshishLac, CodexBugmeNot, Cybrid, Egbe, JeRRy0422, Rhaydden, SecSnat, Sparrow_Jac, TheCarrot, Tigerfrake, VinciGearHead, aman, anirruth_, baz1ka, benjamin_0923, bladeee, bretzel, curly11, elolpuer, future, gh0xt, heeze, holydevoti0n, imageAfrika, kom, m3dython, prosper, rsam_eth, smartkelvin, v1c7, vangrim
Summary
In the ValueFacet.removeValueSingle function, the local variable removedBalance is read (as 0) when computing the real fee (realTax), allowing users to withdraw single‐token removals without ever paying the protocol fee. This results in a complete bypass of the intended swap/remove fee, leading to potential revenue loss.
Root Cause
The function’s return variable removedBalance is declared but not yet assigned when used to compute realTax. The intent was to prorate the nominal fee (nominalTax) to “real” token units by computing
function removeValueSingle(
address recipient,
uint16 _closureId,
uint128 value,
uint128 bgtValue,
address token,
uint128 minReceive
) external nonReentrant returns (uint256 removedBalance) {
…
(uint256 removedNominal, uint256 nominalTax) = c.removeValueSingle(
value,
bgtValue,
vid
);
uint256 realRemoved = AdjustorLib.toReal(token, removedNominal, false);
Store.vertex(vid).withdraw(cid, realRemoved, false);
// BUG: removedBalance is still zero here
uint256 realTax = FullMath.mulDiv(
removedBalance, // ← should be realRemoved
nominalTax,
removedNominal
);
c.addEarnings(vid, realTax);
removedBalance = realRemoved - realTax;
require(removedBalance >= minReceive, PastSlippageBounds());
TransferHelper.safeTransfer(token, recipient, removedBalance);
}
realTax = realRemoved * nominalTax / removedNominal;
but instead removedBalance (zero) is used as the numerator, making realTax == 0 always.
Internal Pre-conditions
N/A
External Pre-conditions
N/A
Attack Path
N/A
Impact
The protocol loses 100% of the intended fees on every single‐token removal.
PoC
No response
Mitigation
Replace the incorrect use of removedBalance with realRemoved when computing realTax. Specifically:
- uint256 realTax = FullMath.mulDiv(
- removedBalance,
- nominalTax,
- removedNominal
- );
+ // Compute the real‐world fee based on the actual tokens removed
+ uint256 realTax = FullMath.mulDiv(
+ realRemoved,
+ nominalTax,
+ removedNominal
+ );
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/itos-finance/Burve/commit/ca58c88be97e8f3f7a4617b171377d77fca52cdc
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 variable removedBalance is used in the fee calculation before it is assigned, so it defaults to zero, making the computed fee zero.
Impact
The protocol loses 100% of the intended fees on every single-token removal.
What the attacker needed
None
The fix
The protocol team fixed this issue by replacing the incorrect use of removedBalance with realRemoved when computing realTax.
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 remove tokens from a contract, a small fee is supposed to be taken. The code that calculates this fee accidentally uses a variable that hasn't been set yet, so it always calculates zero. This means users can avoid paying the fee entirely.
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.