Refundable VPI Inflates Junior NAV, Enabling Profitable Extraction of Passive LP Principal
The pool's terminal NAV snapshot counts virtual price impact (VPI) paid by an open trader as distributable LP value, even though that VPI may later be refunded as a close rebate. A coalition LP can redeem Junior shares while the position is open, keeping the inflated exit price, and the remaining passive Junior LPs fund the rebate when the trader closes.
- Disclosed after under an hour
#99145 [SC-Critical] Refundable VPI Inflates Junior NAV, Enabling Profitable Extraction of Passive LP Principal
Submitted on Nov 12th 2026 at 04:24:34 UTC by @xRakan for Audit Competition | Plether
- Report ID: #99145
- Report Type: Smart Contract
- Report severity: Critical
- Target: https://github.com/immunefi-team/audit-comp-plether/tree/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src
- Impacts:
- Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Description
Summary
An ordinary trader opens a position that pays positive virtual price impact (VPI) into the HousePool. Those USDG increase the pool's physical assets immediately. While the position remains open, its accrued VPI represents potentially refundable value. Whether any rebate is produced depends on the close-time VPI calculation; the lifetime clamp bounds it by the accrued VPI. HousePool's terminal NAV counts the VPI cash but does not account for this potential close-time outcome when it prices Junior redemptions.
A coalition LP can request and claim a redemption after the VPI payment enters NAV but before the trader closes. If the close-time calculation produces a rebate, the trader can receive it from remaining free pool cash, subject to the lifetime clamp and any waiver for insufficient cash. The redeeming LP keeps the share of cash already included in its exit price; the Junior LPs who remain fund any rebate that is paid.
At the primary launch-parameter point and a fixed 1.0 mark, the coalition realizes +1,047.865777 USDG and passive Junior LP V has a realized full-exit change of −1,104.190974 USDG. Same-time controls instead produce V gains of +200.189681 to +212.317465 USDG over its starting value. The measured loss does not require a rebate greater than the VPI previously accrued, price movement, or oracle manipulation.
Vulnerability Details
Root cause
HousePool.settleLpEpoch reconciles the pool before it funds matured redemption requests. Its canonical terminal-NAV snapshot starts from physical assets, trader claims, and terminal price PnL. It has no input or adjustment for outstanding VPI:
function buildReconcileSnapshot(
HousePoolEngineViewTypes.HousePoolInputSnapshot memory engineSnapshot
) internal pure returns (ReconcileSnapshot memory snapshot) {
uint256 terminalAssets = engineSnapshot.physicalAssets;
uint256 terminalLiabilities = engineSnapshot.traderClaimBalanceAssets;
int256 terminalDelta = engineSnapshot.terminalLpPriceDeltaAssets;
if (terminalDelta >= 0) {
terminalAssets += uint256(terminalDelta);
} else {
terminalLiabilities += uint256(-(terminalDelta + 1)) + 1;
}
if (terminalAssets >= terminalLiabilities) {
snapshot.distributable = terminalAssets - terminalLiabilities;
} else {
snapshot.deficit = terminalLiabilities - terminalAssets;
}
}
The Engine stores each open position's signed lifetime VPI; positive means the trader paid the pool, and negative means the pool paid a rebate. On close, the lifetime clamp prevents the signed balance from going below zero:
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 close planner pays the action rebate out of free pool cash and waives an unfunded remainder:
if (delta.actionRebateAssets > 0) {
delta.actionRebatePaidAssets =
delta.actionRebateAssets < freePoolCashAssets ? delta.actionRebateAssets : freePoolCashAssets;
delta.actionRebateWaivedAssets = delta.actionRebateAssets - delta.actionRebatePaidAssets;
poolCashAfterCollectionsAssets -= delta.actionRebatePaidAssets;
}
The test verifies sufficient free cash and the actual wallet and pool balances for the primary sequence. Positive accrued VPI is potentially refundable, not a fixed payout: the close-time calculation determines the rebate under the lifetime clamp, and the planner waives any portion that free pool cash cannot fund. The close VPI delta reaches the full −5,460.874219 USDG lifetime clamp, but that is not the net cash payout: ActionRebateSettled paid +4,354.874219 USDG after the 1,106.000000 USDG close execution fee; the waived amount and realized carry were both 0.000000 USDG. The accounting defect is the timing: the exit snapshot distributes the collected VPI as LP value before that contingent close-time outcome is known. This report does not claim that LP entry and exit use different NAV formulas; the same terminal snapshot is used for both.
Why this is a supported path
- Trader B commits and executes its own order through the Router. LP A requests redemption and permissionlessly calls the matured epoch path through the Router; B then closes and withdraws its free margin.
- The actors need no owner, guardian, publisher, compromised keeper, stolen key, reentrancy, or signature forgery. The test also executes B's order through a separate keeper; the coalition result changes only by the 0.20 USDG clearinghouse credit.
- Every price observation uses the repository's MockPyth test fixture at a fixed 1.0 mark. No price, confidence, or publish-time manipulation occurs.
- The run uses production Router, Engine, HousePool, MarginClearinghouse, and tranche-vault code from the pinned source. No production contract is changed. The protocol is not deployed on Mainnet, so these are test measurements, not losses observed in a deployed system.
Preconditions
- A and B coordinate through separate LP and trader accounts. At the primary point A begins with 3,000,000 USDG of Junior shares; B has 165,930 USDG in funded account value.
- The pool has free cash to pay the close rebate. The primary sequence verifies that the VPI reserve, trader claim, and clearinghouse balance are zero after B fully closes and withdraws.
- B opens a LONG at 39.5% of the 7,000,001 USDG pool depth: 2,765,000 USDG notional. It pays 5,460.874219 USDG of VPI.
- TrancheVault enforces a one-hour post-deposit cooldown and HousePool uses a shared one-hour LP epoch. A's cooldown has elapsed; the PoC places its redemption request in B's open-position epoch, settles at the next boundary through the public Router path, then claims the funded request. It advances protocol time to satisfy the cooldown and epoch rather than bypassing them (redemption request and cooldown; one-hour LP epoch). The same 1.0 mark is used through open, settlement, and close.
- The test uses the checked-in launch values: vpiFactor 0.01e18, maxSkewRatio 0.4e18, baseCarryBps 500, and executionFeeBps 4. These values are listed in the pinned deployment defaults.
These are capital and execution conditions, not reasons to reduce the measured technical impact.
Attack path
- Passive LP V and coalition LP A hold Junior shares in a pool with 7,000,001 USDG of assets. V's initial share value is 999,996.286141 USDG; A's is 2,999,988.858436 USDG.
- B opens a 2,765,000 USDG LONG through the Router. The fixed-price fill transfers 5,460.874219 USDG of VPI into the pool.
- A requests its matured redemption. At the next hourly epoch, a permissionless caller settles the pool while B's position is open. A claims 3,003,254.591487 USDG and has no remaining shares, pending request, refundable shares, or claimable assets.
- At the same mark, B closes. The close VPI delta reaches the full accrued lifetime clamp (−5,460.874219 USDG); after the 1,106.000000 USDG close execution fee, the actual net action rebate transferred is +4,354.874219 USDG, with no waiver. Realized carry is 0.000000 USDG. B settles any trader claim, withdraws its free margin, and ends with no position, clearinghouse balance, trader claim, or VPI reserve.
- In a subsequent epoch, V requests and completes a full redemption. Its actual claim is 998,892.095167 USDG, a realized change of −1,104.190974 USDG from its starting value.
Impact Details
Amounts are in USDG. “V change” is the actual amount transferred by a completed requestRedeem → settlement → claimRedeem sequence, compared with V's starting share value. The final passive-LP claim is measured in a state snapshot after the position closes; that state is reverted after its returned assets and wallet transfer are checked. The earlier conservation checkpoint uses V's share value and is not presented as including that later claim. All coalition profit figures include protocol-level trading charges and carry but exclude external transaction gas costs. The primary and price-sensitivity runs measured 0.000000 USDG pending and realized carry at close.
| Scenario | Coalition realized net | Passive V actual full-exit change | VPI paid at open |
|---|---|---|---|
| 39.5% attack | +1,047.865777 | −1,104.190974 | 5,460.874219 |
| 35% attack | +597.103209 | −815.809690 | 4,287.499387 |
| 25% attack | −100.639232 | −326.938469 | 2,187.499687 |
| 10% attack | −361.166443 | +13.325137 | 349.999950 |
| A stays in the pool; B trades | — | +212.317465 | 5,460.874219 |
| B closes before A's redemption is settled | — | +200.189681 | 5,460.874219 |
| Separate keeper executes the 39.5% attack | +1,047.665777 | −1,104.190974 | 5,460.874219 |
At 39.5% skew, A claims 3,003,254.591487 USDG. B's wallet moves from 165,930.000000 to 163,712.132726 USDG after the close and free-margin withdrawal, a net change of −2,217.867274 USDG. Their combined realized net is +1,047.865777 USDG. V starts at 999,996.286141 USDG and receives 998,892.095167 USDG. The test's attack-time tracked-balance conservation sum, including tranche holders, treasury, and keeper clearinghouse credit, is zero.
The fixed-midpoint result is not risk-free. In a separate Router replay with valid MockPyth timestamps and 1 bp confidence, changing the midpoint by +2 bp before close left the coalition +397.705905 USDG, while +5 bp produced −432.125895 USDG; linear interpolation places the break-even near +3.44 bp. External hedge depth and cost were not modeled.
The 25% case intentionally demonstrates that the coalition need not profit for the victim's principal to decrease: the coalition change is −100.639232 USDG while V changes by −326.938469 USDG. At 10% skew, the coalition changes by −361.166443 USDG and V changes by +13.325137 USDG from its starting value. These negative cases bound the profitable range and are not used to claim universal profitability.
Six-cycle repeatability. The test performs six cycles over 61,140 seconds and 17 hourly epochs. It excludes 177,149.084457 USDG of B's additional funding from the coalition result. After A's final full redemption and B's final margin withdrawal, A's wallet holds 3,019,555.328655 USDG and B's holds 163,836.352929 USDG. Their combined realized net after B's additional funding is +6,253.738691 USDG. V's starting value is 999,996.286141 USDG; its actual final claim is 993,367.630890 USDG, a −6,628.655251 USDG principal change. The preceding share-value checkpoint's tracked deltas sum to −1 USDG atom; the later V claim is a separate state-snapshot measurement.
Entry-side mirror. With an unrelated O LONG open, O has +3,120.499219 USDG of accrued VPI. B's opposing SHORT receives −3,118.066739 USDG and has a 3,118.066739 USDG nonwithdrawable reserve. A deposits 8,000,000 USDG and activates at the depressed Junior NAV before B closes. The measured 80% A-share path gives A +2,467.866114 USDG, B −1,267.285743 USDG, and a coalition net of +1,200.580371 USDG. V starts at 999,990.715363 USDG and receives 999,041.087071 USDG after O closes: −949.628292 USDG. In the matched B-idle control V receives 1,000,288.955415 USDG: +298.240052 USDG. Thus the attack/control difference in V's realized exit is −1,247.868344 USDG. The V exit is measured inside a state snapshot after O's ordinary close; the snapshot is reverted after measurement. This mirror is secondary and requires an 8,000,000 USDG deposit plus the unrelated O position.
At the 60% share point, the coalition realizes +583.617404 USDG and V's actual exit changes by −640.102445 USDG. At 40%, the coalition loses 33.351680 USDG while V's actual exit changes by −330.775663 USDG. Their matched B-idle V exits change by +295.385742 USDG and +292.331631 USDG, respectively. At 40%, the coalition change is −33.351680 USDG; this case is not described as profitable.
Duplicate and known-issue analysis
The closest listed scan issue is finding #31, “Temporary pool-liquidity reduction can amplify a skew-reducing close rebate.” Its stated root is reducing execution-time depth so the close curve produces a larger rebate than the unmanipulated curve. A's redemption also lowers pool depth here. A controlled differential in a disposable copy held only the depth passed to the close VPI calculation at the exact net depth observed just after B opened (7,005,461.874219 USDG); the actual redemption, Router call order, Pool cash and NAV settlement remained unchanged. At zero confidence and a fixed 1.0 mark, the normal-depth attack produced coalition +1,047.865777 USDG and V's actual exit −1,104.190974 USDG. Its close VPI delta reached −5,460.874219 USDG; after the close execution fee, the net action rebate paid was +4,354.874219 USDG. With the close VPI depth held at the post-open value, the close VPI delta was −5,456.617377 USDG against +5,460.874219 USDG accrued, so it remained within the lifetime clamp and below the accrued amount. The net action rebate was +4,350.617377 USDG, the coalition still realized +1,043.608935 USDG, and V's actual exit was −1,102.062553 USDG. The depth-dependent difference was only 4.256842 USDG of coalition profit; most of the principal transfer persists without the excessive rebate described in #31. The differential test isolates NAV-timing extraction from close-depth rebate amplification. The coalition remains profitable without relying on an excessive close rebate, establishing a distinct accounting mechanism from finding #31 while retaining the protocol's normal lifetime VPI clamp.
The listed SC Audit Studio finding SC-H1 concerns a deposit before senior yield is accrued and dilution of prior depositors' yield. SC-M3 concerns fresh negative VPI omitted from post-open initial-margin projection. Neither describes a passive Junior LP's principal being transferred through redemption pricing before an already-accrued VPI rebate is paid. The listed Cecuro report and the collaborative and Cantina reports were also reviewed; no exact match for this root was identified.
The strongest counterargument is explicit documentation. SECURITY.md and ACCOUNTING_SPEC.md say anticipated VPI and its reserve are excluded from terminal NAV. They describe the mechanism but do not state that an exiting LP can keep principal later paid as another trader's close rebate by the LPs who remain. The listed VPI limitations and LP accounting limitations do not name that principal transfer.
ACCOUNTING_SPEC.md:737-740 describes collection-time ownership of accrued carry, including carry collected after a new LP's activation. This differs from VPI because carry represents collected revenue, whereas positive VPI remains potentially refundable at position close.
In the reproduced attack, Junior redemption is priced using pool assets that include collected VPI. The subsequent trader close pays a net action rebate of 4,354.874219 USDG after the 1,106.000000 USDG close execution fee, reducing the assets backing the remaining LPs. The documented VPI NAV policy does not explicitly address this coordinated redemption-and-close sequence or its demonstrated transfer of passive Junior LP principal.
The report does not rely on ACCOUNTING_SPEC.md:1288 or WHITEPAPER.md:1793 as violated guarantees. Those passages describe shared entry/exit NAV accounting, which the PoC also uses.
Mitigation
A candidate fix adds a signed aggregate of VPI accrued over live positions, passes it into the HousePool input snapshot, and adjusts terminal NAV by that signed amount. Positive aggregate VPI is conservatively treated as potentially refundable value; it is not a promise that each position receives a rebate. Actual payment depends on the close-time VPI calculation and lifetime clamp, and any portion exceeding available free pool cash is waived. Negative aggregate VPI represents rebate cash already paid and recoverable from a dedicated reserve. The candidate patch does not change the close clamp, reserve operations, or cash payout path.
The signed sum is safe only while each negative position remains fully backed. The pinned open and close planners require the per-account reserve to equal or exceed the negative VPI target; MarginClearinghouse protects that bucket from generic action charges and only transfers it to the pool through the close path. The patch test opens independent positions O and B with +3,120.499219 USDG and −3,118.066739 USDG accrued VPI. Their signed aggregate is +2.432480 USDG; the test checks that exact sum and verifies B's separate reserve equals 3,118.066739 USDG. It then checks the aggregate and reserve through B's partial close, full close, O's close, and snapshot restoration. Partial close leaves O's positive VPI intact; closing B returns the aggregate to O's balance; closing O returns it to zero. This tests that the signed accounting is backed by per-account reserve state rather than by an unbacked cross-account offset.
--- a/packages/perps/src/CfdEngine.sol
+++ b/packages/perps/src/CfdEngine.sol
@@ -114,6 +114,11 @@
uint256[2] public sideCarryIndex;
/// @notice Wall-clock Unix timestamp through which each side carry index (`0` LONG; `1` SHORT) has been advanced.
uint64[2] public sideCarryTimestamp;
+ /// @notice Signed sum of `vpiAccrued` over all live positions, in 6-decimal settlement token units.
+ /// @dev Positive accrued VPI represents potentially refundable value on close and is conservatively excluded from
+ /// distributable LP NAV; the close calculation and available cash determine any payment. Negative accrued
+ /// VPI is backed by an account-specific reserve and recoverable on close.
+ int256 public outstandingVpiAccruedAssets;
/// @notice Account carry checkpointed but not yet physically collected, in 6-decimal settlement token units.
mapping(address => uint256) public unsettledCarryAssets;
@@ -1266,6 +1271,7 @@
pos.lastCarryTimestamp = position.lastCarryTimestamp;
pos.borrowBaseAssets = newBorrowBaseAssets;
pos.lastCarryIndex = _currentSideCarryIndex(position.side, block.timestamp, _poolAssetsForCarry());
+ outstandingVpiAccruedAssets += position.vpiAccrued - pos.vpiAccrued;
pos.vpiAccrued = position.vpiAccrued;
_applySideBorrowBaseDelta(position.side, 0, newBorrowBaseAssets);
}
@@ -1280,6 +1286,7 @@
if (pos.lots > 0 || pos.borrowBaseAssets > 0) {
_applySideBorrowBaseDelta(pos.side, pos.borrowBaseAssets, 0);
}
+ outstandingVpiAccruedAssets -= pos.vpiAccrued;
delete _positions[account];
}
--- a/packages/perps/src/CfdEngineProtocolLens.sol
+++ b/packages/perps/src/CfdEngineProtocolLens.sol
@@ -68,6 +68,7 @@
snapshot.maxLiabilityAssets, engineContract.settlementBufferBps()
);
snapshot.terminalLpPriceDeltaAssets = terminalSnapshot.terminalLpPriceDeltaAssets;
+ snapshot.outstandingVpiAccruedAssets = engineContract.outstandingVpiAccruedAssets();
snapshot.terminalNavBookVersion = terminalSnapshot.bookVersion;
snapshot.traderClaimBalanceAssets = terminalSnapshot.totalTraderClaimsAssets;
snapshot.hasOpenPositions = terminalSnapshot.hasOpenPositions;
--- a/packages/perps/src/interfaces/HousePoolEngineViewTypes.sol
+++ b/packages/perps/src/interfaces/HousePoolEngineViewTypes.sol
@@ -28,6 +28,7 @@
uint256 maxLiabilityAssets;
uint256 supplementalReservedAssets;
int256 terminalLpPriceDeltaAssets;
+ int256 outstandingVpiAccruedAssets;
uint64 terminalNavBookVersion;
uint256 traderClaimBalanceAssets;
bool hasOpenPositions;
--- a/packages/perps/src/libraries/HousePoolAccountingLib.sol
+++ b/packages/perps/src/libraries/HousePoolAccountingLib.sol
@@ -62,6 +62,15 @@
) internal pure returns (ReconcileSnapshot memory snapshot) {
uint256 terminalAssets = engineSnapshot.physicalAssets;
uint256 terminalLiabilities = engineSnapshot.traderClaimBalanceAssets;
+ int256 outstandingVpi = engineSnapshot.outstandingVpiAccruedAssets;
+ if (outstandingVpi > 0) {
+ // Positive accrued VPI represents potentially refundable value on close and is conservatively excluded
+ // from distributable LP NAV; actual payment depends on the close-time calculation.
+ terminalLiabilities += uint256(outstandingVpi);
+ } else if (outstandingVpi < 0) {
+ // Rebate already paid out is reclaimed on close from the dedicated nonwithdrawable VPI reserve.
+ terminalAssets += uint256(-(outstandingVpi + 1)) + 1;
+ }
int256 terminalDelta = engineSnapshot.terminalLpPriceDeltaAssets;
if (terminalDelta >= 0) {
terminalAssets += uint256(terminalDelta);
References
- Current Immunefi Plether Scope — impact 15, in-scope code, listed reports, known issues, and PoC requirements.
- Current Immunefi Plether Information — competition target and deployment status.
- Current Immunefi Plether Resources — source repository pinned to the commit cited above.
- Pinned HousePool reconciliation and settlement.
- Pinned HousePool terminal accounting.
- Pinned position VPI storage and position settlement updates.
- Pinned OrderRouter permissionless epoch entrypoint, TrancheVault redemption request, and redemption claim.
- Pinned negative-VPI reserve target, open and close reserve checks, partial/full-close reserve target, and reserve lock, release and consume lifecycle, and protected action-reserve floor.
- Pinned close lifetime clamp and free-cash action-rebate payment.
- Pinned initial release parameters.
- Listed scan report, finding #31; SC Audit Studio pre-audit.
- SECURITY.md VPI and LP accounting limitations, VPI limitations, and LP accounting limitations.
- ACCOUNTING_SPEC.md carry collection-time policy, anticipated VPI exclusion, and shared entry/exit NAV rules.
- WHITEPAPER.md deposit-epoch description.
Proof of Concept
Proof of Concept
Reproduction
Frozen commit: a82d4fefb02768e5b3bddcc97dee371eee24fea8. Save the code below as packages/perps/test/perps/VpiNavTimingExtraction.t.sol and run the command shown below. The inline PoC preserves all 24 tests and executable Solidity statements from the successfully tested original source. Only comments and formatting were removed to satisfy the submission character limit. The actual Foundry execution passed all 24 tests with exit code 0.
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.35;
import {BasePerpTest} from "./BasePerpTest.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {IOrderRouterAdminHost} from "@plether/perps/interfaces/IOrderRouterAdminHost.sol";
import {MockPyth} from "@plether/test-utils/MockPyth.sol";
import {console2} from "forge-std/console2.sol";
contract VpiNavExitTest is BasePerpTest {
uint256 internal constant PX=1e8;
address internal constant A=address(0xA11CE1);
address internal constant B=address(0xB0B2);
address internal constant V=address(0xD1C71);
address internal constant SLP=address(0x5E410);
address internal constant KEEPER=address(0xC001);
uint256 internal constant V_DEP=1_000_000e6;
uint256 internal constant A_DEP=3_000_000e6;
uint256 internal constant S_DEP=2_000_000e6;
uint8 int
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 terminal NAV snapshot used to price Junior redemptions includes collected VPI as distributable assets without subtracting the potentially refundable VPI still owed to open positions.
Impact
A coalition could extract about 1,047 USDG of profit while a passive Junior LP loses about 1,104 USDG, though the result depends on the fixed 1.0 mark and turns unprofitable at small skews or small price moves.
What the attacker needed
Coordinated LP and trader accounts; LP cooldown and epoch elapsed; pool has free cash for the rebate; large notional near max skew
The fix
A candidate fix adds a signed aggregate of accrued VPI over live positions to the HousePool snapshot and adjusts terminal NAV by it, treating positive VPI as a liability and negative VPI as backed by a per-account reserve.
How it was found
- A coalition LP holds Junior shares and a trader opens a large LONG, paying VPI into the pool.
- The LP requests redemption and a permissionless caller settles the matured epoch while the position is still open.
- The LP claims the redemption at the inflated NAV and exits with no remaining shares.
- The trader closes at the same mark, receives the close rebate from free pool cash, and withdraws its margin.
- The passive Junior LP later redeems and receives less than its starting share value.
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 a trader opens a position, they pay a small extra fee into the shared pool, and that cash shows up as pool value straight away. But the protocol may give part of that fee back when the trader closes, so the cash is not really the pool's to keep. The report shows that a large LP can cash out at the inflated value before the trader closes, leaving the smaller LPs to absorb the refund.
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.