Skip to content
Business logic Audit finding Intermediate

Incorrect tax distribution when adding value single-sided

When a user adds value single-sided to a closure, the tax they pay is distributed to existing liquidity providers using a denominator that already includes the new user's stake. This dilutes the rewards for existing LPs and leaves excess fees stuck in the contract.

0xNov1ce Follow with Drynooo, bladeee and 2 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2025-04-burve-judging/issues/196

Found by

0xNov1ce, Drynooo, bladeee, future, mstpr-brainbot

Summary

When value is added single-sided to a closure, the LP is required to pay a fee (tax) to the existing LPs. However, the amount is not distributed correctly because valueStaked is updated before the tax is distributed. This causes the new LP to dilute the share of earnings intended for prior participants, leading to unfair reward allocation.

Root Cause

Let's assume a single-sided value is added to a closure. In this case, the Closure::addValueSingle() function will be called. This function calculates the tax to be paid by the LP and also updates self.valueStaked:
https://github.com/sherlock-audit/2025-04-burve/blob/44cba36e2a0c3cd7b6999459bf7746db92f8cc0a/Burve/src/multi/closure/Closure.sol#L208-L209

Afterward, Closure::addEarnings() is invoked to distribute the tax earnings to LPs:
https://github.com/sherlock-audit/2025-04-burve/blob/44cba36e2a0c3cd7b6999459bf7746db92f8cc0a/Burve/src/multi/facets/ValueFacet.sol#L132

However, as shown below, the bgtPerBgtValueX128 and earningsPerValueX128 values are computed after self.valueStaked and self.bgtValueStaked have been updated by addValueSingle(). This means that the new staker is already included in the staked value when earnings are calculated.

As a result, the earnings meant to be distributed to existing LPs are significantly diluted, since the new staker (who just paid the tax) also inflates the denominator used in the reward distribution.

Solidity
self.earningsPerValueX128[idx] +=
    (reserveShares << 128) /
    (self.valueStaked - self.bgtValueStaked);

This means the protocol is effectively distributing rewards using a denominator that includes the new LP, which reduces the share of existing LPs and undermines fair tax distribution.

Full function here:
https://github.com/sherlock-audit/2025-04-burve/blob/44cba36e2a0c3cd7b6999459bf7746db92f8cc0a/Burve/src/multi/closure/Closure.sol#L662-L703

Internal Pre-conditions

None needed

External Pre-conditions

None needed

Attack Path

Happens naturally when users add liquidity single sided to any closure

Impact

Uneven distribution of fees. Strong disincentive for LP'ers to stake their value. Also, the excess fee is stuck in the contract. Hence, high.

PoC

Textual PoC:

Assume the pool has some initial value (mandatory in deployment) and Alice as the only value provider (LP). Bob comes, and deposits single sided liquidity which will incur fees. This fee should be ideally distributed to the LP'ers which in our case its only Alice. However, the fee is not distributed to Alice. Instead, Alice will only get a small portion of the fees due to wrong calculations.

Coded PoC: In order for this PoC to win add this event to addValueSingle in Closure.sol and emit the tax so that we can see what the tax is.

Solidity
event Tapir(uint256 tax);
function addValueSingle(
        address recipient,
        uint16 _closureId,
        uint128 value,
        uint128 bgtValue,
        address token,
        uint128 maxRequired
    ) external nonReentrant returns (uint256 requiredBalance) {
        //..
        emit Tapir(realTax);
    }
Solidity
// forge test --match-contract ValueFacetTest --match-test test_tapir -vv
    function test_tapir() public {

        (, , , uint256 valueStaked, ) = simplexFacet.getClosureValue(0x9);
        console.log("valueStaked", valueStaked); // initial valueStaked
        uint256 oneX128 = 1 << 128;
        vm.prank(owner);
        simplexFacet.setClosureFees(0x9, uint128(oneX128 / 100), 0); // One basis point. Realistic.

        uint128 value = 1e20;
        valueFacet.addValue(alice, 0x9, value, 0);
        uint256[MAX_TOKENS] memory earnings;
        (, , earnings, ) = valueFacet.queryValue(alice, 0x9);
        console.log("earnings[0]", earnings[0]); // expect to be 0
        assertEq(earnings[0], 0);

        // there will be fees which should be distributed to the other LP's.
        address tapir = address(69);
        vm.recordLogs();

        // single value add, fee should be distributed to Alice and the initial value staked.
        valueFacet.addValueSingle(
            tapir,
            0x9,
            value * 5,
            0,
            tokens[0],
            0
        );

        Vm.Log[] memory entries = vm.getRecordedLogs();
        bytes32 tapirEventSig = keccak256("Tapir(uint256)");

        uint256 tax = 0;
        for (uint256 i = 0; i < entries.length; i++) {
            if (entries[i].topics[0] == tapirEventSig) {
                tax = abi.decode(entries[i].data, (uint256));
                console.log("Tax emitted:", tax);
                break;
            }
        }

        (, , earnings, ) = valueFacet.queryValue(alice, 0x9);
        console.log("earnings[0] after", earnings[0]);  // should be almost the entire tax above (minus the share of first dead shares)
        (, , earnings, ) = valueFacet.queryValue(tapir, 0x9);
        console.log("earnings[0]", earnings[0]); // should be 0

        uint256[MAX_TOKENS] memory collectedBalances;
        uint256 collectedBgt;
        vm.prank(Alice);
        (collectedBalances, collectedBgt) = valueFacet.collectEarnings(alice, 0x9);
        console.log("collectedBalances[0]", collectedBalances[0]);
    }

Mitigation

add the tax according to previous valueStaked

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/itos-finance/Burve/pull/76

The original report as published on Sherlock, by 0xNov1ce. 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 function updates the total staked value before calculating the earnings per value, so the new staker is included in the denominator used to distribute the tax.

Impact

Existing liquidity providers receive less than the full tax, and the excess fees remain stuck in the contract, which could discourage staking.

What the attacker needed

None

The fix

The tax should be distributed based on the value staked before the new deposit is added.

How it was found

  1. Alice is the only liquidity provider and has staked value in the closure.
  2. Bob adds liquidity single-sided, which incurs a tax.
  3. The tax is distributed using a denominator that includes Bob's newly staked value.
  4. Alice receives only a small portion of the tax, and the rest is stuck in the contract.

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 liquidity pool, when someone adds funds from only one side, they pay a fee that should go to existing liquidity providers. Here, the system updates the total staked amount before calculating each provider's share, so the new user unfairly gets part of the fee meant for others.

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

View all

2 more disclosed reports, best first.

More from Burve

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.