User can backrun an admin calling `setEX128` and steal the difference in tokens
Changing a token's efficiency factor via setEX128 does not recompute the pool's target value, so a user can backrun the admin transaction and call removeTokenForValue with a crafted amount to withdraw excess tokens for negligible value. This allows stealing the difference in tokens.
Source: https://github.com/sherlock-audit/2025-04-burve-judging/issues/120
Found by
0xNov1ce, TessKimy, bladeee
Summary
The formula for calculating the value of a given token is:
(e+2)t − (e+1)^2 * t^2 / (x + et)
Where e is the efficiency factor. To maintain a balanced pool, ∑v(tokens) should equal target * n. However, changing e for a specific token does not trigger a recomputation of target * n. This oversight allows users to exploit the system:
- They can steal the difference via
removeTokenForValue, or - Add the difference for free via
addTokenForValue.
//@review - User crafts a specific amount so that `newTargetX128` matches the current `targetX128`
self.balances[idx] -= taxedRemove;
uint256 newTargetX128;
{
(uint256[] memory mesX128, uint256[] memory mxs) = ValueLib.stripArrays(self.n, esX128, self.balances);
newTargetX128 = ValueLib.t(
searchParams,
mesX128,
mxs,
self.targetX128
);
}
//@review - After recalculating `t` with the new `ex` and updated balance, `newTargetX128` matches `self.targetX128`, enabling the user to spend negligible amounts (dust) and withdraw excess tokens
uint256 valueX128 = ((self.targetX128 - newTargetX128) * self.n);
value = valueX128 >> 128;
if ((value << 128) > 0) value += 1;
Root Cause
The pool owner can modify e via the SimplexFaces::setEX128 function:
function setEX128(address token, uint256 eX128) external {
AdminLib.validateOwner();
uint8 idx = TokenRegLib.getIdx(token);
emit EfficiencyFactorChanged(msg.sender, token, SimplexLib.getEX128(idx), eX128);
SimplexLib.setEX128(idx, eX128);
}
After changing eX128, the system does not recompute target * n. This flaw permits users to:
- [addSingleForValue](https://github.com/sherlock-audit/2025-04-burve/blob/main/Burve/src/multi/facets/ValueFacet.sol#L139-L172)
- [removeSingleForValue](https://github.com/sherlock-audit/2025-04-burve/blob/main/Burve/src/multi/facets/ValueFacet.sol#L248-L277)
thus extracting tokens without providing equivalent value.
Internal Pre-conditions
- Admin modifies
eby either increasing or decreasing it — a likely action sinceedetermines token concentration in the pool.
External Pre-conditions
None.
Attack Path
- Admin increases
efor a token. - A user backruns the transaction and calls
removeTokenForValue, choosing anamountthat ensuresnewTargetX128equals the originaltargetX128. - The user spends minimal value and collects the excess tokens.
Impact
Instead of the excess tokens moving to the reserve as intended, malicious users can seize them freely. This leads to:
- Unauthorized asset extraction
- Potential destabilization of the pool
- Arbitrage opportunities at the expense of the protocol
PoC
None provided.
Mitigation
Upon calling setEX128, immediately adjust balances to preserve targetX128:
- If
eis increased: move the corresponding value to the reserve. - If
eis decreased: inject the additional value accordingly.
This ensures the pool remains properly balanced and prevents malicious exploitation.
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/itos-finance/Burve/pull/73
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 setEX128 function updates the efficiency factor but fails to adjust balances or recompute the target value, leaving the pool in an inconsistent state.
Impact
Malicious users could seize excess tokens, leading to unauthorized asset extraction and potential pool destabilization.
What the attacker needed
Admin changes efficiency factor
The fix
The protocol team fixed this issue in a pull request.
How it was found
- Admin increases the efficiency factor for a token.
- A user backruns the transaction and calls removeTokenForValue with an amount that makes newTargetX128 equal the original targetX128.
- The user spends minimal value and collects the excess tokens.
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.
A pool tracks a target total value. When an admin changes a setting for one token, the target is not updated. A user can quickly act after the admin's change and withdraw tokens that are now worth more than they pay, taking the extra value.
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.