Skip to content
Business logic Audit finding Advanced

Refundable positive VPI is counted in Junior redemption NAV, letting an exiting LP take value that remaining LPs must fund when the trader closes

Positive VPI charged when a trader opens a skew-increasing position is booked as Junior LP revenue immediately, even though the same trader can reclaim that VPI as a rebate on a later skew-reducing close. A large Junior LP can redeem at the inflated price before the close, leaving passive Junior LPs to fund the refund.

manvi Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

#99569 [SC-Critical] Refundable positive VPI is counted in Junior redemption NAV, letting an exiting LP take value that remaining LPs must fund when the trader closes

Submitted on Nov 14th 2026 at 09:31:13 UTC by @manvi for Audit Competition | Plether

Description

Brief / Introduction

I found that Plether lets a Junior LP redeem against positive VPI collected from an open trade even though the same trader can recover that VPI component on a later, skew-reducing close. The pool treats the opening charge as revenue for LP pricing immediately. It does not deduct the still-refundable amount from Junior NAV while the position is open. If a large Junior LP withdraws during that interval, it takes its share of the apparent revenue and leaves the remaining Junior LPs to absorb the close-time refund.

I reproduced this with two accounts under the same attacker's control: a trader and a Junior LP. The LP enters, the trader opens a long at the release's 40% skew limit, the LP redeems while that long remains open, and the trader closes at the same oracle price. The sequence produces a net gain for the attacker and a loss for the Junior LP that never trades or withdraws. It needs no privileged role, mispriced oracle update, or change to a production contract.

The results are not limited to a NAV calculation. In the passing tests, the close actually pays 4,800.920006 USDG in net action rebate from the pool, and a separate passive-LP redemption receives 393.774757 USDG less than the same shares were worth before the attack sequence. Over eight natural cycles (approximately 24 hours), the attacker gains 21,281.137251 USDG while the passive Junior position loses 31,415.036510 USDG of redeemable value. The PoC also includes a no-mid-exit control and a separate constant-depth experiment to isolate this issue from the already-documented VPI depth-manipulation finding.

I am reporting Critical — direct theft of user funds because the impact reaches the value backing passive Junior shares, not merely anticipated trading fees or yield. The actual-cash redemption test establishes that the loss can be realized as fewer USDG paid to an unrelated Junior LP. I therefore selected the program's Critical category rather than the separate High category for theft of unclaimed yield.

Vulnerability Details

1. Positive VPI is recorded as revenue before it is final

On a skew-increasing open, the Engine assesses positive VPI. The Clearinghouse collects the trade cost, and CfdEngineSettlementSidecar records the pool's received amount as ClaimantInflowKind.Revenue:

Solidity
if (delta.tradeCostAssets > 0) {
    uint256 poolCashInflowAssets = uint256(delta.tradeCostAssets) - protocolFeeCreditedAssets;
    if (poolCashInflowAssets > 0) {
        IHousePool(host.pool()).recordClaimantInflow(
            poolCashInflowAssets,
            IHousePool.ClaimantInflowKind.Revenue,
            IHousePool.ClaimantInflowCashMode.CashArrived
        );
    }
}

This is CfdEngineSettlementSidecar.sol:454-463. The important distinction is that cash has arrived, but the VPI component is not necessarily final income. If the position later reduces skew, the close calculation can reverse that same charge.

The test measures a 6,001.200006 USDG positive VPI accrual on the open. Junior NAV rises by 6,001.193652 USDG immediately (the small difference is normal concurrent accounting). Senior does not receive that VPI uplift. The charge is therefore already included in the Junior shares' withdrawal price before the trader closes.

2. LP reconciliation does not deduct the position's refundable positive VPI

HousePoolAccountingLib.buildReconcileSnapshot() starts from physical pool assets, adjusts for the marked terminal price delta, and deducts trader claims:

Solidity
uint256 terminalAssets = engineSnapshot.physicalAssets;
uint256 terminalLiabilities = engineSnapshot.traderClaimBalanceAssets;
int256 terminalDelta = engineSnapshot.terminalLpPriceDeltaAssets;
if (terminalDelta >= 0) {
    terminalAssets += uint256(terminalDelta);
} else {
    terminalLiabilities += uint256(-(terminalDelta + 1)) + 1;
}

There is no corresponding liability for the positive vpiAccrued that an open position can recover. TerminalNavBookV2._curveInputFromEngine() builds its marked-price valuation from position size, exact entry cost, side and the collectible cap; it does not add the refundable VPI exposure to the LP-side liability calculation.

