Skip to content
Business logic Audit finding Advanced

Permissionless LP Settlement Resets Senior High-Water Mark and Diverts Recovery Revenue to Junior

A public LP epoch settlement function reconciles pending recapitalization buckets before processing LP requests, and a second zero-NAV redemption settlement used the residual bucket as the bootstrap target, lowering the Senior high-water mark from 1,000,453 to 500,226 USDG. A later ordinary trader loss that would have restored Senior principal instead credited Junior, giving the attacker a real vault payout of about 21,569 USDG and a queued Junior claim.

xRakan Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#99404 [SC-High] Permissionless LP Settlement Resets Senior High-Water Mark and Diverts Recovery Revenue to Junior

Submitted on Nov 13th 2026 at 14:21:58 UTC by @xRakan for Audit Competition | Plether

Description

Summary

HousePool.settleLpEpoch performs _reconcile before it processes matured LP requests. A legitimate, partial owner-funded recapitalization first leaves Senior principal at 500,226.531744 USDG, its high-water mark (HWM) at 1,000,453.063488 USDG, and a 500,226.531744 USDG recapitalization bucket still pending. An ordinary Junior LP can create a second matured, zero-NAV redemption and call the public Router settlement. That second reconciliation consumes the residual bucket without receiving or moving cash, but resets the Senior HWM to 500,226.531744 USDG.

The same ordinary losing trader then realizes 146,625.840973 USDG into the Pool. In a matched branch without the second zero-NAV settlement, that amount restores Senior principal. In the triggered branch, Senior remains at 500,226.531744 USDG and Junior is credited 125,056.632936 USDG; the attacker also receives 21,569.208037 USDG in an actual vault claim. This is a real change in ownership allocation, not just an HWM field change.

This report covers only the HWM reset and resulting Senior-to-Junior recovery diversion. unassignedAssets is zero in both branches; no deposit freeze, ownerless-asset claim, or permanent lock is asserted.

Root Cause

After each reconciliation, _decreasePendingClaimantBuckets subtracts the amount settled from pendingRecapitalizationAssets. On the first partial application the helper receives the full 1,000,453.063488 USDG intent and sets the bootstrap HWM to that amount. The remaining pending amount is then 500,226.531744 USDG. On the second pass, _getPendingClaimantBuckets returns only that residual amount. If the reconcile plan has again reduced both stored principals to zero, the library's empty-Senior bootstrap sets seniorHighWaterMark = max(residualIntent, settledAmount), replacing the higher HWM with the smaller residual target.

The public settlement path reaches this helper before any LP request is processed. The second request refunds its zero-NAV shares; the HWM change occurs in the preceding reconciliation and leaves raw Pool cash, accountedAssets, and Senior principal unchanged.

The root cause is the use of the current residual bucket as the original recapitalization recovery target across multiple partial settlements. The pinned implementation caps how much can be applied, but does not retain the original aggregate target for subsequent applications.

Pinned source excerpts

OrderRouter.settleLpEpoch(bytes[]) is an external payable entrypoint. The production Router updates the mark and calls the Pool settlement route atomically. Pinned OrderRouter.sol lines 474–484.

HousePool.settleLpEpoch checks the settlement pause, requires the Router-bound exact mark only while live positions exist, then enters _settleLpEpoch; _settleLpEpoch validates withdrawal liveness and freshness and calls _reconcile before LP processing. Pinned HousePool.sol lines 794–840.

The live reconcile reads the pending buckets, plans the waterfall, and applies the settleable amounts. The residual is subtracted after each pass. Pinned HousePool.sol lines 1555–1598 and 1759–1803.

The library passes the outstanding recap intent as the bootstrap target. On an empty Senior/Juniors waterfall it overwrites the HWM with the larger of that target and the current settled amount. Pinned HousePoolPendingPreviewLib.sol lines 40–52 and 103–128.

Governance recapitalization and degraded-mode recovery are owner-only, documented actions. The PoC performs them as setup prerequisites, separately from the attacker path. recapitalizePool transfers exact USDG from the owner and records the inflow; clearDegradedMode requires recovery of the solvency condition. Pinned CfdEngine.sol lines 632–665.

The attacker's redemption is an ordinary TrancheVault.requestRedeem from its own pre-crisis shares. The one-hour deposit cooldown and epoch maturity are enforced by production code. Pinned TrancheVault.sol lines 38–40 and 606–632.

Exact Solidity excerpts

The production Router exposes the atomic settlement entrypoint publicly:

