Queue mode records trading revenue gross while the rebates that reverse it are paid from the owner's unassigned quarantine: an account with no LP shares drains the owner's recapitalization at its own cost
In queue mode, when both tranche principals are zero, the pool records trading revenue gross for the claimants but pays the VPI rebates that reverse it from general cash, which in that state is the owner's unassigned quarantine. Any account with no LP shares can therefore trade both sides of a constant-price round trip and move the owner's recapitalization into the wiped senior tranche, at its own cost in fees.
Originally disclosed on Immunefi
- Disclosed after under an hour
#99902 [SC-Critical] Queue mode records trading revenue gross while the rebates that reverse it are paid from the owner's unassigned quarantine: an account with no LP shares drains the owner's recapitalization at its own cost
Submitted on Nov 15th 2026 at 17:26:12 UTC by @argo_the_hacker for Audit Competition | Plether
- Report ID: #99902
- Report Type: Smart Contract
- Report severity: Critical
- Target: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/HousePool.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Severity: Low. Impact selected from the program's list: "Contract fails to deliver promised returns, but doesn't lose value". The mechanism is the program's griefing category ("no profit motive for an attacker, but damage to the users or the protocol", Medium), read down one tier because it needs a rare state: an owner recapitalization left in the unassigned quarantine, and a total wipe of both tranches. The basis, and the preconditions that bound it, are in the Impact section.
Target: immunefi-team/audit-comp-plether @ a82d4fefb02768e5b3bddcc97dee371eee24fea8, packages/perps/src/HousePool.sol (recordClaimantInflow, line 646; payOut, lines 604-613), with the rebate sites in packages/perps/src/libraries/CfdEnginePlanLib.sol (lines 333 and 970-978) and packages/perps/src/CfdEngineSettlementSidecar.sol (lines 442-444 and 621-624).
Relation to prior findings: a new root. No prior item, known-issue row or repository document says that queued revenue is recorded gross without netting the rebates that reverse it. The nearest items are Cecuro MED-6, MED-26, MED-12 and LOW-65, and the nearest documentation is SECURITY.md:1443 and SECURITY.md:871-872. The section "Relation to prior findings" explains each one.
Summary
When both tranche principals are zero ("queue mode"), HousePool.recordClaimantInflow does not credit trading revenue to a tranche. It queues it in pendingTradingRevenueAssets for the claimants (HousePool.sol:646), and the next reconcile settles that bucket into tranche principal ahead of the owner's unassignedAssets (HousePoolReconcilePlanLib.sol:68-74).
Every trade that increases skew pays VPI, and that charge is queued in full. Every trade that reduces skew is paid a VPI rebate: the open rebate (CfdEnginePlanLib.sol:333, paid at CfdEngineSettlementSidecar.sol:443) or the close action rebate (CfdEnginePlanLib.sol:970-978, paid at CfdEngineSettlementSidecar.sol:622). Both rebates are paid by HousePool.payOut (HousePool.sol:604-613) from general pool cash, and neither is netted against the queued revenue it reverses. In queue mode the only cash behind the pool is the owner's unassignedAssets quarantine. So the rebates come out of the owner's quarantine, while the claimants keep the gross charge.
Any account can therefore move the owner's recapitalization out of the quarantine by trading both sides. One reversed cycle (account A opens LONG X, account B opens SHORT X, B closes, A closes, at a constant price) credits the claimants 2v of queued revenue, where v is the VPI of one skew move, while the pool keeps only 2f of fees in cash. At the next reconcile the 2(v − f) difference is taken from unassignedAssets. The account doing this needs no role and no LP shares. It gains nothing and pays every fee.
The main PoC runs this at the shipped v2.0.0 risk parameters through public entry points only, apart from one documented owner action (CfdEngine.recapitalizePool). The pool is wiped by an independent trader's profit, not by any token manipulation, and every reconcile is the public settleLpEpoch. An account holding no LP shares runs five cycles at 35k notional with its own keeper. The owner's quarantine falls by 506.734953 USDC, and the account ends −280.442869 USDC, its fees. Ten cycles drain 1,012.512922 USDC at a cost of 560.883777. The identical cycles in a normal pool drain nothing.
If the account also holds the wiped senior claim, the same cycles become profitable: the supporting PoC's actor, holding 20k of the 21k senior supply, ends +335.916694 USDC while the quarantine falls by the same 506.734953.
The per-position lifetime VPI clamp (CloseAccountingLib.sol:112-118) is not bypassed: each position pays one VPI charge and receives one rebate of the same size. What is not netted is the pool-side queue.
Relation to prior findings
Cecuro MED-6 (Acknowledged, "Addressed"), "Protocol treasury can spend LP withdrawal reserves on fee top-ups". Its fix makes protocol-fee top-ups respect getSettlementFreeAssets, which "protects directional liabilities, the settlement buffer, trader claims, pending recapitalization/revenue, and unassigned assets". Its comment ends: "trader payout and rebate priority is unchanged". This report is not about payment priority. Even if rebates keep priority over the quarantine, the revenue they reverse should not stay queued for the claimants. MED-6 fixed one cash consumer. It does not mention that queued revenue is gross.
Cecuro MED-26 (Acknowledged), "Owner can activate trading against ownerless pool assets". The comment accepts that "ownerless value arising after activation does not introduce a new continuous trading or queued-order gate". That covers the precondition here: an owner quarantine coexisting with trading. MED-26's impact is that trader PnL can "consume or depend on value governance has not yet restored to a tranche". In this report no trader PnL is involved: the price is constant during the cycles, and the trading account loses money. The quarantine is drained by the accounting asymmetry. Netting the queue against rebates closes it without touching MED-26's design choice.
Cecuro MED-12 ("Mixed recovery inflows can strand LP revenue in ownerless pool assets") and LOW-65 ("Owner can misroute ownerless pool assets to the junior seed receiver") concern how recapitalization and revenue are routed into or out of unassignedAssets by the owner. Their fixes keep ownerless value under "explicit assignment … rather than allocating them implicitly" (LOW-65 comment). This report shows the quarantine being allocated implicitly, by any account, through trading. The root is different.
SECURITY.md:1443 (known limitations, VPI): "the lifetime clamp intentionally zeroes otherwise extractable rebate-only round trips". That clamp is per position (CloseAccountingLib.sol:112-118), and nothing here gets past it: each position's lifetime VPI nets to zero (one charge of v, one rebate of v), and the trading accounts together lose 280.442869 USDC, their fees. The problem is one level up. The pool credits the gross charges to the claimants and pays the rebates from someone else's cash. The documented intent is that round trips do not move value, and in queue mode they move the owner's.
SECURITY.md:871-872: "new close-time action rebates use only pool cash free after protecting existing trader claims. Unfunded value is waived rather than claim-backed". This states which cash a close rebate may use. It protects trader claims. It does not protect queued claimant revenue or unassignedAssets, and it does not say that the charge the rebate reverses stays queued gross. The open rebate has no such cap at all: it must only fit in raw pool cash (CfdEnginePlanLib.sol:729-733).
Other reports: the pre-audit report (SC Audit Studio) item SC-M3 concerns rebate-backed initial margin, which is a different root. The Sherlock collaborative report and the Cantina report cover only the spot package. The AI scan's VPI items concern depth inputs to VPI, not where queued revenue is netted.
Vulnerability details
1. Queue mode records revenue gross. HousePool.recordClaimantInflow (HousePool.sol:644-648):
if (kind == IHousePool.ClaimantInflowKind.Recapitalization) {
_recordPendingClaimantInflow(kind, amount);
} else if (seniorPrincipal + juniorPrincipal == 0) {
_recordPendingClaimantInflow(kind, amount);
}
The open planner reserves the whole positive trade cost as new queued revenue (CfdEnginePlanLib.sol:735-736, snap.poolQueuesTradingRevenue && cashDeltaBeforeTopUp > 0 ? uint256(cashDeltaBeforeTopUp) : 0). The close path records the collected close charge the same way (CfdEngineSettlementSidecar.sol:604-613).
2. The rebates that reverse it are paid from general cash and never touch the queue. The open rebate is the negative trade cost (CfdEnginePlanLib.sol:333). It only has to fit in raw pool cash (CfdEnginePlanLib.sol:729-733), and it is paid at CfdEngineSettlementSidecar.sol:442-444:
if (delta.poolRebatePayoutAssets > 0) {
IHousePool(host.pool()).payOut(host.clearinghouse(), delta.poolRebatePayoutAssets);
}
The close action rebate is capped only by cash free after trader claims (CfdEnginePlanLib.sol:970-978, CashPriorityLib.reserveFreshPayouts) and paid at CfdEngineSettlementSidecar.sol:621-624. HousePool.payOut (HousePool.sol:604-613) reduces accountedAssets and transfers. It checks no reserve and does not reduce pendingTradingRevenueAssets.
3. Reconcile settles the queue ahead of the quarantine (HousePoolReconcilePlanLib.sol:68-74):
if (pendingBucketAssets > 0) {
snapshot.distributable =
snapshot.distributable > pendingBucketAssets ? snapshot.distributable - pendingBucketAssets : 0;
}
plan.state.unassignedAssets =
state.unassignedAssets > snapshot.distributable ? snapshot.distributable : state.unassignedAssets;
So whatever the rebates took out of cash is charged to unassignedAssets, and the gross queue becomes senior principal.
4. Where the quarantine comes from. CfdEngine.recapitalizePool is the documented owner recovery action (SECURITY.md:155-162). Reconcile routes it to senior up to the senior high-water mark, and "any remainder … becomes unassigned" (HousePoolPendingPreviewLib.sol:103-136). The repository's own rules for that bucket are "source semantics decide the owner of the inflow" and "only value with no safe claimant path belongs in unassignedAssets" (ACCOUNTING_SPEC.md:647-650). Its later owner is chosen by the owner through assignUnassignedAssets (owner-only, HousePool.sol:660-663). LP withdrawals and protocol-fee top-ups both reserve it (ACCOUNTING_SPEC.md:266; MED-6 fix). The two rebate payouts do not.
Per reversed cycle at notional X and pool depth D (v = k·X²/(2D), CfdMath.sol VPI with k = vpiFactor; f = 4 bps execution fee):
| step | skew | trader cash | queued for claimants | pool cash |
|---|---|---|---|---|
| A opens LONG X | 0 → X | −(v + f) | +v | +v (f to treasury) |
| B opens SHORT X | X → 0 | +(v − f) | 0 | −(v − f) (open rebate) |
| B closes SHORT X | 0 → X | −(v + f) | +v | +v (f to treasury) |
| A closes LONG X | X → 0 | +(v − f) | 0 | −(v − f) (close action rebate) |
| cycle | −4f | +2v | +2f |
The claimants are credited 2v and the pool keeps 2f. At reconcile the 2(v − f) difference is taken from unassignedAssets. (On each skew-reducing trade the execution fee is netted against the rebate and stays in pool cash; the treasury's credit for it is the unfunded top-up that MED-6 already accepts, and it is not claimed here. In the PoC the treasury receives 140 of the 280 USDC of fees.) The quarantine loss per cycle is 2(v − f) whoever trades. An account with no LP shares pays 4f and receives nothing. An account holding share s of the receiving tranche nets s·2v − 4f, which with k = 0.01 is positive for X > 0.16·D/s; the shipped maxSkewRatio of 0.4 allows X up to 0.4·D.
Impact
Who: any account. It needs no role and no LP shares: two trading accounts on opposite sides, executing their own orders as keeper.
What moves: the owner's recapitalization. In the main PoC, five cycles move 506.734953 USDC out of unassignedAssets. The acting account ends −280.442869 USDC: it paid 280 USDC of fees and holds no claim on anything it moved. The receiving side is the wiped senior tranche: the reconcile settles 647.177822 USDC of queued revenue into it, which is exactly the 506.734953 taken from the quarantine plus the 140.442869 of the account's fees the pool kept in cash. The treasury receives the other 140.000000 of fees. The pool's ledger identity (cash equals principals + unassigned + pending buckets) holds after the reconcile. Before it, the reserved buckets exceed pool cash by exactly the amount the quarantine later loses (95,225.771371 vs 94,719.036418 USDC). The damage grows with the number of cycles and is bounded only by the quarantine: ten cycles drain 1,012.512922 USDC at a cost to the account of 560.883777.
The damage: an account with no stake moves protocol-held funds out of the owner's control, at its own cost and for no gain. unassignedAssets is the owner's to assign (assignUnassignedAssets is owner-only), and the repository's rule is that it stays under explicit owner assignment (LOW-65 and MED-12 remediations). After the cycles that value has become senior principal, and no path returns it to the quarantine. The owner loses the choice of who receives it and when, and part of the recapitalization funds trading fees it was never meant to fund.
What the contract fails to deliver: the repository's statements that rebate-only round trips do not move value (SECURITY.md:1443), that "source semantics decide the owner of the inflow" (ACCOUNTING_SPEC.md:647), and that ownerless value stays under explicit owner assignment (LOW-65 and MED-12 remediations). In queue mode, VPI round trips at a constant price move the owner's recapitalization to the claimants, at the direction of whoever chooses to trade.
Why Low. This is the program's griefing category: damage to the protocol that the account causing it does not profit from. It is read down one tier because it needs a rare state that no unprivileged party can create: the owner must have recapitalized more than the senior gap (so the remainder sits in unassignedAssets), and both tranches must have been wiped. The value moved is protocol-held owner funds, not user funds. No user loses: the senior holders gain, and the independent junior LP is untouched. The pool stays solvent. So no Critical or High line fits, and the rare precondition keeps it below Medium.
Aggravated variant (supporting PoC). If the acting account also holds the wiped senior claim, the cycles pay it. With 20k of the 21k senior supply, the same five cycles followed by its own full redemption leave it +335.916694 USDC (616.359563 USDC paid to its wallet), the quarantine again −506.734953. The identical cycles in a normal pool cost the same actor 210.804601 USDC.
Limits, stated plainly:
- Owner precondition. After trading activation, every source of
unassignedAssetsis owner-only. The PoC usesrecapitalizePool(100,000)while senior is at its high-water mark, so the whole amount is quarantined. This is "a legitimate, documented action by a trusted role" (Scope tab), done correctly. Nothing an unprivileged party does creates the quarantine. - Total wipe. Queue mode needs both principals at zero. In the PoC an independent trader's 45k LONG profits from an index move of 1.00 → 0.30 and wipes both tranches (26k of principal). A deep pool needs an extreme move for that.
- Who receives the value. It lands with the wiped senior tranche, which is the class a recapitalization of a wiped pool is meant to restore. An owner who planned to assign the quarantine to senior anyway loses the discretion over who receives it and when, and the fee share.
- Cost. The griefing costs the acting account about 0.55 USDC of fees per 1 USDC moved, and needs capital on both trading sides (40,000 USDC each in the PoC).
- Test fixture. The PoCs use the maintainers'
HousePoolAsyncTestBasefixture as-is (1,000 USDC seeds, senior share cap 99.99%). The risk parameters are set to the shipped v2.0.0 values.
Recommendation
Net rebates against the queue while the pool is queueing revenue. When seniorPrincipal + juniorPrincipal == 0, a VPI rebate or close action rebate paid through payOut should first reduce pendingTradingRevenueAssets (down to zero), so the claimants are credited only the net VPI the pool actually kept. Equivalently, the planners could reserve pendingTradingRevenueAssets and unassignedAssets when sizing the open rebate (CfdEnginePlanLib.sol:729-733) and the close rebate (CfdEnginePlanLib.sol:970-978), as the MED-6 fix does for protocol-fee top-ups. That would waive rebates in queue mode instead of moving them onto the quarantine. The first option keeps trader economics unchanged and closes both legs.
This is a sketch. It has not been implemented or run against the maintainers' suite. The two property tests above are the regression tests for it.
Link to Proof of Concept
https://gist.github.com/Richter2552/e6bf16bba24d9736960389b8144a1c9a
Proof of Concept
Proof of Concept
The program requires PoCs to run in the repository's Foundry test suite at the commit in scope without modifying the contracts in scope. Both test files below extend the maintainers' HousePoolAsyncTestBase fixture (packages/perps/test/perps/shared/HousePoolTestBase.sol, as used by HousePoolTerminalNav.t.sol), with the fixture's initial deposits set to zero and the shipped v2.0.0 risk parameters (deployments/releases/2026-10-28-perps-arbitrum-sepolia-v2.0.0/manifest.json: vpiFactorWad 1e16, maxSkewRatioWad 4e17, executionFeeBps 4). Every action uses a public entry point from an unprivileged account: LP requestDeposit / requestRedeem / claimDeposit on the tranche vaults, the permissionless HousePool.settleLpEpoch(0, 0), production OrderRouter.commitOrder(OrderRequest) from each trader's own account, router.executeOrder from a keeper with no role, and the public router.updateMarkPrice. The single exception is labelled in each test: the owner's CfdEngine.recapitalizePool(100,000). Pyth updates come from the repository's MockPyth, which the program allows ("Mocks may only replace components outside the scope, such as Pyth price updates").
Main PoC, Card9860S1GriefQuarantine.t.sol. The griefing accounts (TRADER_A, TRADER_B, KEEPER) never hold LP shares. The property test states the behaviour the code should have (reversed round trips at a constant price by an account with no LP shares do not move the owner's quarantine) and fails on the pinned code. Before that assertion it checks, and passes, that the account did not profit and that the ledger identity holds after the reconcile. The characterize test runs ten cycles and passes (the drain grows, the account still loses). The control test runs the identical cycles in a normal pool and passes.
Supporting PoC, Card9860S1QueueModeGrossRevenue.t.sol. The same mechanism with the acting account holding most of the wiped senior claim. Its property test (the actor cannot end richer) fails on the pinned code, and its normal-pool control passes.
Run instructions (from a checkout of immunefi-team/audit-comp-plether at a82d4fefb02768e5b3bddcc97dee371eee24fea8 with submodules; solc 0.8.35 via the repository's packages/perps/foundry.toml):
cp Card9860S1GriefQuarantine.t.sol Card9860S1QueueModeGrossRevenue.t.sol packages/perps/test/perps/accounting/waterfall/
cd packages/perps
forge test --match-contract '^Card9860S1GriefQuarantineTest$' --match-test '^test_Property_' -vv
forge test --match-contract '^Card9860S1GriefQuarantineTest$' --match-test '^test_(Characterize|Control)_' -vv
forge test --match-contract '^Card9860S1QueueModeGrossRevenueTest$' --match-test '^test_Property_' -vv
forge test --match-contract '^Card9860S1QueueModeGrossRevenueTest$' --match-test '^test_Control_' -vv
Main PoC output (pinned code, unmodified contracts)
Run against the pinned commit (forge 1.8.1, solc 0.8.35, the repository's packages/perps/foundry.toml). Result: the characterize and control tests pass and the property test fails. Excerpt (forge -vv logs; USDC amounts in 1e6 units; S / J / U = senior principal, junior principal, unassignedAssets; pRev = pendingTradingRevenueAssets). The "victim senior LP gain" line counts the senior LP's remaining shares only; its one-fifth redemption (123.271912) is settled in the same epoch but not yet claimed.
[PASS] test_Characterize_DrainGrowsWithCycles() (gas: 121736464)
Logs:
...
10-cycle quarantine before / after 94578593549 93566080627
10-cycle grieferNet (<0)
-560883777
[PASS] test_Control_NormalModeNoQuarantineDrain() (gas: 59055549)
Logs:
normal-mode quarantine (expect 0) 0 0
normal-mode grieferNet (<0)
-280206859
[FAIL: PROPERTY: griefer round trips drain the owner's quarantine: 506734953 != 0] test_Property_GrieferCannotDrainQuarantine() (gas: 73848360)
Logs:
deposits done
S / J / U 21000200914 5999799086 0
pRev / pRecap 0 0
pool cash / buckets / treasury 27000000000 27000000000 0
after owner recap + public settle
S / J / U 21000584479 4999479451 100000000000
pRev / pRecap 0 0
pool cash / buckets / treasury 126000063930 126000063930 0
after trader W closes at profit (pre-reconcile)
S / J / U 21000584479 4999479451 100000000000
pRev / pRecap 0 0
pool cash / buckets / treasury 94578593549 126000063930 18000000
after public reconcile (wipe)
S / J / U 0 0 94578593549
pRev / pRecap 0 0
pool cash / buckets / treasury 94578593549 94578593549 18000000
after 5 reversed cycles (pre-reconcile)
S / J / U 0 0 94578593549
pRev / pRecap 647177822 0
pool cash / buckets / treasury 94719036418 95225771371 158000000
after public reconcile (queue settled)
S / J / U 523905910 0 94071858596
pRev / pRecap 0 0
pool cash / buckets / treasury 94595764506 94595764506 158000000
quarantine before / after 94578593549 94071858596
griefer value before / after 80000000000 79719557131
grieferNet (<0 = no profit)
-280442869
quarantineDrain (>0 = damage to protocol)
506734953
victim senior LP gain / treasury gain
493087650
140000000
Suite result: FAILED. 2 passed; 1 failed; 0 skipped
Expected output on a fixed contract: the property test passes (unassignedAssets is unchanged by the cycles, and the account's net is its fees). The characterize test's assertLt(quarantineEnd, quarantineStart) would then fail, which is the intended signal that the drain is gone. The control is unaffected.
What the main PoC shows
| step | evidence in the output | result on the pinned code |
|---|---|---|
| LPs deposit through the epoch path: an independent LP holds 20k of the 21k senior supply, another holds 5k junior; the griefing accounts hold no LP shares | "deposits done" | passes |
the owner recapitalizes 100,000 while senior is at its high-water mark; the public settleLpEpoch puts all of it in unassignedAssets |
"after owner recap + public settle": U = 100,000 | passes |
an independent trader's LONG profits from a price move and closes; the next public settleLpEpoch wipes both principals; the quarantine survives (U = 94,578.59); the router's commit gate is still open and the engine is not degraded |
"after public reconcile (wipe)": S = J = 0 | passes |
| five reversed cycles at 35k notional, constant price, all positions closed. The claimants have 647.177822 queued, but pool cash rose only 140.442869. The buckets exceed cash by 506.734953 | "after 5 reversed cycles (pre-reconcile)" | passes |
the senior LP's ordinary redemption request triggers the public settleLpEpoch, which settles the queue into senior principal and takes the difference from U (94,578.59 → 94,071.86) |
"after public reconcile (queue settled)" | passes |
| the griefing accounts did not profit; ledger identity (cash = all buckets) after the reconcile | assertions before the property | pass |
| PROPERTY: round trips by an account with no LP shares do not move the owner's quarantine | test_Property_GrieferCannotDrainQuarantine |
FAILS: quarantine −506.734953, account −280.442869 |
| CHARACTERIZE: ten cycles | test_Characterize_DrainGrowsWithCycles |
passes: quarantine −1,012.512922, account −560.883777 |
| CONTROL: the identical cycles in a normal pool | test_Control_NormalModeNoQuarantineDrain |
passes: no quarantine, account −280.206859 |
Main PoC test file: packages/perps/test/perps/accounting/waterfall/Card9860S1GriefQuarantine.t.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.35;
// Queue mode, no-profit damage: a party that holds NO LP shares drains the owner's `unassignedAssets`
// recapitalization quarantine by trading both sides at a constant price, and profits nothing (it only pays fees).
// Pinned code: immunefi-team/audit-comp-plether @ a82d4fefb02768e5b3bddcc97dee371eee24fea8, unmodified contracts.
// Install path: packages/perps/test/perps/accounting/waterfall/ (next to HousePoolTerminalNav.t.sol, same fixture).
//
// MECHANISM:
// In queue mode (seniorPrincipal + juniorPrincipal == 0, HousePool.sol:646) trading revenue is queued GROSS for the
// tranche claimants, while the VPI open rebate (CfdEngineSettlementSidecar.sol:443) and the close action rebate
// (:622) are paid from raw pool cash and never net the queue. In queue mode the only pool cash is the owner's
// `unassignedAssets` quarantine, so the rebates come out of it, and at reconcile the gross queue settles into senior
// principal AHEAD of the quarantine (HousePoolReconcilePlanLib.sol:68-74). The quarantine absorbs the 2(v-f) gap per
// reversed cycle. This is true no matter who holds the senior shares.
//
// Sequence (every step is a public entry point except the ONE labelled owner step):
// 1. An independent senior LP (VICTIM_LP) deposits 20k; an independent junior LP deposits 5k.
// 2. OWNER (documented trusted action): CfdEngine.recapitalizePool(100k) with no senior gap => whole amount
// quarantined in `unassignedAssets`.
// 3. Wipe by independent trader W's PnL (no token burn); a public settleLpEpoch reconciles both principals to zero.
// 4. The GRIEFER (TRADER_A, TRADER_B, KEEPER) — holding NO LP shares — trades both sides at a constant price.
// 5. A public settleLpEpoch settles the gross queue into senior principal and charges the gap to the quarantine.
//
// RESULT ON THE PINNED CODE: the quarantine (owner's recap) strictly falls, the griefer's net is negative (it only
// pays fees and holds no claim on the drained value), and value is conserved (the drain lands on the independent
// senior LP and the treasury). Damage to the protocol with no profit to the party causing it.
import {HousePoolAsyncTestBase} from "../../shared/HousePoolTestBase.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {OrderRouter} from "@plether/perps/OrderRouter.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {TrancheVault} from "@plether/perps/TrancheVault.sol";
import {IMarginClearinghouse} from "@plether/perps/interfaces/IMarginClearinghouse.sol";
import {IOrderRouterAccounting} from "@plether/perps/interfaces/IOrderRouterAccounting.sol";
import {MockPyth} from "@plether/test-utils/MockPyth.sol";
import {console2} from "forge-std/console2.sol";
contract Card9860S1GriefQuarantineTest is HousePoolAsyncTestBase {
// The griefer: two trading accounts + a role-less keeper. HOLDS NO LP SHARES.
address internal constant TRADER_A = address(0xA11CE);
address internal constant TRADER_B = address(0xB0B);
address internal constant KEEPER = address(0x5EE5); // any EOA, no role
// Independent LPs (victims of the mechanism / unwitting beneficiaries).
address internal constant VICTIM_LP = address(0xA77A); // independent senior LP
address internal constant LP_J = address(0x10B); // independent junior LP
address internal constant TRADER_W = address(0x3A1); // independent trader whose PnL wipes the pool
address internal constant REFRESHER = address(0x4EF4); // any EOA
uint256 internal constant RECAP = 100_000e6;
uint256 internal constant VICTIM_SENIOR = 20_000e6;
uint256 internal constant LP_J_JUNIOR = 5000e6;
uint256 internal constant MARGIN = 10_000e6;
uint256 internal constant TRADER_FUNDS = 40_000e6;
uint256 internal _price = 1e8;
uint256 private _nonce;
function _initialJuniorDeposit() internal pure override returns (uint256) {
return 0;
}
function _initialSeniorDeposit() internal pure override returns (uint256) {
return 0;
}
/// Shipped v2.0.0 risk parameters
/// (deployments/releases/2026-10-28-perps-arbitrum-sepolia-v2.0.0/manifest.json).
function _riskParams() internal pure override returns (CfdTypes.RiskParams memory) {
return CfdTypes.RiskParams({
vpiFactor: 0.01e18,
maxSkewRatio: 0.4e18,
maintMarginBps: 10,
initMarginBps: 20,
fadMarginBps: 300,
baseCarryBps: 500,
minBountyAssets: 1e6,
bountyBps: 10,
keeperShareBps: 5000,
protocolShareBps: 0
});
}
// ------------------------------------------------------------------------------------------------------------
// Public entry points (identical helpers to the companion extraction PoC)
// ------------------------------------------------------------------------------------------------------------
function _tickNow() private view returns (b
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 queued trading revenue is recorded gross and never netted against the rebates paid through payOut, so the reconcile charges the shortfall to unassignedAssets.
Impact
An account with no LP shares can move the owner's recapitalization out of the quarantine into the wiped senior tranche, losing only its fees; the drain grows with each cycle and is bounded only by the quarantine, and the pool stays solvent.
What the attacker needed
Owner recapitalizes above the senior gap; both tranche principals wiped to zero; two funded trading accounts; no LP shares needed
The fix
Rebates paid while the pool is queueing revenue should first reduce the pending trading revenue bucket, or the planners should reserve the pending revenue and unassigned assets when sizing rebates.
How it was found
- The owner recapitalizes the pool while senior is at its high-water mark, and a public settle puts the whole amount into unassignedAssets.
- An independent trader's profitable long is closed and the next public settle wipes both tranche principals, leaving the quarantine intact.
- Two accounts open opposite positions at a constant price, then close them, repeating the cycle several times.
- A public settle runs the reconcile, which settles the queued revenue into senior principal and takes the difference from the quarantine.
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 holds money for two groups of investors, called tranches. When both tranches have been wiped out, the pool still lets people trade, and it keeps a running tally of trading charges owed to those investors. The problem is that when a trade earns a refund, the refund is paid from the owner's leftover cash, but the charge it cancels stays on the tally. So someone can trade back and forth at an unchanged price and quietly shift the owner's cash into the tally, paying only fees and gaining nothing.
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.