HousePool._settleLpEpoch() then reconciles and uses the updated Junior principal as redemption pricing principal:

Solidity
_reconcile(accountingSnapshot, statusSnapshot);
_checkpointEngineCarryIndexes();

RedemptionPhase memory juniorPhase;
juniorPhase.pricingPrincipal = juniorPrincipal;
juniorPhase.pricingSupply = _juniorShareSupply();

As a result, a Junior LP can request an exit, wait for an ordinary LP epoch and receive USDG priced with that collected VPI still in Junior equity.

3. The same trader can reverse the VPI after the LP has exited

A skew-reducing close uses the position's lifetime accrued VPI when limiting a negative close-time VPI delta. In CloseAccountingLib.sol:103-118:

Solidity
state.proportionalAccrualAssets =
    (inputs.position.vpiAccrued * int256(inputs.sizeDelta)) / int256(inputs.position.size);

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 lifetime clamp prevents the trader from receiving more negative VPI than its accrued positive VPI. It does not stop a different account, controlled by the same attacker, from redeeming Junior shares while that accrual is still counted in NAV.

The close planner then nets VPI against execution fees, carry and any frozen-market spread. A negative net action amount, rather than the full raw VPI delta, becomes the cash rebate:

Solidity
int256 actionNetAssets = cs.vpiDeltaAssets
    + int256(
        cs.executionFeeAssets + cs.frozenSpreadAssets
            + delta.pendingCarryAssets - delta.realizedCarryAssets
    );
// If actionNetAssets < 0, the absolute value is the assessed action rebate.

CfdEnginePlanLib.sol:970-977 limits that assessed rebate to free pool cash. CfdEngineSettlementSidecar.sol:621-624 then transfers the paid rebate from HousePool to the Clearinghouse and credits the trader. This is an actual cash-backed settlement, not an unrealized accounting mark.

I recorded the emitted ActionRebateSettled event in the final test:

Close settlement item USDG
Opening positive VPI accrued 6,001.200006
VPI component reversed on close -6,001.200006
Net action rebate assessed after charges 4,800.920006
Net action rebate actually funded by HousePool 4,800.920006
Unfunded / waived rebate 0.000000

The entire VPI component reverses; the cash paid is 4,800.920006 USDG after netting charges. This distinction matters. My impact is based on the actual combined trader/LP balances and the confirmed pool-funded payment, not on incorrectly treating the gross 6,001.200006 USDG component as an additional full cash payout.

4. The attack is an LP exit-timing transfer, not a VPI curve amplification

The attacker's Junior shares own a fraction f of the tranche. When the opening VPI is recognized as revenue, the value of those shares increases with that revenue. The attacker withdraws that value before the associated position's close-time liability is realized. The close then reduces the NAV of the Junior shares still outstanding.

The simplest economic description is: the LP leg captures an upfront credit, while the trader leg later claims the allowable rebate; the passive LP is left with the cost. Execution fees, carry, coupons and funding rules affect the exact result. Those costs are included in the test's participant-balance calculation, and the attack is profitable after those protocol-level charges.

The constant-depth case is useful because it eliminates the apparent alternative explanation. In that test, the pool depth before the open is 7,502,000 USDG and before the close is 7,501,932 USDG. The close-time unclamped curve would rebate approximately 6,001.254066 USDG, versus 6,001.200006 USDG originally accrued. That is a difference of only about 0.0009%, and the lifetime clamp applies exactly the accrued 6,001.200006 USDG. The attacker still earns 2,651.184815 USDG in that cycle, while the pre-existing passive Junior LP loses 3,943.317971 USDG in NAV value. The separate refilling LP in that experiment is included in the test's total honest-LP accounting.

In other words, the exploit remains when the close-depth VPI calculation is effectively unchanged. It comes from interim NAV ownership, not from making the curve pay more than its ordinary amount.

5. The complete attack fits normal LP epochs

All times below are relative to an hourly settlement boundary E. Requests occur before the 300-second cutoff, and the attacker observes the one-hour deposit cooldown.

Time Action
Before E - 300s Attacker Junior LP submits a 4,250,000 USDG deposit request.
E + 10s Permissionless keeper settles the epoch; attacker claims Junior shares.
After deposit activation Attacker trader opens a roughly 3,000,700 USDG max-skew LONG at the unchanged 1.00 oracle price, paying positive VPI. The pool recognizes that VPI in Junior NAV.
E + 1h + 60s After the cooldown, attacker Junior LP requests redemption of all freely redeemable shares. A keeper refreshes the honest mark.
E + 2h + 10s The withdrawal epoch is settled and the attacker LP claims actual USDG at the inflated Junior redemption price.
Immediately afterward The trader fully closes the LONG at the same price; the allowed negative VPI component becomes a net action rebate funded from remaining pool cash.
Next cycle The attacker can re-enter and repeat. The no-refill variant completes eight cycles in 86,413 seconds.