OrderRouter.sol, pinned lines 479–484

Solidity
function settleLpEpoch(
    bytes[] calldata pythUpdateData
) external payable nonReentrant {
    pythUpdateData;
    _delegateToKeeperSidecar();
}

The Pool permits non-Router callers when there are no open positions. The settlement body then reconciles before LP processing:

HousePool.sol, pinned lines 797–820 and 829–836

Solidity
function settleLpEpoch(
    uint256 expectedMarkPrice,
    uint256 expectedPublishTime
) external override nonReentrant returns (IHousePool.LpEpochSettlementResult memory result) {
    if (lpEpochSettlementPaused) {
        revert HousePool__LpEpochSettlementPaused();
    }
    (
        HousePoolEngineViewTypes.HousePoolInputSnapshot memory accountingSnapshot,
        HousePoolEngineViewTypes.HousePoolStatusSnapshot memory statusSnapshot
    ) = _getHousePoolSnapshots();
    uint256 cutoffEpoch = block.timestamp / LP_EPOCH_DURATION;
    if (accountingSnapshot.hasOpenPositions && !statusSnapshot.oracleFrozen) {
        if (
            msg.sender != ENGINE.orderRouter() || ENGINE.lastMarkPrice() != expectedMarkPrice
                || statusSnapshot.lastMarkTime != expectedPublishTime
        ) {
            revert HousePool__Unauthorized();
        }
        if (expectedPublishTime / LP_EPOCH_DURATION < cutoffEpoch) {
            revert HousePool__MarkPriceStale();
        }
    }
    return _settleLpEpoch(accountingSnapshot, statusSnapshot, cutoffEpoch);
}

At the start of _settleLpEpoch, before LP epoch processing, the body runs these checks and reconciliation:

HousePool.sol, pinned lines 829–836

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

The pending recap target is the current pending amount. Partial settlement decreases that same amount:

HousePool.sol, pinned lines 1778–1803

Solidity
function _getPendingClaimantBuckets()
    internal
    view
    returns (HousePoolPendingPreviewLib.ClaimantPendingBuckets memory buckets)
{
    buckets.recapitalizationAssets = pendingRecapitalizationAssets;
    buckets.revenueAssets = pendingTradingRevenueAssets;
}

function _decreasePendingClaimantBuckets(
    HousePoolPendingPreviewLib.ClaimantPendingBuckets memory claimantBuckets
) internal {
    pendingRecapitalizationAssets -= claimantBuckets.recapitalizationAssets;
    pendingTradingRevenueAssets -= claimantBuckets.revenueAssets;
}

When both stored principals are zero, the recap helper assigns the current settled amount and replaces the HWM with the supplied target:

HousePoolPendingPreviewLib.sol, pinned lines 111–136

Solidity
function applyClaimantRecapitalizationIntent(
    PendingAccountingState memory state,
    uint256 amount,
    uint256 recapitalizationTargetAssets
) internal pure {
    uint256 remaining = amount;
    if (state.seniorSupply > 0) {
        if (state.waterfall.seniorPrincipal == 0 && state.waterfall.juniorPrincipal == 0) {
            state.waterfall.seniorPrincipal += remaining;
            state.waterfall.seniorHighWaterMark =
                recapitalizationTargetAssets > remaining ? recapitalizationTargetAssets : remaining;
            remaining = 0;
        } else {
            uint256 gap = state.waterfall.seniorHighWaterMark > state.waterfall.seniorPrincipal
                ? state.waterfall.seniorHighWaterMark - state.waterfall.seniorPrincipal
                : 0;
            if (gap > 0) {
                uint256 seniorAssignedAssets = remaining > gap ? gap : remaining;
                state.waterfall.seniorPrincipal += seniorAssignedAssets;
                remaining -= seniorAssignedAssets;
            }
        }
    }
    if (remaining > 0) {
        state.unassignedAssets += remaining;
    }
}

The recapitalization itself is an owner-only, exact-transfer operation. This is a governance prerequisite in the PoC, not an attacker action:

CfdEngine.sol, pinned lines 632–652

