Skip to content
Business logic Audit finding Advanced

Unassigned Assets Lost in a Deep Drawdown Are Not Restored on Recovery, Moving Ownerless Value to Junior

When a drawdown is deep enough to exhaust LP principal, the unassigned assets bucket is capped at the remaining distributable equity and never restored. On an equal recovery, the drawn-down ownerless value is allocated to junior holders instead of being returned to the bucket.

Hacken Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#99231 [SC-Medium] Unassigned Assets Lost in a Deep Drawdown Are Not Restored on Recovery, Moving Ownerless Value to Junior

Submitted on Nov 12th 2026 at 13:59:28 UTC by @Hacken for Audit Competition | Plether

Description

Vulnerability Details

unassignedAssets holds ownerless value, such as a recapitalization remainder, which only governance can assign through assignUnassignedAssets. LP claims are reconciled against distributable equity minus this bucket, so a loss hits senior and junior principal first. Once LP principal is gone, any further loss caps the bucket at the remaining distributable equity:

Solidity
// HousePoolReconcilePlanLib.sol

plan.state.unassignedAssets =
    state.unassignedAssets > snapshot.distributable ? snapshot.distributable : state.unassignedAssets;

The cap permanently lowers the stored balance, and no path restores it. On recovery, the reconcile treats all equity above the reduced bucket as LP value. It restores senior up to the high-water mark and gives the rest to junior:

Solidity
// HousePoolReconcilePlanLib.sol

uint256 distributableToClaims = snapshot.distributable > plan.state.unassignedAssets
    ? snapshot.distributable - plan.state.unassignedAssets
    : 0;

A loss and an equal recovery therefore end in a different allocation than the one they started from. The part of the bucket that was drawn down ends up with junior.

Example:

Start: S = J = 1,000 and unassigned = 500. A loss of 2,300 leaves 200 of equity. LP principal goes to zero, and unassigned is capped to 200. A full recovery of 2,300 is distributed as S = 1,000, J = 1,300, unassigned = 200. Junior receives 300 of ownerless value. A shallower loss of 1,800 never reaches the bucket and is fully symmetric.

Impact Details

Ownerless value held for governance assignment is moved to junior holders after any drawdown deep enough to reach it. No LP loses funds. The issue is a misallocation of value that governance was meant to assign.

Recommendation

Track the amount drawn down from unassignedAssets and restore it before recovery revenue reaches the waterfall. Alternatively, document that unassigned assets rank below LP claims on recovery.

Proof of Concept

Proof of Concept

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

import {BasePerpTest} from "./BasePerpTest.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";