The attacker controls the trader, the large Junior LP and its permissionless keeper. The passive Junior depositor is independent. There is no requirement for a malicious owner, guardian, oracle publisher or protocol keeper service.

Impact Details

I ran the full nine-test suite against the audited commit with Foundry 1.5.1. All nine tests passed, with no skipped tests or failures. The test uses release VPI/skew/fee/margin settings, a 40 million USDG Senior cap, an 80% Senior share cap, 750,000 USDG of initial honest Junior liquidity and 2,500,000 USDG of honest Senior liquidity. The attacker puts 4,250,000 USDG into Junior and funds its trader with 400,000 USDG margin.

Profitable repeated extraction from passive Junior LPs

Scenario Attacker PnL Honest Junior result Relevance
Single constant-depth cycle +2,651.184815 USDG -3,943.317971 USDG for the original passive LP Attack works with essentially unchanged VPI curve depth.
Eight cycles, ordinary no-refill path +21,281.137251 USDG -31,415.036510 USDG Repeatable extraction in ~24 hours; average passive loss ~418 basis points/day in this test.
Eight cycles, constant-depth path +21,207.049202 USDG -31,565 USDG including the separate refilling LP (rounded test summary) The separate constant-depth control stays profitable every cycle.
Eight cycles, mixed attacker Senior + Junior deposits +21,082.145984 USDG -31,280.175093 USDG Holding Senior as well does not remove the Junior extraction.
Eight cycles, no mid-position Junior exit -11,528.319925 USDG +1,193.105933 USDG With the attacker remaining in Junior until after each close, the attack is unprofitable.

The no-mid-exit comparison is a distinct control run with its own redemption timing and close-time depth; it is not presented as an identical-depth experiment. The separate constant-depth tests are what isolate that possible confounder. In both comparisons, exiting while refundable VPI is outstanding is the profitable step.

The tranche choice also matters. The Senior-only test loses money for the attacker and shows that the open VPI credit lands in Junior, not Senior. The Junior-share sweep turns attacker-profitable around 44.5% ownership in the simulated pool. The exploit does not require full ownership of Junior, but it does require substantial capital and freedom to redeem at the scheduled epoch. As with other investment-heavy on-chain attacks, transaction gas and external hedging costs are not measured by this local Foundry balance test; on-chain execution charges and the test keeper's credits are included.

Actual USDG redemption proves loss is not just an unrealized NAV mark

I separately made the passive Junior LP request redemption of a 10% slice of its freely withdrawable shares after the attack. The test settled the following LP epoch, claimed the funded redemption and checked the actual change in the LP's USDG token balance.

Item USDG
Pre-attack value of the same redeemed shares 74,621.356904
Post-attack share-NAV quote, before the final redemption epoch 74,229.865376
USDG actually received in the wallet 74,227.582147
Shortfall against the pre-attack value 393.774757

Of that difference, 391.491528 USDG is already present in the post-attack NAV quote, and 2.283229 USDG arises between that quote and the subsequent funded redemption. I do not attribute that latter amount exclusively to VPI. The decisive fact is that the passive LP's shares lost value before redemption and it actually received fewer USDG, while the attacker separately realized a positive net balance gain.

The larger 31,415.036510 USDG figure in the eight-cycle test measures the passive Junior position's remaining redeemable share value. It is not described as 31,415 USDG already withdrawn from that victim's wallet. The smaller redemption test supplies direct cash-realization evidence for the same type of loss.

The loss comes from value backing existing LP shares, not just unpaid future yield. For this reason I selected the competition's Critical: direct theft of user funds category.

Why This Is a Separate Issue from the Known VPI Finding

The published AI scan lists “Temporary pool-liquidity reduction can amplify a skew-reducing close rebate.” That report concerns changing the pool-depth denominator around a close so the calculated negative VPI becomes larger. My root cause is different: positive VPI that can later be refunded is included in an intervening Junior redemption price without any liability offset.

I tested that distinction directly. With opening and closing economic depth effectively equal, the calculated rebate is not artificially amplified, but the attacker still redeems the interim Junior uplift and profits. A fix that merely snapshots close-time depth or prevents deliberate liquidity-driven rebate amplification would not correct the timing of Junior NAV recognition.