Solidity
function recapitalizePool(
    uint256 amountAssets
) external onlyOwner nonReentrant {
    if (amountAssets == 0) {
        revert CfdEngine__ZeroAmount();
    }
    if (address(pool) == address(0)) {
        revert CfdEngine__InvalidPool();
    }
    _advanceAllCarryIndexes(block.timestamp);
    uint256 balanceBefore = settlementToken.balanceOf(address(pool));
    settlementToken.safeTransferFrom(msg.sender, address(pool), amountAssets);
    uint256 balanceAfter = settlementToken.balanceOf(address(pool));
    uint256 received = balanceAfter >= balanceBefore ? balanceAfter - balanceBefore : 0;
    if (received != amountAssets) {
        revert CfdEngine__UnexpectedTransferAmount(amountAssets, received);
    }
    pool.recordClaimantInflow(
        amountAssets, IHousePool.ClaimantInflowKind.Recapitalization, IHousePool.ClaimantInflowCashMode.CashArrived
    );
    emit PoolRecapitalized(msg.sender, amountAssets);
}

Attack Path and Public Reachability

  1. Attacker acquires Junior shares before the incident. It deposits 1,000,000 USDG through the public asynchronous Junior deposit queue, settles the matured request through the production Router, and claims its shares through the vault. The PoC asserts the shares exist before any crisis trades. No victim share transfer or cooperative seller is used.
  2. External market events and ordinary trades produce an insolvency. Four separately funded trader accounts open V3 orders through OrderRouter.commitOrder(OrderV3Types.OrderRequest) and execute through executeOrder. At basket mark 2.00, paid trader outflows reduce Pool cash from 1,100,002.000000 to 44,355.050697 USDG while a 1,090,000 USDG long liability remains and degraded mode latches. At mark 0.50, the remaining positions close and record 544,581.582441 USDG of unpaid trader claims. All positions are closed before the settlement that triggers the finding.
  3. Governance performs documented recovery. The owner funds 1,000,453.063488 USDG through CfdEngine.recapitalizePool. Long claimants settle their own 544,581.582441 USDG claims. Pool cash is then 500,226.531744 USDG. Once liabilities and positions are gone, the owner clears degraded mode. These privileged actions are prerequisites, not attacker actions.
  4. First public zero-NAV settlement applies a partial recap. The attacker requests redemption of its Junior shares, waits for the one-hour epoch, and calls the public Router settlement with a fresh, validated basket mark. The redemption is refunded because Junior NAV is zero, but its matured queue item makes settlement progress. After reconciliation, Senior principal is 500,226.531744, HWM is 1,000,453.063488, and pending recap is 500,226.531744 USDG.
  5. Second public zero-NAV settlement resets the HWM. The attacker makes a second matured zero-NAV redemption and again calls the public Router. The public settlement runs _reconcile before the redemption phase. Senior principal and cash remain 500,226.531744 USDG, but HWM falls to 500,226.531744 and the pending bucket clears. The test logs the balances at this exact point.
  6. Same ordinary trader loss, matched against a control. A separately funded trader opens a 195,000-unit SHORT at 1.00 with 190,000 USDG margin, then closes at 0.25. It has no unpaid claim; the Pool gains 146,625.840973 USDG including protocol accounting charges. The control restores this same amount to Senior because its HWM remains 1,000,453.063488. The triggered branch leaves Senior at 500,226.531744 and credits Junior.
  7. Attacker claims actual proceeds. After the same cooldown and maturity, the attacker redeems its pre-crisis Junior shares through the public queue and claims 21,569.208037 USDG from the Junior vault. Remaining shares stay in the redemption queue; their 125,056.486601 USDG estimate is a quote inside Pool assets, not a second cash balance or a guaranteed payout.

Authorization and runtime gates

  • The attacker never impersonates an owner, vault, Engine, or Router. Its calls are public Junior-vault requests, public Router order/settlement calls, and its own claims. The V3 router is deployed as new OrderRouter; the BasePerpTest return type is used only at the fixture boundary, and no scalar test-adapter method is called.
  • The recapitalization and clearDegradedMode calls are made by the legitimate owner during setup. The former transfers owner-held mock USDG into the real Pool path; test-only minting provisions the owner and traders, not the Pool.
  • The crisis closes every position and settles every trader claim before the HWM-triggering settlement. degradedMode == false, hasOpenPositions == false, HousePool.paused() == false, and lpEpochSettlementPaused == false are asserted by the PoC.
  • The attacker uses the production OrderRouter.settleLpEpoch(bytes[]), which atomically refreshes the mark from the configured six-feed basket and calls HousePool.settleLpEpoch. The mark timestamp is current and the test asserts it is fresh for the matured epoch. No direct HousePool.reconcile() call is used by the attacker.
  • TrancheVault.DEPOSIT_COOLDOWN is one hour, and HousePool.LP_EPOCH_DURATION is one hour. The PoC calls requestRedeem, waits through pool.lpEpochStart, and the zero-NAV request is processed/refunded. It therefore makes progress and does not revert with HousePool__NoLpEpochProgress; that revert only occurs when no redemption/deposit epoch progresses. Pinned HousePool.sol lines 1179–1189 and TrancheVault.sol lines 1431–1443.
  • Pyth is modeled locally with MockPyth and the release feed IDs, weights, bases, and inversions. The PoC does not claim the attacker can publish or manipulate real Pyth prices. In deployment, a public caller needs a valid current Pyth update and must pay its update fee; the mock fee and gas cost are not monetized here.

