LP share price books a refundable VPI charge as junior equity, so an LP who is also the trader redeems at an inflated NAV and takes deposited principal from the LPs who stay
A volatility/price-impact charge paid on opening a position is booked as pool revenue and enters the NAV used to price LP redemptions, but the same position can later reclaim that charge as a close-time rebate paid from pool cash, with no liability recorded for it. An LP who is also the trader can therefore redeem at an inflated share price and then collect the refund, taking principal from LPs who remain.
- Disclosed after under an hour
#99049 [SC-Critical] LP share price books a refundable VPI charge as junior equity, so an LP who is also the trader redeems at an inflated NAV and takes deposited principal from the LPs who stay
Submitted on Nov 11th 2026 at 16:46:56 UTC by @kwaro for Audit Competition | Plether
- Report ID: #99049
- Report Type: Smart Contract
- Report severity: Critical
- Target: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/HousePool.sol
- Impacts:
- Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Brief/Intro
A skew-increasing open pays a volatility/price-impact (VPI) charge in cash to HousePool, which books it as Revenue so the next reconcile credits it to the junior tranche and it enters the NAV that prices LP redemptions. The same position may take that charge straight back as a close-time VPI rebate, paid out of pool cash, and nothing in the reconcile snapshot represents that outstanding obligation. An LP who is also the trader — and, because keepers are permissionless, also the keeper — therefore redeems at a share price inflated by money the pool is about to refund, then collects the refund. On mainnet this takes deposited principal from every liquidity provider who stays: measured end to end on the real contract graph at the release parameters, with the basket flat on every tick, a non-participating junior LP deposited 900000000000 USDG atoms and could withdraw only 899440017375 from its own wallet, against 26 atoms of rounding in a control that runs the identical LP sequence without the trade.
Vulnerability Details
Deployed configuration
The program's § Active Features and Networks says severity is assessed with the release parameters of packages/perps/DEPLOYMENT.md at this commit. The PoC fixture sets exactly those: vpiFactor 0.01e18, maxSkewRatio 0.4e18, maintenance margin 10 bps, initial margin 20 bps, execution fee 4 bps, settlement buffer 25 bps, baseCarryBps 500, minBountyAssets 1 USDG, bountyBps 10, keeper share 50%, senior cap 40,000,000 USDG and 80% of the pool, minOpenNotionalAssets 1,000 USDG, CAP_PRICE 2e8, 1 USDG seed per tranche, six-feed basket. No arm changes a parameter. The program's § Trusted Roles states plainly that keepers are not trusted: "anyone can execute orders, liquidations, price updates and protections".
Root cause — three facts, each at a line of the pinned source
1. The charge becomes LP cash immediately. On an open, the pool-bound part of the trade cost is recorded as revenue — packages/perps/src/CfdEngineSettlementSidecar.sol:453-464:
if (delta.tradeCostAssets > 0) {
uint256 poolCashInflowAssets = uint256(delta.tradeCostAssets) - protocolFeeCreditedAssets;
if (poolCashInflowAssets > 0) {
IHousePool(host.pool())
.recordClaimantInflow(
poolCashInflowAssets,
IHousePool.ClaimantInflowKind.Revenue,
IHousePool.ClaimantInflowCashMode.CashArrived
);
CashArrived increments accountedAssets (HousePool.sol:624-640) and the amount lands in pendingTradingRevenueAssets, which the next reconcile distributes through the waterfall to the tranches.
2. The NAV that prices LP exits has no term for VPI the pool owes back — packages/perps/src/libraries/HousePoolAccountingLib.sol:60-79:
uint256 terminalAssets = engineSnapshot.physicalAssets;
uint256 terminalLiabilities = engineSnapshot.traderClaimBalanceAssets;
int256 terminalDelta = engineSnapshot.terminalLpPriceDeltaAssets;
...
snapshot.distributable = terminalAssets - terminalLiabilities;
physicalAssets is pool totalAssets(), which now includes the charge. The only liabilities subtracted are outstanding trader claims and the terminal price delta. packages/perps/ACCOUNTING_SPEC.md:140-142 states that exclusion as a design choice — "Carry, VPI, execution/frozen spreads, protocol fees, liquidation reserve, order margin, and other action reserves are deliberately excluded: they are separate realized-settlement quantities, not marked price PnL." The charge is excluded as a liability while its cash is included as an asset.
3. The same position takes the charge back on close, out of pool cash. The lifetime clamp permits a negative (rebate) close VPI down to the position's proportional accrual — packages/perps/src/libraries/CloseAccountingLib.sol:107-118:
if (inputs.poolDepthAssets != 0) {
state.vpiDeltaAssets = CfdMath.calculateVPI(
inputs.preSkewAssets, inputs.postSkewAssets, inputs.poolDepthAssets, inputs.vpiFactor
);
}
if (state.proportionalAccrualAssets + state.vpiDeltaAssets < 0) {
state.vpiDeltaAssets = -state.proportionalAccrualAssets;
}
The planner pays it out of free pool cash (CfdEnginePlanLib.sol:973-977) and the settlement sidecar executes a real transfer (CfdEngineSettlementSidecar.sol:621-623):
if (delta.actionRebatePaidAssets > 0) {
IHousePool(host.pool()).payOut(address(clearinghouse), delta.actionRebatePaidAssets);
clearinghouse.settleAssets(delta.account, int256(delta.actionRebatePaidAssets));
}
So the attacker is paid twice for one charge: once as an LP, through its share of the revenue the charge created, and once as the trader, through the rebate — and it arranges to be an LP only for the first payment.
The asymmetry is in the source, not only in the prose
CfdTypes.sol:41 defines the quantity as signed and two-directional — int256 vpiAccrued; // [6 dec] Cumulative VPI charges (+) and rebates (-) across the position's lifetime — yet only the negative branch is ever reserved against. CfdEngineAccountLens.sol:324-327:
function _negativeVpiReserveTarget(int256 vpiAccruedAssets) ... {
if (vpiAccruedAssets < 0) {
targetAssets = uint256(-(vpiAccruedAssets + 1)) + 1;
}
}
CfdEnginePlanLib.sol:51-53 is the same if (vpiAccruedAssets < 0) pattern. There is no positive-branch counterpart anywhere in packages/perps/src/, and no aggregate of positive vpiAccrued across live positions exists in the tree. packages/perps/SECURITY.md:866-867 states the trader-side rule in words — "gross negative lifetime VPI is backed by a dedicated nonwithdrawable reserve equal to max(-vpiAccrued, 0)" — and the direction that matters for an LP exit, positive accrual the pool may have to refund, is backed by nothing. This is the finding, and it rests on code rather than on a reading of prose.
The sequence — every step an unprivileged real entry point
- Deposit into the junior tranche (
TrancheVault.requestDeposit-> epoch settles ->claimDeposit). - Wait out the 1-hour share cooldown and queue a full redemption for the next epoch (
requestRedeem). - 20 seconds before the epoch boundary, open at the 40% pool-relative skew cap through the router (
commitOrder->executeOrder). The charge is booked:vpiChargeBooked: 1599998400, and junior NAV moves2000000999973->2001600998373on a flat basket. - Settle the LP epoch (
settleLpEpoch, permissionless) and claim the redemption at that NAV:attackerLpOut: 1100879998670on1100000000000deposited. - Close the position, collect the rebate, withdraw:
attackerTraderOut: 59359784541of60000000000funded,treasuryCredit: 320000000,keeperCredit: 200000. - Net for the round trip:
attackerNet: 239983211.
The victim then performs its own honest exit and receives victimUsdgOut: 899440017375 — victimLossVsPar: 559982625 against the 900000000000 it deposited, with victimSharesLeft: 0.
Why the specification does not sanction this
packages/perps/ACCOUNTING_SPEC.md:140-142excludes VPI from the terminal price delta, calling it a "separate realized-settlement quantit[y]". That is a statement about marked price PnL. It does not say an exiting LP may be paid a share of a charge the pool is going to refund.- The line in the file actually named ACCOUNTING_SPEC does not cover it either, and I quote it in full because it is the first thing a reader will reach for.
packages/perps/ACCOUNTING_SPEC.md:1057-1066ends a list of settlement rules with: "anticipated carry, VPI, fees, spreads, and other action economics stay outside terminalK; the book is synchronized only to actually installed PnL pledge and same-account claim state after settlement. The VPI reserve therefore does not inflate marked LP receivables or symmetric LP NAV". At a glance that sounds like "VPI is kept out of LP NAV by design". It says two narrower things. Anticipated VPI — not yet charged — stays outside terminalK, which is the price book, not the tranche NAV. And "the VPI reserve" is what the same document defines atpackages/perps/ACCOUNTING_SPEC.md:798asvpiRebateReserveAssets = max(-vpiAccrued, 0)— the negative branch, the clawback the pool may be owed. Neither clause says a realized positive charge, which the pool may have to refund, stays out of LP NAV. The measurement is that it does not. packages/perps/SECURITY.md:872says "neither anticipated VPI nor its reserve inflates terminalKor symmetric NAV", inside the bullet governing close-time action rebates. I cite it but do not rest the finding on it, and I flag the ambiguity rather than leave you to find it: the word "anticipated" appears exactly once inpackages/perps/SECURITY.md(that line) and zero times anywhere inpackages/perps/src/, so it is an undefined phrase with no code referent. It can be read as the pool's anticipated refund or as the trader-side reserve construct. The finding holds under either reading, because the code asymmetry above does not depend on it.packages/perps/WHITEPAPER.md§5.1 likewise addresses only the trader-side reserve: "LPs cannot withdraw it as marked equity before the matching position obligation settles". This finding is the LP-side mirror of that rule, unenforced.- § VPI limitations (
packages/perps/SECURITY.md:1434-1444) lists seven limitations. The closest, "the lifetime clamp intentionally zeroes otherwise extractable rebate-only round trips", is about a trader extracting a rebate without a matching charge. Here the charge is real and fully paid; the defect is that the LP exit price recognises it.
Is open-time VPI simply LP revenue by design?
This is the one question that, answered the other way, would reduce this to a design disagreement, so the code's answer is put up front. Three facts in packages/perps/src/ say the design treats a round trip as path-neutral, not as revenue plus a gift:
- The quantity is defined as a lifetime net, not a receipt.
CfdTypes.sol:41accumulates charges and rebates signed across a position's lifetime. A revenue item is not accumulated signed across a lifetime; a balance is. - The clamp exists to bound the refund by the accrual.
CloseAccountingLib.sol:116caps a rebate at the charge the position has paid. That is only meaningful if the charge is money the position may get back — nobody clamps a refund against revenue that was never refundable. - The trader side already carries the mirror reserve.
max(-vpiAccrued, 0)is held nonwithdrawable. The protocol already accepts that an outstanding lifetime VPI balance must not be spendable by the party that may owe it. This finding is that same rule, unenforced in the direction where the pool is the party that may owe it.
If the answer is nonetheless "open-time VPI is LP revenue by design", the late-depositor arm stands on its own: packages/perps/SECURITY.md:859-860 states as a guarantee that new LPs "do not inherit old trader obligations at a higher deposit NAV", and ARM 6 shows a 500,000 USDG depositor priced at 499875718485 once the rebate lands. That is a stated protocol guarantee failing, independent of how the charge is classified.
Objections answered in advance, by measurement
"This is HIGH-1, the known issue about repeatable net-profitable extraction from LPs." It is not. HIGH-1 is Arbitrum/Pyth clock alignment: commitTime comes from the sequencer clock and can trail an already-published Pyth tick, so the qualifying "first post-commit" tick may be known at submission. Its root cause is oracle timing. This finding uses none of it — every arm runs at a flat basket of 1e8 on every tick, open and close happen at the same price, and the attacker gains nothing from knowing any future price because there is no price movement to know. Swap in a perfectly aligned clock and a trader with no oracle foreknowledge and this finding is unchanged.
"This is the known depth-manipulation issue." The two adjacent AI-scan entries (S30, S31) manipulate pool depth around a close to change the magnitude of its VPI. This finding changes no depth at the close and needs no such move. The axis here is when the charge is recognised in the LP exit price, not how large it is.
"The victim only lost revenue it had not earned." The measurement rules that out. The victim is compared with its own deposit, not with an interim NAV: 900000000000 in, 899440017375 out. The control arm, identical but for the trade, returns 899999999974.
"The attacker needs an implausible share of the tranche." Swept, not derived (junior-only 2,000,000 tranche, position auto-sized to 39% of depth at each open, booked charge 1520998479 at every point):
| attacker share of junior | attacker net | victim loss vs par |
|---|---|---|
| 10% | -471911520 |
-159911395 (victim gains) |
| 20% | -319812176 |
-7812135 (victim gains) |
| 30% | -167712953 |
144286980 |
| 40% | -15613914 |
296385876 |
| 50% | +136484836 |
448484424 |
| 60% | +288583071 |
600582357 |
| 65% | -81051017252 |
550754098 |
| 70% | -181051017252 |
472074941 |
Three things this establishes, including the one that bounds my own claim. Break-even is ~41%, between the 40% and 50% rows, and each 10% of share moves attacker net by 152099848, exactly 10% of the booked charge — linear in share, as the model predicts. Below break-even the attack is a donation: at 10% and 20% the victim ends above par. There is an upper bound too, at ~61%: at 65% and 70% attackerLpOut is the identical 1219572998479, because the attacker's own redemption cannot be funded while its position is open, stranding 80427 and 180427 USDG of its own stake. The profitable band is therefore ~41% to ~61% of the junior tranche in this junior-only configuration. (ARM 3 runs 70% of a junior tranche profitably with a funded senior tranche present, because senior depth funds the exit, so the bound is configuration-dependent and is not claimed as universal.)
The program's § Feasibility Limitations is explicit that a high capital requirement is "generally not a valid reason to downgrade a report", and that only attacks requiring USD 100 million or more are considered case by case. The junior tranche in the arms is 2,000,000 USDG.
"The rebate is contingent — adverse flow between the open and the close removes it." This is the strongest objection and it is partly correct. VPI is a function of skew squared, so the close earns a rebate only while it reduces |skew|. With the attacker long ~7,800 lots at 55%, a third-party SHORT landing inside the window:
| third-party SHORT in the window | attacker net |
|---|---|
| 0 lots | +212534039 |
| 2,000 lots | +212730135 |
| 4,000 lots | -1395117339 |
| 6,000 lots | -3133360554 |
| 7,800 lots | -4698404700 |
The attack survives adverse flow up to about a quarter of its own size and is destroyed by roughly half, which is the threshold the squared curve predicts. Two measured facts bound the exposure: the window is 27 seconds (openedAt 1709542780, closedAt 1709542807, open to close through the real epoch boundary, settle and claim), and roughly 400,000 USDG of opposing notional must arrive inside those 27 seconds, from a party willing to pay its own VPI to do it. I will not overstate the mitigation: the attacker can read the skew before committing the close and simply not close yet, paying carry instead, which converts the loss branch into a delay — that is reasoning, not a measurement, and it is flagged as such rather than claimed as an arm.
"A guardian can pause and contain it." § Operating Assumptions says monitoring may reduce severity only where "demonstrated monitoring coverage and response timing establish that containment limits the reported exploit", and that "the existence of monitoring or pause functionality alone does not justify a downgrade". A cycle completes inside one LP epoch, and the LP-settlement hold does not reverse a redemption already claimed.
"Some existing reserve already accounts for the obligation." It does not, and this is checkable in one grep. Every guard on the quantity in packages/perps/src/ tests the negative branch only. No aggregate of positive vpiAccrued across live positions exists anywhere. HousePool holds exactly three buckets apart from distributable value — pendingClaimantBucketAssets, pendingRecapitalizationAssets and pendingTradingRevenueAssets — and the charge is routed into the last, which is the one that is distributed.
"The treasury takes most of the extracted value, so the attacker is not stealing." The impact row is about the victim's funds, not the attacker's margin. The attacker is nonetheless net positive in every exploit arm (239983211, 934399054, 5144293532 cumulative over 24 cycles), so this is not griefing under the program's own spend-to-damage test either.
Impact Details
The quantity is settlement-token (USDG) principal that a non-participating liquidity provider can withdraw from the junior tranche, measured in its own wallet after a complete requestRedeem -> epoch settlement -> claimRedeem exit — not an interim NAV reading, and not unclaimed yield. The basket is 1e8 on every tick of every arm, so no part of the loss comes from a market move.
| arm | attacker net | victim, measured | control |
|---|---|---|---|
| junior only, attacker 1,100,000 / victim 900,000 USDG, 8,000 lots | +239983211 | withdrew 899440017375 of 900000000000 deposited | victim withdrew 899999999974; attacker -10 |
| senior 2,000,000 present, attacker 1,400,000 / victim 600,000 USDG, 16,000 lots | +934399054 | NAV 599994429221 -> 598389013040 |
attacker -25570783 |
| three cycles, same victim, 32,412 simulated seconds | +637842443 cumulative | withdrew 898426479206 | — |
| a late depositor's 500,000,000,000 entry priced in the pulsed epoch | — | shares worth 499875718485 | — |
The attacker's gain is smaller than the victim's loss because the protocol treasury takes 320000000 of it in execution fees. The impact row thresholds the victim's funds, not the attacker's profit, which is why the loss is the measure of the theft.
It is not a one-off, and the sustained rate is measured rather than extrapolated. 24 cycles against one victim who deposits once and never acts again:
| quantity | measured |
|---|---|
| elapsed | 259212 seconds — exactly 72 hours |
| victim deposited | 900000000000 |
| victim withdrew, after a complete exit | 887390839812 |
| victim loss vs par | 12609160188 |
| as a fraction of its own principal | 14010 ppm = 1.4010% in three days |
| the rate the run itself computes | 4669 ppm/day = 0.4669% of LP principal per day |
| cumulative attacker net | 5144293532 |
| junior depth, first open -> last | 2000002000000 -> 1987919091415 |
| position size, first open -> last | 7800 lots -> 7752 lots |
Three things follow from those numbers rather than from argument. The attack does not self-extinguish: after 72 hours the pool is 0.6% shallower and the position the attacker can open has shrunk by 48 lots out of 7,800, so the next cycle is worth 99.4% of the last. The attacker's capital requirement is not cumulative — the same 1100000000000 is redeemed and redeposited every cycle, so 24 cycles cost no more capital than one. And the extraction is linear in TVL: at ten times the tranche (junior 20,000,000) the charge is 15209998479, attacker net 2125351761 and victim loss 5245351215 on a 9000000000000 deposit — the same fraction, with the attacker's own outlay 11000000000000, that is 11 million USDG, two orders of magnitude below the USD 100 million at which the program's § Attack Investment Amount says a capital requirement is even considered case by case.
There is a second victim class. An LP that is not present beforehand is damaged too: a 500,000 USDG deposit priced into the pulsed epoch is worth 499875718485 once the rebate lands. packages/perps/SECURITY.md:859-860 states as a guarantee that this cannot happen — new LPs "do not inherit old trader obligations at a higher deposit NAV".
Severity. The selected impact is "Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield", which this program's published table rates Critical. The loss is principal — the victim ends below its own deposit, measured in its wallet, with no market move and no action of its own — so it is not the adjacent "Theft of unclaimed yield" row. The feasibility bounds disclosed above (the ~41% to ~61% capital band, the 27-second window, the adverse-flow contingency) are feasibility limitations, and the program's own rule governs what they may affect: "Impact is calculated first, separately from feasibility. Feasibility limitations do not change the impact or severity of a finding, only the amount paid for it. A finding with a large impact that is infeasible retains that impact and severity, but is rewarded at a reduced amount." The adjacent rules add that attacker risk justifies a downgrade only "where the risk massively outweighs the reward", and that "low return on investment alone is not sufficient".
References
Pinned commit a82d4fefb02768e5b3bddcc97dee371eee24fea8. Paths are relative to the repository root.
Primary defect:
packages/perps/src/libraries/HousePoolAccountingLib.sol:60-79— the reconcile snapshot, with no liability term for refundable VPIpackages/perps/src/HousePool.sol:18imports it and callsbuildReconcileSnapshotat:1144,:1453-1454,:1562-1563packages/perps/src/CfdEngineSettlementSidecar.sol:453-464— the charge recognised asRevenue/CashArrivedpackages/perps/src/HousePool.sol:624-640—CashArrivedincrementingaccountedAssetspackages/perps/src/libraries/CloseAccountingLib.sol:107-118— the lifetime clamp permitting the rebatepackages/perps/src/libraries/CfdEnginePlanLib.sol:973-977andpackages/perps/src/CfdEngineSettlementSidecar.sol:621-623— the rebate paid from pool cashpackages/perps/src/CfdTypes.sol:41—vpiAccrueddeclared signed and two-directionalpackages/perps/src/CfdEngineAccountLens.sol:324-327andpackages/perps/src/libraries/CfdEnginePlanLib.sol:51-53— the negative-only reserve, with no positive counterpart
Specification:
packages/perps/ACCOUNTING_SPEC.md:140-142,:798,:1057-1066packages/perps/SECURITY.md:859-860,:866-867,:872,:1434-1444packages/perps/WHITEPAPER.md§5.1packages/perps/DEPLOYMENT.md— the release parameters the arms use
Prior art in this repository, each already an ancestor of the pin, showing that NAV failing to carry an obligation is a defect class this protocol recognises and fixes rather than intended economics:
- commit
13ba8903— "Fix C-01 & C-02: stale mark price NAV arbitrage and ghost funding liability" - commit
d752afe6(PR #39) — branchcodex/fix-deposit-nav-loss-blindness - commit
16240409(PR #62) — branchcodex/junior-unfair
Suggested fix
Do not remove the rebate — the differential probe below does that, and it confiscates the legitimate symmetric rebate a skew-reducing close has earned. The asymmetry to close is the recognition, on the LP side:
- Carry a liability for outstanding refundable VPI in the reconcile snapshot.
HousePool's engine snapshot already receivestraderClaimBalanceAssetsand the terminal price delta; add the aggregate of positive lifetimevpiAccruedacross live positions (the amount the clamp would permit to be rebated) and subtract it inHousePoolAccountingLib.buildReconcileSnapshot, exactly as the trader side already reservesmax(-vpiAccrued, 0)in a dedicated nonwithdrawable bucket. - Or defer recognition. Route the open's VPI component to a pending bucket that the waterfall only distributes once the matching position settles, in the way
pendingRecapitalizationAssetsis already held apart from distributable revenue. The execution fee, which is not refundable, can continue to be recognised at once.
Either closes the exit-price gap without touching the VPI curve, the clamp, or the trader-side reserve.
Link to Proof of Concept
https://gist.github.com/ibrahimatix0x01/c3fba67cb907ea5d188e0cd141c82819
Proof of Concept
How to run
# from the repository root, at commit a82d4fefb02768e5b3bddcc97dee371eee24fea8
cd packages/perps
mkdir -p test/perps/hunt4
# copy the four .sol files embedded below into test/perps/hunt4/
git diff --quiet -- src/ # MUST be clean: no source file is modified
forge test --force --match-path 'test/perps/hunt4/F42_VpiNavPulse.t.sol' -vv # the 6 exploit/control arms
forge test --force --match-path 'test/perps/hunt4/F42_Feasibility.t.sol' -vv # the feasibility sweeps
Last run at the pin with src/ byte-identical: 23 tests passed, 0 failed, 0 skipped, exit 0.
Only two things are mocked, both expressly permitted by the program and both the vendor's own pristine test utilities: Pyth (MockPyth, since signed Wormhole-attested payloads cannot be produced locally) and USDG (MockSettlementToken, since Global Dollar is not deployed in a local Foundry run). Every contract on the path under test is real: HousePool, TrancheVault, CfdEngine, the planner, the settlement sidecar, the clearinghouse, the router, the lifecycle book, the terminal NAV book and the oracle wrapper. There is no vm.store, no deal/mint/burn against a protocol address (USDG is minted to user EOAs, ETH is dealt to actors only for the Pyth fee), no prank as a protocol contract, and no owner action beyond deployment. The attacker is also the keeper, which § Trusted Roles expressly allows.
Step by step — ARM 1, test_F42_exploit_observedVictimWallet
The junior tranche holds 2,000,000 USDG: the victim 900,000 and the attacker 1,100,000. The basket is 1e8 on every tick throughout.
- Both LPs enter honestly. Victim and attacker each call
TrancheVault.requestDeposit, the epoch is settled withOrderRouter.settleLpEpoch, and both callclaimDeposit. The victim now holds shares it will not touch again until step 8. - The attacker queues its exit. After the 1-hour share cooldown it calls
requestRedeemfor its entire balance, targeting epochE. Nothing about this is unusual or restricted. - 20 seconds before the boundary of
E, the attacker opens at the skew cap.commitOrderthenexecuteOrderfor LONG 8,000 lots with 40,000 USDG margin, sized just inside the 40% pool-relativemaxSkewRatio. Because the open increases skew, it pays a VPI charge: the test assertsvpiChargeBooked: 1599998400by readingengine.positions(...), and requires it to be strictly positive. - The charge is now junior equity. Junior NAV moves
2000000999973->2001600998373— the entire1599998400, on a flat basket, with no price movement anywhere. - The attacker settles the epoch itself.
settleLpEpochis permissionless, so no third party or timing luck is needed. The redemption is priced at the inflated NAV. - The attacker claims the redemption:
attackerLpOut: 1100879998670against the1100000000000it deposited. It has just been paid its share of a charge the pool is about to refund. - The attacker closes and collects the refund. The close reduces skew, so the lifetime clamp permits a negative (rebate) VPI, paid from pool cash. After withdrawing:
attackerTraderOut: 59359784541of60000000000funded,treasuryCredit: 320000000,keeperCredit: 200000. Round-trip net:attackerNet: 239983211. - The victim exits honestly and is short.
requestRedeem-> epoch settles ->claimRedeem, leavingvictimSharesLeft: 0. Its wallet holds899440017375against the900000000000it deposited:victimLossVsPar: 559982625, taken from principal, with the basket never having moved.
The control, test_F42_control_observedVictimWallet
The identical LP sequence with no trade at all: same deposits, same cooldown, same epoch, same redemption. The victim withdraws 899999999974 — a loss of 26 atoms of rounding — and the attacker nets -10. The only difference between the arms is the open/close round trip, so the 559982625 shortfall is attributable to it and to nothing else.
Differential probe — proof the arms are sensitive to this one branch
The one-statement edit below is applied to the pinned source and the same arms re-run. It is not the recommended remediation (it also confiscates the legitimate symmetric rebate a skew-reducing close has earned); its only job is to isolate the branch under test:
// src/libraries/CloseAccountingLib.sol, immediately after the lifetime clamp
if (state.vpiDeltaAssets < 0) { state.vpiDeltaAssets = 0; }
| at the pin | with the probe | |
|---|---|---|
attackerNet (ARM 1) |
239983211 |
-1360015189 |
| `victimUsdgO |
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 reconcile snapshot counts the VPI charge as arrived cash but has no liability term for the refundable positive VPI accrual, while only the negative branch of the accrual is ever reserved against.
Impact
A non-participating junior LP could withdraw less than its own deposit, measured at 1.4010% of principal over three days in the sustained run, though the attack only profits when the attacker holds roughly 41% to 61% of the tranche and the rebate survives adverse flow inside a 27-second window.
What the attacker needed
Attacker holds ~41-61% of junior tranche; attacker also acts as trader and keeper; rebate survives adverse flow in 27s window; flat basket, no price move needed
The fix
The reconcile snapshot should subtract an aggregate of positive lifetime VPI accrual across live positions as a liability, mirroring the existing negative-branch reserve, so refundable charges do not inflate LP NAV.
How it was found
- Deposit into the junior tranche and claim the shares after the epoch settles.
- Wait out the share cooldown and queue a full redemption for the next epoch.
- Shortly before the epoch boundary, open a position at the skew cap so the VPI charge is booked as revenue.
- Settle the LP epoch and claim the redemption at the inflated NAV.
- Close the position to collect the VPI rebate, then withdraw.
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 liquidity provider puts money into a shared pool and gets shares whose value should reflect what the pool actually owns. Here a trading fee is counted as pool income straight away, which pushes the share value up, even though the pool may have to hand that same fee back to the trader later. Someone who is both a pool member and that trader can cash out at the raised value and then also take the refund, leaving the remaining members with less than they put in.
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.