SECURITY.md also documents the lifetime VPI clamp, including the intent to prevent extractable rebate-only round trips. This attack does not exceed the lifetime clamp. It combines a permitted trader round trip with an LP redemption occurring between the two sides of that round trip.

The accounting specification's collection-time ownership rule addresses carry. Collected carry is not refunded to the same trader just for closing the position. Here, the previously collected VPI can form part of a later trader rebate. The relevant distinction is not when cash entered HousePool, but whether it was already final for the LPs whose shares are being priced.

The specification currently protects negative lifetime VPI with a dedicated reserve, but does not account for the opposite, still-refundable positive VPI in redemption NAV. That omission is what makes the cross-account transfer out of passive Junior capital possible; the nine-test PoC demonstrates it through the protocol's existing settlement and redemption paths.

Suggested Remediation

Keep the refundable portion of collected positive VPI out of redeemable LP equity until the position can no longer reclaim it. A practical approach would be to maintain an accounting liability for the still-rebatable positive VPI of open positions and deduct it in the canonical LP reconcile snapshot used by both deposit and redemption pricing. Recompute the amount on opens, increases, partial closes, full closes and liquidations, and release the portion that is no longer refundable into earned revenue.

Alternatively, defer recognition of the refundable VPI component as tranche revenue until that obligation is extinguished. Whatever accounting method is chosen, the correction must apply symmetrically to deposits and withdrawals, and it must not double-count liabilities already represented by trader claims or the terminal price book.

The relevant invariant is straightforward: an LP must not be able to redeem cash attributed to a trader charge while an open position can still cause that charge to be paid back out of the remaining LPs' funds.

References

Proof of Concept

I reproduced the attack at commit a82d4fefb02768e5b3bddcc97dee371eee24fea8 with Foundry 1.5.1. The final PoC contains nine tests. It uses BasePerpTest, which deploys the real in-scope pool, vault, Engine, planners and settlement sidecars and mocks external Pyth data and USDG. The test fixture's LegacyOrderRouterHarness provides a scalar commitOrder convenience function; that function translates its arguments into a V3 OrderRequest and delegates to the production V3 Router commit implementation. The economic execution, close settlement, tranche reconciliation and USDG redemption are not mocked. I made no changes to packages/perps/src.

Repository: https://github.com/immunefi-team/audit-comp-plether
Commit: a82d4fefb02768e5b3bddcc97dee371eee24fea8
PoC file: packages/perps/test/perps/insight/VpiLpExitTheftPoC.t.sol
Test contract: VpiLpExitTheftPoC
SHA-256 of the exact tested .sol file: 6143682b0729001bdb2ed4aea1ed8d1dba3dc991f36481e79727d17843fdf538

Reproduction Steps

  1. Use the audited commit and Foundry 1.5.1. Save the complete Solidity source printed below to packages/perps/test/perps/insight/VpiLpExitTheftPoC.t.sol.
  2. Run the entire PoC suite. The test fixture activates the release-style pool and creates separate honest Junior/Senior accounts, attacker Junior LP, attacker trader and keeper. The attacker starts with 4.25 million USDG of Junior liquidity and 400,000 USDG in the trader account.
  3. In the single-cycle and eight-cycle attacks, observe the positive opening VPI, its recognition in Junior NAV, the attacker Junior redemption before the trader closes, and the later negative VPI component. Assert positive attacker PnL and negative passive Junior PnL.
  4. In the constant-depth case, observe almost identical opening and closing depths and compare the unclamped close curve against the opening charge. The attacker still profits with no meaningful curve amplification.
  5. Run the no-mid-exit control with the same attack roles and trade pattern but redeem the attacking Junior shares after each close. Observe that the attacker's cumulative result becomes negative.
  6. Record ActionRebateSettled on the close. Assert a single event for the trader, a positive paid rebate, paid plus waived equaling assessed, and an actual paid amount of 4,800.920006 USDG.
  7. After a normal attack cycle, have the passive Junior LP redeem a 10% slice of withdrawable shares. Fund that request through the next LP epoch, claim the USDG, and compare the wallet balance increase with the same shares' original value. Observe a 393.774757 USDG actual cash shortfall.
  8. Confirm nine passing tests, and confirm the audited packages/perps/src directory has no changes.

Commands

Run from the repository root in GitHub Codespaces or an equivalent environment with its submodules initialized:

Bash
cd /workspaces/audit-comp-plether