Measured Impact and Matched Control

All amounts below are USDG. Pool and accounting amounts are in 6-decimal token units; the PoC logs raw values as integers.

Final measure Triggered branch Matched control
Senior principal 500,226.531744 646,852.372717
Senior HWM 500,226.531744 1,000,453.063488
Junior principal 125,056.632936 0
Pool totalAssets 625,283.164680 646,852.372717
Pool raw USDG balance 625,283.164680 646,852.372717
Pool accountedAssets 625,283.164680 646,852.372717
unassignedAssets / trader claims / pending recap / pending revenue 0 / 0 / 0 / 0 0 / 0 / 0 / 0
Senior share quote 500,226.531739 646,852.372711
Junior share quote 125,056.632936 0
Attacker's actual USDG payout 21,569.208037 0
Attacker's remaining queued shares, quoted 125,056.486601 0
Junior vault escrow cash 0 0

Senior's measured principal is lower by 146,625.840973 USDG, exactly the sum of the triggered branch's 125,056.632936 Junior principal and the 21,569.208037 USDG actually paid to the attacker. The attack branch's total is conserved: 625,283.164680 Pool + 21,569.208037 attacker wallet = 646,852.372717, which equals the control Pool balance. The remaining queued share quote is already represented inside the Pool and is not added again. accountedAssets equals raw Pool token custody in both branches; the control and attack also end with identical clearinghouse custody, trader balances, token supply, no open positions, and no unpaid trader claims.

The attacker's cost basis is the full 1,000,000 USDG deposited before the crisis. It has no trading position and pays no LP fee in this non-frozen path. The local MockPyth charges no update fee; live Pyth fees and gas are not estimated. The triggered branch's actual payout plus quoted queued shares is 146,625.694638 USDG, so the attacker remains down 853,374.305362 USDG against its original cost basis. This report does not claim net attacker profit. Relative to the otherwise identical control, the attacker's shares are worth zero and it receives no payout; the triggered branch gives it a 21,569.208037 USDG transfer and a pending Junior redemption quote. The remainder of the 146,625.840973 USDG Junior claim is represented by seed shares/rounding and is not counted as attacker cash.

The adverse impact is the demonstrated loss of Senior's recovery priority and the real Junior allocation/payout, not a cash deficit, accounting imbalance, deposit freeze, or permanent freeze of a claimant.

Mitigation

Retain the original aggregate owner-funded recapitalization target while any portion of that recap remains pending. Increment the stored target when a new recap is recorded, pass it to both pending-state preview and live application, and clear it only after the recap bucket reaches zero. The existing partial-settlement cap remains in place. This preserves intended fresh-wipeout recap behavior and prevents a later residual replay from lowering the HWM.

The following complete diff was applied only in the separate mitigation checkout; production code in the pinned reproduction remained unchanged:

Diff
diff --git a/packages/perps/src/HousePool.sol b/packages/perps/src/HousePool.sol
index fceb093d..c9cb2d72 100644
--- a/packages/perps/src/HousePool.sol
+++ b/packages/perps/src/HousePool.sol
@@ -157,6 +157,9 @@ contract HousePool is IHousePool, IPerpsLPActions, Ownable2Step, Pausable, Reent
     uint256 public unassignedAssets;
     /// @notice Unsettled claimant recapitalization intent reserved from withdrawals (6-decimal settlement token).
     uint256 public pendingRecapitalizationAssets;
+    /// @dev Original aggregate recapitalization target retained while any portion remains pending.
+    ///      A residual bucket alone is not the original Senior recovery target after partial settlement.
+    uint256 internal pendingRecapitalizationTargetAssets;
     /// @notice Unsettled claimant trading revenue reserved from withdrawals (6-decimal settlement token).
     uint256 public pendingTradingRevenueAssets;
     /// @notice Accepted senior delayed-deposit assets not yet cancelled or finalized (6-decimal settlement token).
