Incomplete MED-12 fix: after partial Senior impairment, later LP revenue displaces the owner's recapitalization into unassignedAssets
After a partial impairment of the Senior tranche, LP revenue that reaches the pool before the next settlement is treated as ordinary surplus and fills the Senior gap first, so the owner's pending recapitalization is displaced into ownerless unassignedAssets. This leaves Junior LPs short by the displaced amount, blocks new deposits, and removes first-loss protection until the owner reassigns the funds.
Originally disclosed on Immunefi
- Disclosed after under an hour
#97968 [SC-High] Incomplete MED-12 fix: after partial Senior impairment, later LP revenue displaces the owner's recapitalization into unassignedAssets
Submitted on Nov 4th 2026 at 05:37:42 UTC by @tinnohofficial for Audit Competition | Plether
- Report ID: #97968
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/HousePool.sol
- Impacts:
- Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
- Permanent freezing of unclaimed yield
Description
Brief/Intro
CfdEngine.recapitalizePool() is the documented, non-dilutive owner recovery action for an impaired Senior tranche (it was added to fix LOW-22). It transfers USDG into HousePool immediately but only queues the allocation in pendingRecapitalizationAssets until the next reconciliation. When Senior is partially impaired (0 < seniorPrincipal S < seniorHighWaterMark H, juniorPrincipal J = 0, Junior shares outstanding), LP revenue that reaches the pool before the next LP settlement is not queued: recordClaimantInflow() queues revenue only when S + J == 0, so it is ordinary surplus. The next reconciliation spends that later revenue on the Senior gap first (planReconcile() → distributeRevenue()) and only then applies the pending recapitalization. The recapitalization now finds less gap, and the remainder is booked as ownerless unassignedAssets.
For a recapitalized gap G and later revenue T:
a settlement runs between the two inflows : S = H, J = T, unassignedAssets = 0
the revenue reaches the pool first : S = H, J = T - min(G, T), unassignedAssets = min(G, T)
Junior receives min(G, T) less, and the same amount of the owner's recapitalization becomes ownerless. While that bucket is nonzero, new deposit requests in both tranches and deposit activation are blocked. The bucket absorbs losses only after both tranches, and only the owner can release it, by minting new shares to one receiver. Which outcome occurs depends only on whether a permissionless keeper calls settleLpEpoch() before or after the revenue-producing execution.
The strongest reasons this is not intended:
- In the pool's own canonical view, a claimant revenue inflow is what creates the ownerless assets. Right after
recapitalizePool(G),getPendingTrancheState()(the projectionTrancheVault.totalAssets()uses for share pricing) reports Senior at its high-water mark and Junior at 0, and, with a fresh mark,canSettleDepositEntries()returnstrueagain. When LP revenueTthen arrives, the same views leave Senior unchanged, credit Junior with onlyT - min(G, T), andcanSettleDepositEntries()returnsfalse, because the projection now containsmin(G, T)of ownerless assets. ACCOUNTING_SPEC sends tounassignedAssetsonly "revenue with no eligible share owner" and "value with no safe claimant path". Here Junior shares exist and the pool itself reports Senior whole. - LP ownership becomes a function of settlement timing. The protocol treats settlement timing chosen by a permissionless caller as an attack surface: a settlement that advances no queue item reverts ("This prevents per-block no-op checkpoint grief"), and the residual SECURITY.md discloses as "execution-frequency dependent" is "sub-micro-USDG rounding". Here the order of two progress-making permissionless calls moves
min(G, T). - The documented recovery action becomes a no-op for Junior. With revenue first, Junior ends exactly where it would be had the owner never recapitalized (
J = T - min(G, T)in both cases, proven by a counterfactual test). WhenT > G, no claimant gains anything from the recapitalization: all of it is ownerless, and the only way to deploy it is the share-minting bootstrap assignment that LOW-22 listed among the "economically different" alternatives. - The project's own MED-12 regression codifies the opposite outcome. It asserts "Recapitalization restores senior first; same-batch revenue then belongs to surviving junior owners" and "mixed recovery must not block projected deposit settlement". With
0 < S < H, both properties fail.
The waterfall order in ACCOUNTING_SPEC (ordinary surplus in step 4 before pending buckets in step 5) and the whitepaper sentence "Revenue restores impaired senior principal to its high-water mark before junior participates" produce this result mechanically. The section Specification conflict below quotes them and explains why they do not decide this case.
The proof of concept changes protocol state only through public entrypoints: vault requests and claims; the inherited, unmodified V3 OrderRouter.commitOrder(OrderRequest) and executeOrder; permissionless OrderRouter.settleLpEpoch and updateMarkPrice; and the owner's documented recapitalizePool and assignUnassignedAssets. It runs on the repository's BasePerpTest suite, which uses MockPyth, MockSettlementToken and its LegacyOrderRouterHarness; only the harness's inherited V3 and keeper paths are called. The test asserts the DEPLOYMENT.md release parameters, including the $1,000 minimum open notional, the 2,500-bps adverse-confidence multiplier and the 40,000,000 USDG / 80% Senior limits, all finalized through the owner timelocks. The one remaining difference is the suite's two-feed equal-weight basket; the effect depends only on the aggregate mark. Ten tests, including a 256-run fuzz, pass against unmodified code at commit a82d4fefb02768e5b3bddcc97dee371eee24fea8:
| Scenario (~1M USDG pool) | Revenue reaches the pool before the next settlement | Settlement runs first (control) |
|---|---|---|
1.0% shock: gap G = 1,797.998603, later revenue T = 420.79 |
Junior 0; unassigned 420.790409 (= T); all deposits closed |
Junior 421.211619; unassigned 0; Junior deposits open |
0.2% shock: G = 199.600202, T = 563.64 |
Junior 364.044744; unassigned 199.600202 (= G, the whole recapitalization); all deposits closed |
Junior 564.210060; unassigned 0; Junior deposits open |
T differs by about 0.1% between the columns because the control funds a 1,000 USDG Senior exit before the trade, which slightly changes VPI depth. Each column is asserted against its own measured T.
Why this is an incomplete fix of MED-12 (and of LOW-22)
The Cecuro report lists MED-12, "Mixed recovery inflows can strand LP revenue in ownerless pool assets":
Already-funded LP revenue can lose its claimant path during wipeout recovery and get parked in unassignedAssets even when seeded LP ownership still exists. [...] That 15,000 USDC is then excluded from normal LP ownership, blocks new tranche deposits, and can reach LPs only through the owner-only assignUnassignedAssets() path. This contradicts the protocol's own claimant-continuity rule that value should use seeded ownership paths when available and only truly ownerless value should enter unassignedAssets.
Its stated impact: "LP-owned revenue is misclassified as ownerless cash. The funds stop following normal senior/junior ownership, new deposits remain blocked because unassignedAssets > 0, and recovering the value requires an owner-only reassignment that can arbitrarily choose the receiver."
The team's resolution:
MED-12 — Addressed. The shared pending-accounting helper recomputes revenue continuation after applying recapitalization. When recapitalization restores principal and LP shares survive, revenue in the same batch follows the restored claimant ownership instead of being quarantined as unassigned. The reported 40,000 USDC recapitalization plus 15,000 USDC revenue case now produces senior principal of 40,000, junior principal of 15,000, and zero unassigned assets. Preview and live reconciliation use the same helper. Recapitalization remains senior-first; partial-settlement residuals stay reserved, and surplus without eligible owners remains unassigned.
The fix lives entirely in HousePoolPendingPreviewLib.applyPendingClaimantBucketsPreview(), which recomputes allowRevenueContinuation after the recapitalization. That helper only sees revenue recorded in pendingTradingRevenueAssets, and HousePool.recordClaimantInflow() records revenue there only when seniorPrincipal + juniorPrincipal == 0:
if (kind == IHousePool.ClaimantInflowKind.Recapitalization) {
_recordPendingClaimantInflow(kind, amount);
} else if (seniorPrincipal + juniorPrincipal == 0) { // revenue is pending only after a total wipe
_recordPendingClaimantInflow(kind, amount);
}
After a partial impairment the recapitalization is pending but the later revenue is not, so the revenue never reaches the fixed helper. It is consumed by the ordinary plan before the helper runs, and the MED-12 impact reappears: value that the surviving Junior shares would otherwise own lands in unassignedAssets, deposits are blocked, and recovery requires the owner-only reassignment. The diagnostic test test_DiagnosticPendingHelperGivesTheSameTwoAmountsToJunior applies the fixed helper to the same two amounts (as if the revenue had been queued, as it is after a total wipe): it yields Junior = 563.644946, unassigned = 0, while the live reconciliation of the same state yields Junior = 364.044744, unassigned = 199.600202.
LOW-22 ("Governance cannot use the documented non-dilutive recapitalization path") was fixed by adding recapitalizePool(). Its stated impact was that "the only in-scope alternatives are economically different actions such as dilutive seeding or bootstrap assignment". In the T > G case above, the recapitalization leaves every claimant's principal at the no-recapitalization value (Senior whole, Junior T - G) and turns all of the owner's cash into unassignedAssets. The only way to deliver that cash to LPs is assignUnassignedAssets(), the bootstrap assignment LOW-22 described as economically different.
Vulnerability Details
Preconditions
-
Senior is partially impaired:
0 < S < HandJ = 0, with Junior shares outstanding. Outside owner bootstrap assignments,S < HimpliesJ = 0: losses are charged to Junior before Senior, revenue restores the Senior gap before it reaches Junior, and deposit activation is blocked while Senior is impaired. Junior shares always survive because the seed shares are permanent. This is the staterecapitalizePool()exists to repair, and the project's owntest_RecapitalizePool_RestoresSeniorWithoutMintingSharesuses it (S = 60,000,H = 100,000,J = 0, both seed supplies alive). -
The owner recapitalizes the observed gap through
CfdEngine.recapitalizePool(G), a documented, immediate, trusted recovery action. No owner error is involved. -
Some LP revenue or favourable mark move reaches the pool before the next progress-making LP settlement. This is readily reachable:
recapitalizePool()only queues the amount, and the protocol exposes no recap-and-reconcile entrypoint;HousePool.reconcile()is vault-only, and no vault calls it;settleLpEpoch()reverts withHousePool__NoLpEpochProgressunless a matured LP request exists, and LP epochs are hourly with a five-minute cutoff;- the owner's other reconciling paths are timelocked (
finalizePoolConfigwith a rate change), one-time (initializeSeedPosition), or revert when nothing is unassigned (assignUnassignedAssets); recapitalizePool()is documented to remain available "with stale marks, frozen markets, and LP pause or settlement holds", including conditions in which no LP settlement can run.
Qualifying inflows include VPI on any skew-increasing open, the LP share of liquidation charges, collected carry, frozen-close spreads, and any mark move in the LPs' favour. In addition, any keeper can deliberately execute a third party's revenue-producing order before
settleLpEpoch()in the same block, at the cost of gas only.
How the first condition arises: Senior can only be impaired after Junior is exhausted. Senior admission at the release 80% share cap requires Junior to be at least 20% of protected capital, and the Junior covenant stops funding Junior redemptions that would take Junior below a quarter of protected Senior exposure. With the 40% opening skew cap, a mark-to-market loss alone would need a roughly 50% basket move to wipe a full 20% Junior. Senior impairment therefore follows a period in which cumulative trader gains and/or the Junior-funded coupon have thinned Junior (an 8% coupon on Senior costs 32% of initial Junior capital per year at the cap). The PoC compresses a 1,188-day (about 3.25-year) low-revenue period, then applies a 0.2% or 1.0% move to a SHORT of 20% of depth. Any path that exhausts Junior leads to the same state.
Root cause
HousePool.recordClaimantInflow()always queuesRecapitalizationbut queuesRevenueonly whenseniorPrincipal + juniorPrincipal == 0(HousePool.sol L644-L648). WithS > 0, later revenue is just an increase in distributable equity.HousePool._reconcile()reserves the settleable pending recapitalization and callsHousePoolReconcilePlanLib.planReconcile()before applying the pending buckets (HousePool.sol L1564-L1598).planReconcile()subtracts the pending recapitalization from distributable value, finds the later revenue as ordinary surplus and distributes it Senior-gap-first throughdistributeRevenue()(HousePoolReconcilePlanLib.sol L68-L99). The revenue fillsmin(G, T)of the gap, measured on stored principal that does not yet include the recapitalization.- Only then does
_applyPendingClaimantBucketsLive()callapplyClaimantRecapitalizationIntent(). It sees a remaining gap ofG - min(G, T), restores that much and books the rest of the recapitalization, exactlymin(G, T), asunassignedAssets, because "recapitalization never accrues to junior principal" (HousePoolPendingPreviewLib.sol L103-L137).
Total value is unchanged; only its owner changes. The preview path (_previewPendingAccountingState, used by getPendingTrancheState() and therefore by TrancheVault.totalAssets()) runs the same sequence, so the vaults report the displacement as soon as the later revenue arrives.
Specification conflict
The texts that support the observed result:
- ACCOUNTING_SPEC L335-L340: "2. Compare terminal equity, excluding reserved pending claimant inflows and
unassignedAssets, with total principal. [...] 4. Route surplus first to restore Senior principal to its high-water mark, then to Junior. 5. Route pending recapitalization and trading-revenue buckets according to their explicit ownership intent, described below. Reserving them in step 2 prevents counting the same inflow twice." - WHITEPAPER §4.5: "Revenue restores impaired senior principal to its high-water mark before junior participates."
- LOW-22 response: "Allocation is deferred to normal reconciliation under existing senior-recovery priority; residual value without a claimant path remains unassigned."
test_RecapitalizePool_RestoresSeniorWithoutMintingSharesbooks a 50,000 recapitalization of a 40,000 gap as 10,000 ofunassignedAssetswhile Junior shares exist. A recapitalization that exceeds the gap when it is funded is intended to stay unassigned.
Why they do not decide this case:
- The step order is a processing rule, not an ownership rule. Its stated purpose is double-count prevention ("Reserving them in step 2 prevents counting the same inflow twice"). Ownership is assigned elsewhere: "source semantics decide the owner of the inflow" (L647), a recapitalization is "intended to restore waterfall claimants" (L634), and the pending recapitalization bucket holds "assets intended to restore senior principal, then remain unassigned", i.e. only what is left after the gap is restored is unassigned. No text says that revenue earned after a funded recapitalization takes over the recapitalization's role. The
_reconcile()comment "Nonpending equity can restore seeded LP principal before the queued revenue is routed" shows that the stage-order interaction was handled for queued revenue, but not for the queued recapitalization. - The whitepaper rule presupposes an impaired Senior. When
Tarrives, the pool's canonical projection already reports Senior at its high-water mark. Applied to the state the protocol publishes and prices shares at, the rule sendsTto Junior. The code applies it instead to stored principal that has not yet absorbed the earlier recapitalization. - The recapitalization here is neither excess nor "residual value without a claimant path". It equals the gap that existed when it was funded and becomes excess only because a later inflow is counted first. The project test covers a recapitalization that is oversized at funding. Here the outcome of an exactly sized one depends on whether a keeper settled in between.
- The reading that makes the code correct also makes ownership depend on call order, which the protocol forbids elsewhere. A no-progress settlement reverts so that "its reconcile and carry checkpoints cannot be retained by a permissionless no-op caller" (ACCOUNTING_SPEC L303-L304). SECURITY.md L908-L911 adds "This prevents per-block no-op checkpoint grief" and names "sub-micro-USDG rounding" as the residual that "remains execution-frequency dependent". The WHITEPAPER (L704-L706) says it "prevents permissionless no-op calls from changing time-based accounting". Under the step-order reading, two progress-making permissionless calls in either order allocate up to
Gdifferently. - The same two inflow types get the opposite priority after a total wipe. With
S = J = 0the revenue is queued, and the MED-12-fixed helper applies its documented rule "Recapitalization is always processed before revenue" (HousePoolPendingPreviewLibNatSpec;capClaimantBuckets()likewise caps "with recapitalization taking priority over revenue"). The regression's result isJ = T,unassignedAssets = 0. These statements are scoped to pending buckets, but they record the designers' choice for these two inflow types. Nothing in the documentation explains why a partial impairment should reverse it. - The result breaks the explicit ownership rules. These are: "only value with no safe claimant path belongs in
unassignedAssets", "unassignedAssetsshould be exceptional telemetry, not a normal operating bucket", "claimant continuity should prefer seeded ownership paths when available" (L647-L652), and "seeded ownership continuity is preferred over governance re-assignment" (L327).
The specification is therefore inconsistent for this sequence. Only the chronological allocation satisfies the ownership rules, the canonical projection, the MED-12 regression and the timing neutrality the protocol enforces elsewhere.
Step-by-step reproduction (public entrypoints only)
- A pool funded at the release Senior share cap (200,000 USDG Junior, 800,000 USDG Senior, 1 USDG seeds) goes through a low-revenue period. The Junior-funded 8% Senior coupon exhausts Junior principal. Junior shares survive, and Senior stays whole.
- A trader holds a SHORT of 20% of pool depth. A 0.2% or 1.0% adverse basket move creates a loss larger than the remaining Junior principal, so a keeper's
settleLpEpoch()persists0 < S < H,J = 0. - The owner calls
recapitalizePool(G)withG = H - S.getPendingTrancheState()now reports Senior atH, and with a fresh markcanSettleDepositEntries()returnstrue. - An LP has an ordinary matured request (the PoC uses a 1,000 USDG Senior exit), so anyone can settle.
- Revenue first: another trader's skew-increasing SHORT is executed through the Router (VPI revenue
T).canSettleDepositEntries()flips tofalse. A keeper then callssettleLpEpoch(). Result:unassignedAssets = min(G, T)andjuniorPrincipal = T - min(G, T). - Control: the keeper calls
settleLpEpoch()first, then the same trade executes, then the next epoch is settled. Result:unassignedAssets = 0andjuniorPrincipal = T.
Recommendation
Apply the recapitalization to the Senior gap that existed when it was funded, before ordinary surplus is distributed, in both live and preview reconciliation:
// HousePool._reconcile() and _previewPendingAccountingState():
// 1. coupon checkpoint (unchanged)
// 2. apply the settleable recapitalization to the waterfall (restore Senior up to HWM; genuine excess -> unassigned)
// 3. planReconcile() with only pending *revenue* reserved, so ordinary surplus flows Senior-gap-first against the
// already-restored Senior, i.e. to Junior
// 4. apply pending revenue with continuation recomputed (existing MED-12 logic)
Losses stay order-independent: a loss applied after the recapitalization gives the same final state as today. Only gains change owner, back to the chronological result, and genuinely oversized recapitalizations still go to unassignedAssets. A narrower mitigation for recorded inflows is to queue Revenue whenever a recapitalization is pending (seniorPrincipal + juniorPrincipal == 0 || pendingRecapitalizationAssets != 0), so that the MED-12 helper sees both. That alone does not cover mark-to-market gains. Add a regression for 0 < S < H, J = 0, recapitalization G, then revenue T before settlement (T < G, T = G, T > G), expecting unassignedAssets == 0, juniorPrincipal == T and canSettleDepositEntries() == true.
Impact Details
All figures come from the attached PoC on a ~1M USDG pool. The core displacement is exactly min(G, T) (asserted over 256 fuzz runs), so it scales with the Senior gap and with the revenue or favourable mark move that accrues before reconciliation. The concrete figures are scenario-specific because of six-decimal rounding, the fixed seeds, the fixed 1,000 USDG exit and VPI depth.
- Junior LPs lose revenue that the control ordering gives them.
T < G: Junior principal stays 0 although Junior earned 420.790409.unassignedAssetsrises by the same amount; in the control Junior receives 421.211619.T > G: Junior principal is 364.044744 versus 564.210060 in the control, and the entire 199.600202 recapitalization is ownerless.- With no later trade, a favourable 0.25-percentage-point basket retracement worth 500 USDG to LPs gives the same result: Junior 0, unassigned 500.
- The recovery action does nothing for Junior. With revenue first, Junior's result equals the no-recapitalization counterfactual. For
T > G: 364.044744 with the recapitalization versus 364.157451 without it (the 0.11 difference is the VPI effect of the extra pool depth). Senior is whole in both, and 199.600202 of owner cash sits ownerless. - Deposits close.
unassignedAssets > 0makesHousePoolTrancheGateLib.trancheDepositsAllowed()false.maxRequestDeposit()returns 0 for both vaults andcanSettleDepositEntries()stays false until the owner intervenes, although the recapitalization had reopened the projected gate. In the control, Junior deposits reopen as soon as the revenue is reconciled. In theT < Gregime Junior is also reported as terminally wiped (totalSupply > 0,totalAssets == 0) although it earned the revenue. - Senior loses first-loss protection.
planReconcile()capsunassignedAssetsonly by total distributable value, so later losses hit Junior, then Senior, before ownerless value. After a further 0.12% adverse move, Senior is impaired again by 122.031116 USDG while 199.600202 USDG sits untouched inunassignedAssets. In the control, Junior absorbs the same loss and keeps 87.114152. - The built-in cure does not automatically restore incumbent holders.
assignUnassignedAssets()is owner-only and mints new shares for one receiver at the current price. In the PoC the incumbent Junior LP's value is unchanged by the assignment (364.042925 before, 364.040397 after, one second of coupon), and the receiver obtains 199.600201. When Junior principal is zero (T < G), Senior assignment reverts for lack of capacity, and the Junior assignment mints at the wiped price: the receiver obtains essentially the whole Junior tranche, and the incumbent keeps 2 parts per billion of all future Junior distributions. Restoring incumbents pro rata requires governance to pick them as receivers or to distribute off-protocol. Without assignment, later ordinary gains do not clear the bucket, so new deposit requests and activation stay blocked while it persists.
Severity: High (Permanent freezing of unclaimed yield). The displaced amount is yield that belongs to the surviving Junior holders under the chronological allocation and under the pool's own canonical view when it arrives. After reconciliation it sits in unassignedAssets, from which no LP can redeem or claim. No permissionless or automatic mechanism returns it to them: later revenue does not clear the bucket, and the only release is an owner-only mint of new shares to a single receiver, which does not restore incumbents pro rata. Triggering it costs nothing. It happens whenever revenue reaches the pool before the next settlement, and any keeper can force it at gas cost by executing a third party's revenue-producing order before settleLpEpoch(). The damage is hundreds of USDG per event on a 1M pool and grows with the gap and the revenue. The same events also remove Senior's first-loss cushion and close both tranches to deposits. Value is not destroyed, and governance can compensate incumbents deliberately. The claim is that the protocol's own accounting removes this yield from its owners' claim path.
Why this is not a known issue
- MED-12's fix and regression cover only revenue in the pending bucket (total wipe). LOW-22's comment describes deferral "under existing senior-recovery priority" and leaves "residual value without a claimant path" unassigned. The value displaced here has a claimant path and is not residual (see Specification conflict).
- SECURITY.md "LP accounting limitations" and "LP claim and allocation limitations" do not mention it, and no other public report covers it. MED-11, MED-24 and MED-29 are not involved. The PoC uses an ordinary funded Senior exit only as settlement queue work. The displacement is fixed by the reconciliation that
_settleLpEpoch()runs before it processes any queue item, so the type of matured request is irrelevant.
References
HousePool.recordClaimantInflow(): revenue queued only when both principals are zeroHousePool._reconcile(): ordinary plan before pending bucketsHousePool._applyPendingClaimantBucketsLive()HousePool.canSettleDepositEntries()and_projectedEntriesMaySettle()HousePoolReconcilePlanLib.planReconcile(): pending reserved, surplus Senior-gap-first, unassigned capped only by distributableHousePoolPendingPreviewLib: "Recapitalization is always processed before revenue" and the MED-12 continuation fixHousePoolPendingPreviewLib.applyClaimantRecapitalizationIntent(): remainder to unassignedHousePoolTrancheGateLib.trancheDepositsAllowed()HousePool.assignUnassignedAssets()CfdEngine.recapitalizePool()TrancheVault.totalAssets()uses the reconcile-first projection- ACCOUNTING_SPEC: no-op settlement rule, required consequences and waterfall steps
- ACCOUNTING_SPEC: ownership routing for pool inflows
- SECURITY.md: owner-funded recapitalization
- [SECURITY.md: no-op checkpoint grief and execution-frequency dependence](https://github.com/immunefi-tea
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 reconciliation plan distributes ordinary surplus against stored principal before the pending recapitalization is applied, and revenue is only queued when both tranche principals are zero, so the MED-12 continuation helper never sees the later revenue.
Impact
Junior LPs could lose up to the recapitalized gap in revenue, the owner's cash could become ownerless, new deposits in both tranches could be blocked, and later losses could hit Senior before the idle bucket, with recovery only through an owner-only reassignment.
What the attacker needed
Partially impaired Senior tranche; Junior principal at zero, shares outstanding; owner recapitalizes the gap; revenue arrives before next settlement
The fix
The recapitalization should be applied to the Senior gap that existed when it was funded before ordinary surplus is distributed, in both live and preview reconciliation, with a regression test for the partial-impairment case.
How it was found
- Fund a pool at the Senior share cap and let a low-revenue period exhaust Junior principal through the Senior coupon while Senior stays whole.
- Have a trader hold a short of 20% of pool depth and apply a small adverse basket move so a keeper settlement persists a partial Senior impairment with zero Junior principal.
- The owner calls recapitalizePool with the observed Senior gap, after which the projected state reports Senior whole and deposits allowed.
- Ensure an ordinary matured LP request exists so anyone can settle.
- Execute a revenue-producing trade before the keeper settles, then settle; the recapitalization remainder becomes unassigned and Junior is credited less.
- As a control, settle first and then execute the same trade; unassigned stays zero and Junior receives the full revenue.
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.
The pool has two groups of lenders: Junior, who take losses first, and Senior, who are meant to be protected. When Senior has lost some money, the owner can top it back up, but that top-up is only queued until the next settlement. If other income arrives before that settlement, the code spends the income on the Senior shortfall first and then finds the owner's top-up is no longer needed, so it parks it in a bucket nobody owns. That bucket blocks new deposits and sits idle instead of absorbing later losses.
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.