Skip to content
Business logic Audit finding Advanced

HousePool keeps the whole owner recapitalization queued as a reservation after a tranche wipe although only part of it becomes LP equity: the stale remainder blocks senior exits and each later settlement lowers the senior high-water mark

After a full tranche wipe, the owner's documented recapitalization is queued in HousePool as a reservation for the full amount, but only the part that fills the terminal deficit can become LP equity and the remainder is never written off. That stale reservation blocks a senior LP's queued exit and makes every permissionless settlement revert, and it is re-applied at each later reconcile, lowering the senior high-water mark without any loss.

FestiveSRT Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#99000 [SC-High] HousePool keeps the whole owner recapitalization queued as a reservation after a tranche wipe although only part of it becomes LP equity: the stale remainder blocks senior exits and each later settlement lowers the senior high-water mark

Submitted on Nov 11th 2026 at 11:52:37 UTC by @FestiveSRT for Audit Competition | Plether

Description

Summary

After a full tranche wipe with trader claims outstanding, the owner's documented recovery (CfdEngine.recapitalizePool(R) then clearDegradedMode()) is queued by HousePool as a pending recapitalization bucket of the full amount R. Only R minus the terminal deficit X of that cash can ever become LP equity, yet nothing writes the remaining X off. The stale remainder (a) remains fully reserved without ordinary settlement progress and is not backed by the original recapitalization cash; only later unrelated value or owner-only recovery releases it, so a senior LP's exit cannot be funded and, with that exit as the pending work, every permissionless router.settleLpEpoch reverts with HousePool__NoLpEpochProgress while the pool holds the cash; and (b) is re-applied at every later reconcile, which wipes the tranches again and re-runs the bootstrap, lowering the senior high-water mark by the equity slice each time although no loss occurred. One accounting root, two manifestations, and no malicious or compromised actor: the trusted owner is the trigger actor, acting honestly with the documented recovery; keepers are permissionless; the harmed party is the senior LP.

Programme text this report relies on (Scope tab, quoted)

  • Trusted role clause: "In scope: a legitimate, documented action by a trusted role that triggers a bug harming users or the protocol." and "an in-scope impact arises from a logic error that a privileged address can trigger, which remains valid."
  • Owner capabilities: "Immediately, can pause and unpause, set the treasury, recapitalize the pool, clear degraded mode ..."
  • PoC rule: "PoCs must run either in the repository's Foundry test suite at the commit in scope, or on a local Anvil fork of the Arbitrum Sepolia v2.0.0 deployment (see Build Commands), without modifying the contracts in scope. Mocks may only replace components outside the scope, such as Pyth price updates and USDG."
  • Feasibility: "Impact is calculated first, separately from feasibility. Feasibility limitations do not change the impact or severity of a finding, only the amount paid for it."
  • Out-of-scope clauses answered here: "Attacks that require a malicious or compromised privileged role (admin, operator, sequencer, prover, guardian, governance) ... are out of scope" and "attacks that require a trusted role to act maliciously, to be compromised, or to act outside its documented operational procedures": the owner acts honestly and recapitalization is a documented procedure (SECURITY.md 155-161, 1509-1511; ACCOUNTING_SPEC.md 639-643). "Impacts involving centralization risks": no owner discretion is exercised against anyone. "Lack of liquidity impacts": the pool holds the cash, see the table below. "Incorrect data supplied by third party oracles": the stand-in feed values are the correct values of the hypothetical market move, not incorrect data. "Setting a parameter to a value the code allows is a trusted action, not a bug": no parameter is set.

Impact selected: High, "Temporary freezing of funds for at least 24 hours"

Impact selected: High, "Temporary freezing of funds for at least 24 hours". The frozen funds are a third-party senior LP's redemption claim (2,267,675.253119 USDG funded at once on the patched pool); the LP, not the owner, owns them; the actor who triggers the state is the trusted owner performing the documented recovery, acting with its real capabilities and honestly; the state lasts at least 30 hours by hourly settlement attempts and about 14 days until the owner's fourth timelocked lever; ordinary retries do not end it.