@@ -1670,7 +1673,11 @@ contract HousePool is IHousePool, IPerpsLPActions, Ownable2Step, Pausable, Reent
         }
 
         HousePoolPendingPreviewLib.applyPendingClaimantBucketsPreview(
-            pendingState, settleableClaimantBuckets, claimantBuckets, allowRevenueContinuation
+            pendingState,
+            settleableClaimantBuckets,
+            claimantBuckets,
+            allowRevenueContinuation,
+            pendingRecapitalizationTargetAssets
         );
     }
 
@@ -1767,7 +1774,11 @@ contract HousePool is IHousePool, IPerpsLPActions, Ownable2Step, Pausable, Reent
 
         HousePoolPendingPreviewLib.PendingAccountingState memory state = _currentPendingAccountingState();
         HousePoolPendingPreviewLib.applyPendingClaimantBucketsPreview(
-            state, settleableClaimantBuckets, claimantBuckets, allowRevenueContinuation
+            state,
+            settleableClaimantBuckets,
+            claimantBuckets,
+            allowRevenueContinuation,
+            pendingRecapitalizationTargetAssets
         );
         _decreasePendingClaimantBuckets(settleableClaimantBuckets);
 
@@ -1789,6 +1800,9 @@ contract HousePool is IHousePool, IPerpsLPActions, Ownable2Step, Pausable, Reent
     ) internal {
         pendingRecapitalizationAssets -= claimantBuckets.recapitalizationAssets;
         pendingTradingRevenueAssets -= claimantBuckets.revenueAssets;
+        if (pendingRecapitalizationAssets == 0) {
+            pendingRecapitalizationTargetAssets = 0;
+        }
     }
 
     function _recordPendingClaimantInflow(
@@ -1797,6 +1811,7 @@ contract HousePool is IHousePool, IPerpsLPActions, Ownable2Step, Pausable, Reent
     ) internal {
         if (kind == IHousePool.ClaimantInflowKind.Recapitalization) {
             pendingRecapitalizationAssets += amount;
+            pendingRecapitalizationTargetAssets += amount;
         } else {
             pendingTradingRevenueAssets += amount;
         }
diff --git a/packages/perps/src/libraries/HousePoolPendingPreviewLib.sol b/packages/perps/src/libraries/HousePoolPendingPreviewLib.sol
index ce85967b..e06ffbce 100644
--- a/packages/perps/src/libraries/HousePoolPendingPreviewLib.sol
+++ b/packages/perps/src/libraries/HousePoolPendingPreviewLib.sol
@@ -35,17 +35,19 @@ library HousePoolPendingPreviewLib {
     ///      place; it does not decrement either input bucket.
     /// @param state In-memory accounting state to update.
     /// @param claimantBuckets Settleable recapitalization and revenue amounts to apply.
-    /// @param claimantIntentBuckets Full outstanding intent used to establish the recapitalization bootstrap target.
+    /// @param claimantIntentBuckets Full outstanding intent used to establish the recapitalization bootstrap path.
     /// @param allowRevenueContinuation Whether revenue may be routed into already-claimed waterfall equity.
+    /// @param recapitalizationTargetAssets Original aggregate owner-funded recap intent retained across partial settlement.
     function applyPendingClaimantBucketsPreview(
         PendingAccountingState memory state,
         ClaimantPendingBuckets memory claimantBuckets,
         ClaimantPendingBuckets memory claimantIntentBuckets,
-        bool allowRevenueContinuation
+        bool allowRevenueContinuation,
+        uint256 recapitalizationTargetAssets
     ) internal pure {
         if (claimantBuckets.recapitalizationAssets > 0) {
             applyClaimantRecapitalizationIntent(
-                state, claimantBuckets.recapitalizationAssets, claimantIntentBuckets.recapitalizationAssets
+                state, claimantBuckets.recapitalizationAssets, recapitalizationTargetAssets
             );
             // Recapitalization can restore a claimant path for revenue in this same batch.
             allowRevenueContinuation =
@@ -117,6 +119,8 @@ library HousePoolPendingPreviewLib {
         if (state.seniorSupply > 0) {
             if (state.waterfall.seniorPrincipal == 0 && state.waterfall.juniorPrincipal == 0) {
                 state.waterfall.seniorPrincipal += remaining;
+                // Keep the original aggregate target while a recap settles in slices; the remaining bucket is not
+                // the target for a later empty-Senior bootstrap.
                 state.waterfall.seniorHighWaterMark =
                     recapitalizationTargetAssets > remaining ? recapitalizationTargetAssets : remaining;
                 remaining = 0;

References

Proof of Concept

Proof of Concept

Full Inline Foundry PoC

Save this complete file as poc/SeniorHwmRecoveryDiversionPoC.t.sol in the clean checkout and use the commands above.

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

import {BasePerpTest} from "../packages/perps/test/perps/BasePerpTest.sol";
import {CfdOrderPolicyEvaluator} from "@plether/perps/CfdOrderPolicyEvaluator.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {PletherOracle} from "@plether/perps/PletherOracle.sol";
import {OrderLifecycleBook} from "@plether/perps/OrderLifecycleBook.sol";
import {OrderRouter} from "@plether/perps/OrderRouter.sol";
import {OrderRouterExecutionSidecar} from "@plether/perps/OrderRouterExecutionSidecar.sol";
import {OrderRouterLiquidationBatchSidecar} from "@plether/perps/OrderRouterLiquidationBatchSidecar.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {OrderRouterAdmin} from "@plether/perps/OrderRouterAdmin.sol";
import {IHousePool} from "@plether/perps/interfaces/IHousePool.sol";
import {IOrderRouterAdminHost} from "@plether/perps/interfaces/IOrderRouterAdminHost.sol";
import {ICfdEngineTypes} from "@plether/perps/interfaces/ICfdEngineTypes.sol";
import {LegacyOrderRouterHarness} from "../packages/perps/test/utils/LegacyOrderRouterHarness.sol";
import {MockPyth} from "@plether/test-utils/MockPyth.sol";

contract SeniorHwmRecoveryDiversionPoCTest is BasePerpTest {
    address internal constant ATTACKER = address(0xA7701);
    address internal constant LONG_A = address(0xA1001);
    address internal constant LONG_B = address(0xA1002);
    address internal constant SHORT_A = address(0xB1001);
    address internal constant SHORT_B = address(0xB1002);
    address internal constant LOSS_TRADER = address(0xC1001);
    address internal constant KEEPER = address(0xD1001);

    OrderRouter internal productionRouter;
    PletherOracle internal releaseOracle;

    struct Outcome {
        uint256 senior;
        uint256 seniorHwm;
        uint256 junior;
        uint256 pendingRecap;
        uint256 pendingRevenue;
        uint256 unassigned;
        uint256 poolAssets;
        uint256 poolTokenBalance;
        uint256 juniorEscrowAssets;
        uint256 juniorEscrowShares;
        uint256 seniorEscrowAssets;
        uint256 seniorShareQuote;
  

The original report as published on Immunefi, by xRakan. 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 code uses the current residual recapitalization bucket as the original recovery target on each partial settlement, so a second settlement overwrites the Senior high-water mark with the smaller residual amount.

Impact

Senior's recovery priority is lost and about 146,625 USDG of principal is diverted to Junior, of which the attacker actually receives about 21,569 USDG; the report does not claim net attacker profit and notes live Pyth fees and gas are not counted.

What the attacker needed

Owner recapitalizes and clears degraded mode; attacker holds Junior shares pre-crisis; one-hour epoch wait per settlement; valid fresh Pyth update and fee

The fix

The report proposes retaining the original aggregate recapitalization target while any portion remains pending and clearing it only when the bucket reaches zero; a diff was applied only in a separate mitigation checkout, not to production code.

How it was found

  1. Attacker deposits into the Junior vault and claims shares before any crisis.
  2. Ordinary trades and market moves make the pool insolvent and degraded mode latches.
  3. The owner recapitalizes the pool and clears degraded mode as setup.
  4. Attacker requests a zero-NAV Junior redemption and calls the public Router settlement, applying a partial recap.
  5. Attacker makes a second matured zero-NAV redemption and settles again, resetting the Senior high-water mark.
  6. A separate trader's loss is then credited to Junior, and the attacker redeems and claims a payout.

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 splits money between a safer 'Senior' group and a riskier 'Junior' group. The Senior group is meant to be repaid first, and a high-water mark records the level it must climb back to before profits are shared. Here a public settlement call used only the leftover part of a rescue payment as the new target, so the Senior group's recovery level was quietly lowered and later losses were handed to Junior instead.

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 xRakan

View all

3 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.