/// @notice PoC: a drawdown deep enough to reach `unassignedAssets` permanently shrinks the bucket, and an equal
///         recovery hands the drawn-down ownerless value to junior instead of restoring the bucket.
/// @dev Uses BasePerpTest defaults, which match the release risk parameters (maxSkewRatio 0.4e18, baseCarryBps 500).
contract AuditUnassignedDrawdownPoC is BasePerpTest {

    address internal constant TRADER = address(0x7EAD);
    /// @dev Carry and senior coupon accrue over the few seconds between steps; allow a sub-cent tolerance.
    uint256 internal constant TOL = 0.01e6;

    function _initialJuniorDeposit() internal pure override returns (uint256) {
        return 0; // only the 1,000 USDG senior and 1,000 USDG junior seeds
    }

    function _mark(uint256 price) internal {
        // vm.getBlockTimestamp avoids the stale block.timestamp that via-IR can return after vm.warp.
        uint256 last = engine.lastMarkTime();
        uint256 nowTs = vm.getBlockTimestamp();
        uint256 t = (nowTs > last ? nowTs : last) + 1;
        vm.warp(t);
        vm.prank(address(router));
        engine.updateMarkPrice(price, uint64(t));
        vm.prank(address(juniorVault));
        pool.reconcile();
    }

    function test_PoC_drawdownMovesUnassignedAssetsToJunior() public {
        // 1. Start: S = J = 1,000 and 5,000 of ownerless value from a governance recapitalization
        uint256 recap = 5000e6;
        settlementToken.mint(address(this), recap);
        settlementToken.approve(address(engine), recap);
        engine.recapitalizePool(recap); // senior is at its high-water mark, so all of it stays unassigned
        vm.prank(address(juniorVault));
        pool.reconcile();

        assertEq(pool.seniorPrincipal(), 1000e6, "start senior");
        assertEq(pool.juniorPrincipal(), 1000e6, "start junior");
        assertEq(pool.seniorHighWaterMark(), 1000e6, "start senior HWM");
        assertEq(pool.unassignedAssets(), recap, "start unassigned");
        uint256 juniorBefore = pool.juniorPrincipal();
        uint256 unassignedBefore = pool.unassignedAssets();

        // 2. A trader opens a 2,500 USDG long at 1.00 (36% of depth, inside the 40% skew limit)
        uint256 notionalUsd = 2500;
        uint256 margin = notionalUsd * 1e6;
        settlementToken.mint(TRADER, margin);
        vm.startPrank(TRADER);
        settlementToken.approve(address(clearinghouse), margin);
        clearinghouse.deposit(TRADER, margin);
        vm.stopPrank();
        CfdTypes.Order memory order = CfdTypes.Order({
            account: TRADER,
            sizeDelta: notionalUsd * 1e18,
            marginDelta: margin,
            targetPrice: 1e8,
            commitTime: uint64(block.timestamp),
            commitBlock: uint64(block.number),
            orderId: 0,
            side: CfdTypes.Side.LONG,
            isClose: false
        });
        uint256 depth = pool.totalAssets();
        vm.prank(address(router));
        engine.processOrderTyped(order, 1e8, depth, uint64(block.timestamp));

        // 3. Drawdown: the mark moves 96% in the trader's favour, an LP loss of about 2,400.
        //    2,000 of LP principal absorbs the first 2,000; the remaining ~400 reaches the bucket and caps it.
        _mark(0.04e8);
        assertEq(pool.juniorPrincipal(), 0, "junior wiped");
        assertEq(pool.seniorPrincipal(), 0, "senior wiped");
        uint256 cappedUnassigned = pool.unassignedAssets();
        assertLt(cappedUnassigned, unassignedBefore, "drawdown capped the ownerless bucket");
        assertApproxEqAbs(unassignedBefore - cappedUnassigned, 400e6, TOL, "about 400 of ownerless value drawn down");

        // 4. Full recovery: the mark returns to the entry price, so the trader's gain disappears
        _mark(1e8);

        // Senior is restored only to its high-water mark; the bucket is NOT restored; junior gets the difference.
        assertApproxEqAbs(pool.seniorPrincipal(), 1000e6, TOL, "senior back to HWM");
        assertEq(pool.unassignedAssets(), cappedUnassigned, "bucket never restored on recovery");
        assertApproxEqAbs(pool.juniorPrincipal(), juniorBefore + 400e6, TOL, "junior received ~400 of ownerless value");

        // Same mark and same pool cash as in step 1, yet ~400 of ownerless value moved from the bucket to junior.
        uint256 movedToJunior = pool.juniorPrincipal() - juniorBefore;
        assertApproxEqAbs(movedToJunior, unassignedBefore - pool.unassignedAssets(), TOL, "value moved bucket -> junior");
        emit log_named_decimal_uint("unassigned before drawdown", unassignedBefore, 6);
        emit log_named_decimal_uint("unassigned after recovery ", pool.unassignedAssets(), 6);
        emit log_named_decimal_uint("junior before drawdown    ", juniorBefore, 6);
        emit log_named_decimal_uint("junior after recovery     ", pool.juniorPrincipal(), 6);
    }
}

The original report as published on Immunefi, by Hacken. 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

The reconciliation logic caps the unassigned assets bucket at the remaining distributable equity during a loss but does not track or restore the drawn-down amount on recovery, so recovered equity above the reduced bucket is treated as LP value.

Impact

Ownerless value held for governance assignment is moved to junior holders after any drawdown deep enough to reach it; no LP loses funds, but value is misallocated.

What the attacker needed

Governance recapitalization creates unassigned assets; a drawdown deep enough to exhaust LP principal; a subsequent recovery

The fix

Track the amount drawn down from unassignedAssets and restore it before recovery revenue reaches the waterfall, or document that unassigned assets rank below LP claims on recovery.

How it was found

  1. Seed the pool with senior and junior principal and add ownerless value via recapitalization.
  2. Open a large long position within the skew limit.
  3. Move the mark price sharply against the pool to cause a deep drawdown that reaches the unassigned bucket.
  4. Move the mark price back to the entry price for a full recovery.
  5. Observe that senior is restored to its high-water mark, the bucket remains capped, and junior receives the difference.

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 some money that no one owns yet, waiting for governance to decide where it goes. If the pool loses enough money to wipe out the investors' principal, this ownerless money is also reduced. When the pool later recovers, the missing ownerless money is not put back; instead it is given to the junior investors. So a loss followed by an equal gain leaves the money in a different place than before.

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 Hacken

View all

1 more disclosed report, 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.