Why this is not excluded as "a protocol-only liveness failure without an attacker" (the detailed definition's own exclusion list, which also excludes sender-controlled self-harm, voluntary self-lock, and ordinary by-design pending periods): this is not an infrastructure or environmental outage with no identifiable trigger. It is a genuine accounting bug, reached through a real, named, documented action (recapitalizePool then clearDegradedMode), harming a specific identified third party (the senior LP, not the owner and not the sender) for a specific measured amount and duration. The programme's own scope text directly addresses this exact shape: "In scope: a legitimate, documented action by a trusted role that triggers a bug harming users or the protocol." That sentence sits beside, but textually separate from, "A bug that grants an address privileges it did not originally hold is also in scope, and may be downgraded by one severity level" — the downgrade is attached only to the privilege-escalation sentence, not to this one; if the programme meant every trusted-role-triggered bug to be capped below attacker-required impacts, this is exactly where it would say so, and it does not.

Critical, "Permanent freezing of funds" was considered and is not supported: the mechanism itself documents a working recovery path (the owner's fourth timelocked lever, 14 days after the recapitalization, or a further large owner recapitalization releases it sooner; see Release, below). A freeze with a known, working, if slow, recovery path is temporary by definition, not permanent.

Medium, "Smart contract unable to operate due to lack of token funds" is independently selected alongside High on these same facts, not as a conditional fallback: the contract is HousePool (the LP redemption and settlement contract); it is unable to operate (it cannot fund a queued senior redemption and every permissionless settleLpEpoch reverts); the required token funds are the free USDG the redemption needs, which the stale reservation drives to zero (free 0 in the table below) although 9,970,303.365360 USDG sit above all liabilities; the cause is an accounting defect reached through ordinary flows (trader orders, the owner's documented recovery, an LP exit), with no attacker; the state lasts at least 30 hours and about 14 days to the owner's release, and never ends by retry. Both impacts are selected together per the competition's rule that every applying impact may be selected and severity is set to the highest selected (High).

Root cause (frozen commit a82d4fefb02768e5b3bddcc97dee371eee24fea8, packages/perps/src)

  1. CfdEngine.recapitalizePool (CfdEngine.sol:632) pulls R from the owner into the pool and calls HousePool.recordClaimantInflow(Recapitalization, R) (HousePool.sol:624), which adds R to pendingRecapitalizationAssets (_recordPendingClaimantInflow, HousePool.sol:1794-1801).
  2. At reconcile the bucket is capped by distributable value (_settleablePendingClaimantBuckets, HousePool.sol:1829-1834; capClaimantBuckets, HousePoolPendingPreviewLib.sol:72) and the capped part is applied by applyClaimantRecapitalizationIntent (HousePoolPendingPreviewLib.sol:111-137). When both principals are zero the whole applied amount becomes senior principal and the high-water mark becomes max(target, amount) (lines 117-123). Only the capped part is removed from the bucket (_decreasePendingClaimantBuckets, HousePool.sol:1772 and 1787-1791). The uncapped remainder, equal to the terminal deficit X that the cash had to fill, stays in pendingRecapitalizationAssets and nothing ever clears it.
  3. The remainder is an ownerless reservation: _buildWithdrawalSnapshot (HousePool.sol:1727-1735) subtracts _pendingClaimantBucketAssets() from withdrawal capacity, and the reconcile plan treats it as pending claimant value that is removed from distributable value before the waterfall (HousePoolReconcilePlanLib.sol:68-71). With no cash behind it, every reconcile sees distributable value below the bucket, the tranches are wiped again, and the bootstrap branch of step 2 runs again with the remainder as the new target.

Mechanism with numbers (deployed v2.0.0 state, all USDG, produced by the PoC below)

State after ordinary trader activity wipes both tranches: pool cash P = 43,428,135.992567; trader claims C = 75,731,545.598389; maximum liability of positions that remain open L = 11,878,653.855744; terminal deficit X = 43,513,122.755958; minimum recovery Rmin = C + L - P = 44,182,063.461566; getPendingTrancheState reports senior and junior principal 0 and 0 and the degraded latch is set. A senior LP holds 2,987,848,707,829,685 share units (from a 3,000,000 USDG deposit made before the shock) and queues a full exit.

The owner recapitalizes R = Rmin + Y with Y = 10,000,000 (54,182,063.461566) and clears degraded mode. Then:

quantity value
pool raw assets 97,610,199.454133 (= P + R)
C + L + settlement buffer B (B = 29,696.634640) 87,639,896.088773
cash above those liabilities (= Y - B) 9,970,303.365360
reserved assets reported by the pool 141,821,959.550339 = 87,639,896.088773 + the whole bucket 54,182,063.461566
free assets 0
the first settleLpEpoch and 30 further hourly calls all revert HousePool__NoLpEpochProgress (0x86cca6b8)
the LP's exit never funded; cancelRedeemRequest reverts RedeemCancellationUnavailable (0x3260a8c1)

The same exit on a pool with the stale remainder written off is funded 2,267,675.253119 at the first settlement (control below). The block is deterministic: the first settlement reverts if and only if Y <= X + B (sweep: Y = X + 29,000 blocked; Y = X + 31,000 funded 1,303.365360 = Y - X - B). No third party can enter around it: after the wipe both vaults refuse deposits (senior DepositsUnavailable 0x15fb1002, junior TerminallyWiped 0x5616d460).

Release: the stale remainder drains only one equity slice (R - X = 10,668,940.705608) per owner lever, each lever being proposePoolConfig then finalizePoolConfig after the 72 h timelock with a fresh mark from the permissionless router.updateMarkPrice; the exit is funded after the fourth lever, 14 days after the recapitalization (finalize times Fri 2026-11-20 08:00:01Z, Mon 11-23 09:00:01Z, Thu 11-26 10:00:01Z, Sun 11-29 23:00:01Z; the recapitalization is at Sun 11-15 23:00Z). A further 20,000,000 owner recapitalization also releases it. HousePool is not upgradeable.

Second manifestation (no exit queued; the junior zero-NAV exits only supply settlement progress): the first settlement bootstraps senior principal 10,668,940.705608 with high-water mark R = 54,182,063.461566 (the recorded bootstrap) and leaves bucket 43,513,122.755958. Each later settlement lowers the mark by exactly 10,668,940.705608 with no loss: 54,182,063.461566, 43,513,122.755958, 32,844,182.050350, 22,175,241.344742, 11,506,300.639134, while senior principal stays 10,668,940.705608. The documented rules say the opposite: "losses do not reduce [the high-water mark]" (HousePoolWaterfallAccountingLib header), ACCOUNTING_SPEC.md 337-338 ("Losses do not reduce the Senior high-water mark." / "Route surplus first to restore Senior principal to its high-water mark, then to Junior."). Junior participates in revenue before senior is restored to the mark the code itself set; the re-routing is capped by R minus the final mark and no principal is lost.

Actor model

No malicious or compromised attacker. The trusted owner is the identifiable trigger actor for High; Medium requires no attacker. Owner: honest trusted role performing the documented recovery (SECURITY.md 155-161, 1509-1511; ACCOUNTING_SPEC.md 639-643), choosing R inside the range the code allows (no document fixes R); the PoC impersonates the real owner address for the four owner calls only. Keepers: permissionless (router.updateMarkPrice, router.settleLpEpoch). LP: queues an ordinary exit. Harmed party: a third-party senior LP (not the owner; the funding call mints the owner no shares). Beneficiary of the re-routing: junior LPs. Bug: the pool keeps counting the part of R that only filled the deficit as a live reservation.

Feasibility chain, disclosed exactly

  • The wipe with claims above cash needs a large basket move. The PoC uses a stand-in price path (two basket moves, about +98 percent then -95 percent) through a mock of the Pyth contract at the deployed Pyth address, which the programme permits ("Mocks may only replace components outside the scope, such as Pyth price updates and USDG"). The feed values are the correct values for that hypothetical market move, not incorrect oracle data. Genuine signed Pyth history for the six feeds could not be retrieved (the public Hermes and benchmarks price endpoints answer HTTP 401); against public ECB daily history 2010-2026 the best single hindsight round trip reaches 0.74 of the pool where a wipe needs 1.0838 (round-trip payout x + 1.0811 y of entry, x the up leg and y the down leg).
  • The pinned deployment still carries unidentified open positions (long open interest 122,982 lots; only 8 accounts identified), so L stays 11,878,653.855744 and the exact zero-open-interest case cannot be built there; the mechanism and the arithmetic hold for any L (the stale part is exactly the terminal deficit X).
  • Amounts are test liquidity (mock USDG, 102.17M USDG pool at the pin); the arithmetic is ratio-based. The programme says severity uses the stated parameters; the release deployment (Arbitrum One) is not yet live.

Knownness distinction (minimum detail)

The first post-wipe recapitalization resetting the senior mark to the queued target is documented in code (HousePoolPendingPreviewLib.sol:103-110) and asserted by the retained suite (TrancheRecoveryBehavior.t.sol:13-79); this report does not rely on that reset. The defect here is that the part of R that only fills the terminal deficit is never written off: it stays reserved with no cash behind it and is re-applied at every later reconcile. The pre-audit finding SC-L1 was fixed by plether-core PR #29 (closed unmerged; its branch commit 31a38bb7 is contained in master), whose response says "Anything that can't be settled yet stays pending, stays reserved everywhere, and gets applied later once it's backed." SC-L1 deliberately preserved amounts that could not yet settle. M175 shows incomplete handling of that design in terminal-deficit recovery: the part of the recapitalization consumed by pre-existing claims cannot be backed by the original recap cash, yet it remains fully reserved; this newly deadlocks an otherwise payable senior exit, and later reconciliation reuses the residual as a bootstrap target and lowers HWM without a new loss. Later unrelated value can release the reservation, as the 20M recap control demonstrates, so the novelty claim is these two new consequences/incomplete-fix behaviors, not that the residual can never receive future backing. The documented-action support for the owner's recovery is the commit that added recapitalizePool (plether-core PR #121). Cecuro MED-12 states that partial-settlement residuals stay reserved; that is a design for partial settlement of real value, whereas here the reserved amount exceeds the cash above liabilities (141,821,959.550339 reserved against 97,610,199.454133 raw) and the PoC proves no cash backs it. MED-1, MED-11 and LOW-54 concern freshness gating of finalization, withdrawal scaling and sub-atom dust. The programme's open-issue list (MED-7, MED-13, MED-16, LOW-57, MED-22, MED-24, MED-29, MED-30) does not contain it.

Why the obvious objections do not apply

  • "The owner chose R": recapitalizePool accepts any nonzero amount (CfdEngine.sol:632-653) and clearing degraded mode needs the pool to cover its liabilities (CfdEngine.sol, clearDegradedMode NatSpec), so R of at least Rmin is the documented recovery; no document fixes R, and the same exit on the patched pool is funded at the first settlement (shown for R = Rmin + 10,000,000). The defect is what the pool does with the R it was given.
  • "Lack of liquidity": the pool holds 9,970,303.365360 of cash above all liabilities and the block exists only because the stale remainder is reserved against it.
  • "Centralization": no owner discretion is used; the owner does not withhold or redirect funds.
  • "Setting a parameter to a value the code allows": no parameter is set; the funding amount is an input, the accounting is the bug.
  • "Temporary, the owner can release": correct, and that is exactly why the selected impact is "temporary freezing" rather than a permanent-freezing claim, not a reason the finding fails; the release still takes four 72 h levers (about 14 days) or an extra 20,000,000 owner recapitalization, and ordinary retries (30 of 30) fail in the meantime.
  • "No attacker, so this cannot be a High freeze": the honest, documented trigger is exactly the scope text's named in-scope case ("a legitimate, documented action by a trusted role that triggers a bug harming users or the protocol"), stated beside, but without, the downgrade the scope text gives the adjacent privilege-escalation case; High is supported directly on this text, and Medium SC-17 (no attacker required) is selected alongside it as a second, independently-fitting impact on the same facts, not a condition on High being rejected.

Limits

Stand-in price path (disclosed); only 8 of the open positions are identifiable on the pinned state; contracts are not upgradeable so a fix needs redeployment; patched HousePool runtimes exceed the EIP-170 limit by 57 bytes (patch A) so a deployable fix also needs byte savings elsewhere.

Proof of Concept

Proof of Concept: fork test of the deployed Plether perps v2.0.0 contracts (Arbitrum Sepolia) at a pinned block

Rule text this PoC follows. Immunefi Web3 PoC Guidelines: "The smart contract PoC should always be made by forking the mainnet using tools like Hardhat or Foundry." and "No unit test PoCs will be accepted." Programme: "PoCs must run either in the repository's Foundry test suite at the commit in scope, or on a local Anvil fork of the Arbitrum Sepolia v2.0.0 deployment (see Build Commands), without modifying the contracts in scope. Mocks may only replace components outside the scope, such as Pyth price updates and USDG." This PoC is a Foundry test that forks the deployed contracts at block 326928451 from a local Anvil fork and calls them only through their production entry points; no contract in scope is modified in the vulnerable run.

What the test does that is not a production call (every device, line by line)

  1. vm.createSelectFork(url, 326928451) and vm.chainId(421614): the fork of the deployment. vm.warp/vm.roll: time moves to Sunday 2026-11-15 23:00:00Z (market open) and then forward hour by hour; the deployment has 72 h timelocks and hourly LP epochs.
  2. vm.etch of a mock ArbSys at 0x64 (the local EVM does not simulate that precompile).
  3. vm.etch of the repository's MockPyth at the deployed Pyth address, so the six-feed basket takes the price path of the test (a Pyth price-update mock, which the programme permits). Real signed Pyth history for the six feeds is not publicly retrievable and the wipe needs a basket path of about +98 percent then -95 percent.
  4. Mock USDG mint(address,uint256): the deployed permissionless mint, used to fund the actors.
  5. vm.prank of the real owner address 0x5a71a4094Ec81165Ada48AA4c27dA48ec27E0d6B for exactly four calls: CfdEngine.recapitalizePool, CfdEngine.clearDegradedMode, HousePool.proposePoolConfig, HousePool.finalizePoolConfig (the trusted role the impact names, acting as itself). Every other call is made by the actor's own address: traders (commitOrder), a permissionless keeper (executeOrder, router.updateMarkPrice, router.settleLpEpoch), LPs (requestDeposit, requestRedeem, claimDeposit, cancelRedeemRequest).
  6. Only in the fix-check builds (step 5): vm.etch puts the patched HousePool runtime over the deployed one. The vulnerable run does not.

vm.deal is used only to give native ETH for gas and Pyth update fees (keeper 1000 ether, each trader 10 ether, each LP and the probe account 1 ether), in setup and actor creation. No USDG is minted by cheatcode: all USDG comes from the deployed permissionless mint of item 4. There is no vm.store and no vm.mockCall, and no cheatcode grants any party a capability in the exploit phase.

Step 1. Setup

Bash
git clone --recurse-submodules https://github.com/immunefi-team/audit-comp-plether.git
cd audit-comp-plether && git checkout --detach a82d4fefb02768e5b3bddcc97dee371eee24fea8 && git submodule update --init --recursive
# Foundry 1.5.1-stable (solc 0.8.35, via-IR, optimizer 200, Prague; from packages/perps/foundry.toml). Make three separate copies of the checkout
# (one per build) so the patch of step 5 never touches the vulnerable copy:
cp -r . ../plether-frozen && cp -r . ../plether-fixa && cp -r . ../plether-fixh
# Local Anvil fork of Arbitrum Sepolia pinned at the block (needs an archive-capable JSON-RPC URL for chain 421614 in ARB_SEPOLIA_RPC; only state reads are sent):
anvil --fork-url "$ARB_SEPOLIA_RPC" --fork-block-number 326928451 --port 8545 --host 127.0.0.1 --no-storage-caching &

State is fetched lazily from the RPC on first use (the first run took about 9 minutes against a rate-limited free tier; later runs in the same Anvil session take under 10 seconds).

Step 2. The code (save the files exactly as shown; the run script copies them into the checkout)

Layout: poc/run_fork.sh, poc/fixA_writeoff.diff, poc/fixH_intent_mark.diff, poc/test-m175/LiveBase.sol, poc/test-m175/PoCBase.sol, poc/test-m175/M175Fork.t.sol.

poc/run_fork.sh

Bash
#!/bin/bash
# Usage: run_fork.sh <checkout-root> <build> <fork-url>      build = frozen | fixa | fixh
# <checkout-root>: a copy of the competition checkout at a82d4fefb02768e5b3bddcc97dee371eee24fea8 (use a separate copy per build).
# <fork-url>: JSON-RPC URL of a local Anvil fork of Arbitrum Sepolia pinned at block 326928451 (see step 3), or an archive RPC for chain 421614.
# The test itself selects block 326928451 (vm.createSelectFork(url, 326928451)) and sets the chain id; no contract in scope is modified for "frozen".
set -eu
ROOT="$1"; BUILD="${2:-frozen}"; export M175_FORK_URL="$3"; HERE="$(cd "$(dirname "$0")" && pwd)"
PERPS="$ROOT/packages/perps"
mkdir -p "$PERPS/test-m175"
cp "$HERE"/test-m175/*.sol "$PERPS/test-m175/"
case "$BUILD" in
  fixa) (cd "$PERPS" && patch -p0 src/HousePool.sol < "$HERE/fixA_writeoff.diff") ;;
  fixh) (cd "$PERPS" && patch -p0 src/HousePool.sol < "$HERE/fixH_intent_mark.diff") ;;
esac
cd "$PERPS"
export FOUNDRY_TEST=test-m175
if [ "$BUILD" = frozen ]; then export M175_EXPECT=frozen; else export M175_EXPECT="$BUILD"; export M175_ETCH=1; fi
forge test --match-contract M175Fork -vv

poc/test-m175/LiveBase.sol

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

import {Test} from "forge-std/Test.sol";
import {MockPyth} from "@plether/test-utils/MockPyth.sol";
import {CfdEngine} from "@plether/perps/CfdEngine.sol";
import {MarginClearinghouse} from "@plether/perps/MarginClearinghouse.sol";
import {OrderRouter} from "@plether/perps/OrderRouter.sol";
import {HousePool} from "@plether/perps/HousePool.sol";
import {TrancheVault} from "@plether/perps/TrancheVault.sol";
import {PletherOracle} from "@plether/perps/PletherOracle.sol";
import {PositionProtectionBook} from "@plether/perps/PositionProtectionBook.sol";

interface IUSDG {
    function mint(address to, uint256 amount) external;
    function approve(address, uint256) external returns (bool);
    function balanceOf(address) external view returns (uint256);
    function totalSupply() external view returns (uint256);
}

contract MockArbSys {
    function arbBlockNumber() external view returns (uint256) {
        return block.number;
    }
}

/// @notice Addresses of the Arbitrum Sepolia v2.0.0 deployment (state forked at block 326928451, Sat 2026-11-07 12:00:00Z).
/// Setup-only cheats: chainId, warp/roll, ArbSys code at 0x64 (the precompile is not simulated by the local EVM), Pyth mock at the deployed
/// Pyth address (the real Pyth verifies signed VAAs for a price path that does not exist in market history).
abstract contract LiveBase is Test {
    uint256 internal constant PIN_TS = 1794052800;
    uint256 internal constant PIN_BLOCK = 326928451;
    address internal constant OWNER = address(uint160(0x005a71a4094ec81165ada48aa4c27da48ec27e0d6b));

    IUSDG internal token = IUSDG(address(uint160(0x003d051dbbf5ff427a4ae8ad09746902666af8fb9d)));
    MarginClearinghouse internal ch = MarginClearinghouse(address(uint160(0x00b5b851f627d6df3cf3f096e23e20a58884d7b89a)));
    CfdEngine internal engine = CfdEngine(address(uint160(0x00ca18a6783d7542f9d2f28f4f259772b74c4d6baa)));
    HousePool internal pool = HousePool(address(uint160(0x00eb5604c393843b2f3c347ec24fa9ddad6ab2131e)));
    TrancheVault internal senior = TrancheVault(address(uint160(0x005dc42ba5a1e8dd3e1b6868d10f66a9bf8fb5b83d)));
    TrancheVault internal junior = TrancheVault(address(uint160(0x004a8b67184a1e3224c11a191cc69f22c50eef734e)));
    OrderRouter internal router = OrderRouter(payable(address(uint160(0x00918663d6da8cb33b325a04c4a5e8c51d42f3b444))));
    PletherOracle internal oracle = PletherOracle(address(uint160(0x004f2c62a0e03657f52c633c19c11f88d8f0897bb2)));
    PositionProtectionBook internal prot = PositionProtectionBook(address(uint160(0x0081e3b03cf29865b6c0f85925839567e2bc61073d)));
    MockPyth internal pyth;

    function _fund(address a, uint256 amt) internal {
        token.mint(a, amt); // permissionless mint on the testnet Mock USDG (deployed function)
        vm.startPrank(a);
        token.approve(address(ch), type(uint256).max);
        token.approve(address(senior), type(uint256).max);
        token.approve(address(junior), type(uint256).max);
        vm.stopPrank();
    }
}

poc/test-m175/PoCBase.sol

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

import {LiveBase, MockArbSys} from "./LiveBase.sol";
import {MockPyth} from "@plether/test-utils/MockPyth.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {IHousePool} from "@plether/perps/interfaces/IHousePool.sol";
import {TrancheVault} from "@plether/perps/TrancheVault.sol";
import {console2} from "forge-std/console2.sol";

/// Helpers. Price device: MockPyth code placed at the deployed Pyth address; every feed is set so the six-feed basket equals the
/// requested basket price exactly (component 0, the 57.6 percent weight, carries the move; the other five stay at their base).
abstract contract PoCBase is LiveBase {
    uint256 constant LOT = 1e20;
    address internal keeper = address(0xBEEF0001);
    uint256 internal lastTick;
    uint256 internal constant W0 = 57_600_000; // component 0 weight, 8 decimals (0.576)

    function _setUpLive(uint256 startTs) internal {
        // state source: the deployed contracts at the pinned block, through the fork RPC given in M175_FORK_URL
        vm.createSelectFork(vm.envString("M175_FORK_URL"), PIN_BLOCK);
        vm.chainId(421614);
        vm.warp(startTs);
        vm.roll(PIN_BLOCK + (startTs - PIN_TS) / 1); // arbitrum block numbers are not used for timing here; monotone is enough
        MockArbSys m = new MockArbSys();
        vm.etch(address(100), address(m).code);
        address pythAddr = address(oracle.pyth());
        vm.etch(pythAddr, address(new MockPyth()).code);
        pyth = MockPyth(pythAddr);
        vm.deal(keeper, 1000 ether);
    }

    // ------------------------------------------------------------------ price device
    function _feedPx(uint256 i) internal view returns (uint256) {
        uint256 b = oracle.basePrices(i);
        return oracle.inversions(i) ? 1e16 / b : b;
    }
    /// feed vector whose basket equals `tau` (8 decimals; 1e8 = neutral): every component scaled by the same multiplier.
    function _payload(uint256 tau, uint256 t, uint256 prev) internal view returns (bytes[] memory data) {
        MockPyth.FeedUpdate[] memory u = new MockPyth.FeedUpdate[](6);
        for (uint256 i; i < 6; ++i) {
            // uniform multiplier m = tau/1e8 on every component's normalised price: non-inverted raw = base*m, inverted raw = 1e16/(base*m)
            uint256 b = oracle.basePrices(i);
            uint256 px = oracle.inversions(i) ? (1e16 * 1e8) / (b * tau) : (b * tau) / 1e8;
            u[i] = MockPyth.FeedUpdate({id: oracle.pythFeedIds(i), price: MockPyth.MockPrice({price: int64(int256(px)), conf: 0, expo: -8, publishTime: t, prevPublishTime: prev})});
        }
        data = new bytes[](1);
        data[0] = abi.encode(u);
    }
    function _now() internal view returns (uint256) { return vm.getBlockTimestamp(); }
    function _adv(uint256 dt) internal { vm.warp(_now() + dt); vm.roll(vm.getBlockNumber() + 1 + dt / 4); }
    /// permissionless production mark refresh (router.updateMarkPrice), keeper address, payload at `tau`
    function _mark(uint256 tau) internal returns (bool ok, bytes memory err) {
        uint256 pub = _now(); uint256 prev = lastTick; lastTick = pub;
        vm.prank(keeper);
        (ok, err) = address(router).call(abi.encodeWithSignature("updateMarkPrice(bytes[])", _payload(tau, pub, prev)));
    }
    function _markOk(uint256 tau) internal { (bool ok, bytes memory e) = _mark(tau); require(ok, string.concat("u

The original report as published on Immunefi, by FestiveSRT. 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 recapitalization bucket is only reduced by the capped amount applied at reconcile, so the uncapped remainder equal to the terminal deficit stays reserved with no cash behind it and is reused as a bootstrap target.

Impact

A senior LP's redemption is frozen for at least 30 hours and about 14 days until the owner's fourth timelocked lever, and each later settlement lowers the senior high-water mark although no loss occurred; the pool holds cash above its liabilities throughout.

What the attacker needed

Owner performs documented recapitalization; large market move wipes both tranches; senior LP queues an exit; permissionless keeper settles epochs

The fix

The part of the recapitalization that only fills the terminal deficit should be written off rather than kept as a live reservation, so it is not re-applied at later reconciles.

How it was found

  1. Wipe both tranches through ordinary trader activity so the pool is in degraded mode with a terminal deficit.
  2. Have a senior LP queue a full exit.
  3. Owner calls recapitalizePool with an amount above the minimum recovery, then clears degraded mode.
  4. Call settleLpEpoch repeatedly; each call reverts with HousePool__NoLpEpochProgress and the exit is never funded.
  5. Observe that later settlements re-apply the stale remainder and lower the senior high-water mark by one equity slice each time.

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. When trading losses wipe both groups out, the owner is meant to top the pool back up so it can pay people again. The bug is that the pool treats the whole top-up as money already promised to someone, even though part of it was really used to cover old losses, so it thinks it has nothing free to pay a saver who wants to leave.

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 FestiveSRT

View all

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