git rev-parse HEAD
# Required: a82d4fefb02768e5b3bddcc97dee371eee24fea8

forge --version
# Confirmed in reproduction: forge 1.5.1

git submodule update --init --recursive
mkdir -p vpi_evidence
set -o pipefail

forge test \
  --root packages/perps \
  --match-path 'test/perps/insight/VpiLpExitTheftPoC.t.sol' \
  -vv \
  2>&1 | tee vpi_evidence/all_nine_tests.log

# Inspect the two cash-realization checks with detailed traces.
forge test \
  --root packages/perps \
  --match-path 'test/perps/insight/VpiLpExitTheftPoC.t.sol' \
  --match-test 'test_Final_ActualActionRebateSettledFromPoolCash|test_Final_PassiveJuniorRealizedCashRedemptionShortfall' \
  -vvvv \
  2>&1 | tee vpi_evidence/final_cash_evidence.log

# Confirm the in-scope audited contracts were not edited.
git diff -- packages/perps/src

# Verify the exact source used for the passing run.
sha256sum packages/perps/test/perps/insight/VpiLpExitTheftPoC.t.sol

Observed Console Output

The following excerpts are taken from the nine-test Codespaces execution; the pass list omits gas figures for readability. USDG uses six decimals; the raw event values are in USDG atoms.

Text
Ran 9 tests for test/perps/insight/VpiLpExitTheftPoC.t.sol:VpiLpExitTheftPoC
[PASS] test_Control_EightCycles_NoMidExit()
[PASS] test_FSweep_SingleCycle()
[PASS] test_Final_ActualActionRebateSettledFromPoolCash()
[PASS] test_Final_PassiveJuniorRealizedCashRedemptionShortfall()
[PASS] test_Mixed_SeniorPlusJuniorAttacker()
[PASS] test_PoC_EightCycles_ConstantDepth()
[PASS] test_PoC_EightCycles_Natural()
[PASS] test_PoC_SingleCycle_ConstantDepth()
[PASS] test_Senior_OnlyAttackerCapturesNothing()
Suite result: ok. 9 passed; 0 failed; 0 skipped

Actual net rebate paid from HousePool:

Text
FINAL open positive VPI (USDG atoms)                  6001200006
FINAL applied negative VPI on close (USDG atoms)    -6001200006
FINAL net rebate assessed (USDG atoms)               4800920006
FINAL net rebate actually paid from pool (USDG atoms) 4800920006
FINAL unpaid rebate waived (USDG atoms)                       0

Passive Junior's actual USDG withdrawal:

Text
FINAL passive Junior redeemed shares                     75000684906253
FINAL pre-attack value of same shares (USDG atoms)       74621356904
FINAL post-attack NAV quote (USDG atoms)                 74229865376
FINAL actual USDG received (atoms)                       74227582147
FINAL realized USDG shortfall (atoms)                      393774757

Single-cycle, constant-depth attack:

Text
attacker share of Junior f (bps)            8504
depth at open / at close (USDG)              7502000 7501932
long size (lots of 100 USDG)                 30007
VPI paid at open (atoms)                     6001200006
Junior NAV jump on open (atoms)              6001193652
close VPI delta applied (atoms)             -6001200006
close VPI unclamped @close depth            -6001254066
attacker PnL this cycle (atoms)              2651184815
honest Junior PnL this cycle (atoms)        -3943317971

Eight-cycle natural-path totals, without refilling pool depth:

Text
========== 8 cycles, attack (no refill)
cycles 8
elapsed seconds 86413
attacker cumulative PnL (USDG) 21281
honest Junior cumulative PnL (USDG) -31415
honest Senior cumulative PnL (USDG, coupon) 549
honest Junior PnL per day (bps of capital) -418

Eight-cycle no-mid-exit control:

Text
========== 8 cycles, CONTROL (LP exits after close)
cycles 8
elapsed seconds 115212
attacker cumulative PnL (USDG) -11528
honest Junior cumulative PnL (USDG) 1193

Capital threshold from the share-fraction sweep:

Text
f (bps) 4009; attacker PnL (USDG*1e6) -22066705
f (bps) 4453; attacker PnL (USDG*1e6) 112809637
f (bps) 8504; attacker PnL (USDG*1e6) 2651182412

The tests together show the three necessary pieces: the interim Junior share uplift, the actual pool-funded net rebate, and the victim's lower final USDG redemption. Neither the Senior-only negative control nor the no-mid-exit control produces the same profitable result.

Complete Solidity PoC Source

Save as: packages/perps/test/perps/insight/VpiLpExitTheftPoC.t.sol

The source below is the exact nine-test file that passed in Codespaces, unchanged. The comments that refer to refunding “the full VPI” mean the close-side VPI component; the test_Final_ActualActionRebateSettledFromPoolCash assertion separately measures the smaller net cash rebate after fees.

Solidity
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.35;

import {BasePerpTest} from "../BasePerpTest.sol";
import {CfdMath} from "@plether/perps/CfdMath.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {ICfdEngineTypes} from "@plether/perps/interfaces/ICfdEngineTypes.sol";
import {console2} from "forge-std/console2.sol";
import {Vm} from "forge-std/Vm.sol";

/// @notice PoC: refundable positive VPI is booked as Junior LP equity the moment it is charged. A skew-increasing open
///         pays VPI V into HousePool cash and Junior NAV rises by V at once, but the SAME position gets up to all of V
///         back as a rebate on its skew-reducing close (the lifetime clamp permits a refund up to the lifetime
///         accrual). A Junior LP that owns a fraction f of Junior and redeems while the position is open walks away
///         with f*V; the trader's close then pulls the full V from the REMAINING LPs.
///
///         Attacker coalition = trader account + Junior LP account + keeper account. All actions use production
///         entrypoints only (router.commitOrder / executeOrder / settleLpEpoch, juniorVault.requestDeposit /
///         claimDeposit / requestRedeem / claimRedeem). Every Pyth update is the honest constant basket price 1.00,
///         so no price selection is involved. Release risk params and the release Senior caps (40M, 80%) are used.
contract VpiLpExitTheftPoC is BasePerpTest {

    uint256 internal constant PRICE = 1e8;
    uint256 internal constant LOT = 1e20; // SIZE_QUANTUM: 100 tokens = 100 USDG at PRICE

    address internal constant TRADER = address(0xA7701);
    address internal constant ALP = address(0xA7704); // attacker Junior LP
    address internal constant KEEPER = address(0xA7705); // attacker keeper (executes its own orders / settlements)
    address internal constant SLP = address(0xA7706); // attacker Senior LP (Senior / mixed scenarios)
    address internal constant REFILL = address(0xBEEF01); // unrelated honest LP that refills depth (constant-depth runs)

    uint256 internal constant HONEST_JUNIOR = 750_000e6;
    uint256 internal constant HONEST_SENIOR = 2_500_000e6;

    // accounting
    uint256 internal attackerIn;
    uint256 internal refillIn;
    uint256 internal lastRefillRedeemId;
    bool internal refillRedeemPending;

    struct CycleOut {
        uint

The original report as published on Immunefi, by manvi. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

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 LP reconciliation snapshot counts collected positive VPI as final revenue without a liability for the portion an open position can still reclaim on close.

Impact

An attacker controlling both a trader and a large Junior LP could repeatedly extract value from passive Junior LPs, with the PoC showing a net gain of about 21,281 USDG over eight cycles while a passive position lost about 31,415 USDG of redeemable value, and a separate redemption test showing an actual cash shortfall of about 394 USDG.

What the attacker needed

Substantial capital (millions in USDG); control of a trader and a large Junior LP; ability to redeem at the scheduled LP epoch; no privileged role needed

The fix

The refundable portion of collected positive VPI should be held as a liability and excluded from redeemable LP equity until the position can no longer reclaim it, applied symmetrically to deposits and withdrawals.

How it was found

  1. Deploy the audited commit with Foundry 1.5.1 and place the PoC test file in the perps test directory.
  2. Run the PoC suite, which sets up honest Junior and Senior accounts plus an attacker Junior LP, attacker trader and keeper.
  3. Observe the opening positive VPI being recognised in Junior NAV, then the attacker Junior redemption before the trader closes.
  4. Observe the later negative VPI component and the pool-funded action rebate on close.
  5. Run the constant-depth case to confirm the attack works with almost identical opening and closing depths.
  6. Run the no-mid-exit control, redeeming the attacking Junior shares after each close, and observe the attacker's cumulative result turns negative.

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 trader pays a fee-like charge (VPI) when opening a trade, and the pool counts it as profit for the people who lent money to the pool (liquidity providers, LPs). But if the trader later closes the trade, part of that charge is paid back to them. The report shows a lender can withdraw their share while the charge still looks like profit, so the money they take out is later paid back to the trader out of the remaining lenders' funds.

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 manvi

View all

26 more disclosed reports, best first.

More from Plether

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.