Junior share-supply overflow makes a matured redemption head permanently freeze Junior LP funds
Ordinary Junior deposits can push the raw Junior share supply to 2^256 - 2, at which point the vault's checked addition of virtual shares overflows and panics. A matured Junior redemption head then blocks every later Junior settlement, leaving an honest Junior LP's shares unredeemable even after pause, recapitalisation or a very long time warp.
- Disclosed after under an hour
#99911 [SC-Critical] Junior share-supply overflow makes a matured redemption head permanently freeze Junior LP funds
Submitted on Nov 15th 2026 at 17:54:27 UTC by @legat for Audit Competition | Plether
- Report ID: #99911
- Report Type: Smart Contract
- Report severity: Critical
- Target: https://github.com/immunefi-team/audit-comp-plether/blob/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src/TrancheVault.sol
- Impacts:
- Permanent freezing of funds
Description
Asset
Tested version and environment
Repository: https://github.com/immunefi-team/audit-comp-plether
Commit: a82d4fefb02768e5b3bddcc97dee371eee24fea8
Category: Smart Contract
Execution: Local Foundry test using the repository's production-topology perps fixture
Token: USDG, 6 decimals
Compiler: Solidity 0.8.35, optimizer 200, via-IR
The test runs the scoped production HousePool, both TrancheVaults, CfdEngine and redemption math sidecar. The repository fixture uses MockSettlementToken solely to provision each actor's USDG and MockPyth to hold an unchanged cached price. These are outside-scope test components; no in-scope accounting or settlement implementation is replaced or patched. The test uses the release 1-USDG seed positions, 800-bps annual Senior coupon, 40-million-USDG Senior cap, 80% Senior share cap, zero Junior maintenance fee, one-hour LP epochs, five-minute request cutoff, 0.01e18 VPI factor and 0.4e18 maximum skew ratio. No position is opened, so price feeds and VPI are not causal.
Impact
Impact: Permanent freezing of funds
Summary
Plether's Junior Vault can mint raw shares near the uint256 limit through ordinary deposits after Senior coupon accrual has reduced Junior principal to a small positive amount. At raw supply 2^256 - 2, both the Junior deposit quote and the Junior redemption pricing path add 1,000 virtual shares in checked arithmetic and panic. An attacker can place a funded Junior redemption request just after the cutoff for the epoch in which its final deposit lands. That redemption head matures one epoch later, so every LP settlement that reaches the Junior redemption phase panics before the Pool's pause and deposit-deferral checks. The head cannot be cancelled after maturity, and every new Junior redemption request also panics at its estimate. An independently funded Junior LP is left with valuable shares and no working exit.
The PoC proves this with an honest Junior LP who deposited 30 USDG. Its pre-landing redemption estimate is 29,999,992 atoms; a control branch actually settles and pays out 29,999,984 atoms. After the overflow landing, the LP retains a conservative value lower bound of 29,999,983 atoms but cannot request an exit. A separate attacker-funded 2-USDG Junior position supplies the timed redemption head. The test confirms the failure under pause(), after owner recapitalization and Senior assignment, and after an 827-year time warp. It also tests the Senior backlog exception: 16 of 17 hourly Senior redemption heads can be funded before the Junior phase, while the final Senior tail head remains blocked. The permanent impact claimed here is Junior LP principal, not an assertion that every Senior LP has no workaround.
Finding Description
Intended behavior
An accepted Junior deposit must either mint shares on epoch settlement or remain refundable. A funded Junior redemption request must either receive an asset payout or reach a refund path, and a third-party Junior LP must be able to request redemption of its own valuable shares. The bounded LP epoch phases are meant to progress even when one request cannot be priced. Senior coupon accrual and normal LP deposits and withdrawals are supported release flows; neither requires a privileged attacker.
Actual behavior
The attacker deposits 2,007,000 USDG in Junior and 7,999,000 USDG in Senior. At the release 800-bps Senior coupon, about 3.0 years without sufficient offsetting Junior revenue reduces Junior principal to 100003455 atoms while it stays positive. The attacker then makes 59 hourly Junior top-ups, keeping principal positive while each mint receives many more shares per USDG. In the last top-up epoch, it redeems its Senior shares, leaving seed-scale Senior principal. A funded Junior redemption sets raw Junior supply to exactly 2^255 - 501; an ordinary final Junior deposit equal to the following epoch's post-coupon Junior principal plus one atom mints the exact complementary shares. Raw supply becomes 2^256 - 2.
Escrow leg. A separate user submits a 1,000-USDG Junior deposit after the final mint. TrancheVault._requestDeposit transfers the user's assets into escrow without quoting shares (TrancheVault.sol:577-600). On maturity, HousePool._settleDepositPhase calls quoteDepositFromState (HousePool.sol:1030-1048), whose pricingSupply + VIRTUAL_SHARES at TrancheVault.sol:1409 panics before the zero-share rejection/refund branch. The user's matured cancellation fails under TrancheVault.sol:848-860. The test prints an 827-year projected-coupon self-cancel wait if no recovery action occurs and demonstrates that the user can eventually cancel after that wait. The recovery paths and timings are disclosed below; they do not remove the observed freeze before intervention.
Permanent redemption-head leg. A third party independently deposits 30 USDG into Junior; the attacker funds a separate, dust-sized Junior LP address with 2 USDG. Before the final mint, the test's control branch settles the third party's full redemption and pays 29,999,984 atoms. The attacker submits the final deposit before the next epoch cutoff, then the dust address submits a full redemption after that cutoff. The requests receive successive epoch IDs. The final deposit is settled while the dust redemption is still immature, so raw supply lands at 2^256 - 2 without the dust head being processed. One epoch later, the dust head matures. HousePool._fundRedemptionPhase calls netAssetsForShares at HousePool.sol:957; HousePoolRedemptionMathLib.sol:46 evaluates supply + 1000 and panics before the Pool can process a refund. The dust head is now too old to cancel (TrancheVault.sol:895-896). The honest LP's new requestRedeem calls estimateRedeemAssets and also panics (TrancheVault.sol:1385-1388,1611-1617). An ordinary share transfer succeeds at the release zero maintenance-fee APR (TrancheVault.sol:314-333), but the recipient's requestRedeem reaches the same overflowing estimate, so moving the shares does not restore an exit.
pause() returns before Junior deposit pricing but only after the Junior redemption phase (HousePool.sol:878-912); it cannot bypass this matured head. Owner recapitalization and assignUnassignedAssets(true, ...) increase Senior principal but do not clear the Junior head or lower Junior share supply. pauseLpEpochSettlement() stops clearing entirely. The test confirms the panic after each action and after an 827-year warp. A same-state control without the dust request allows an owner-funded Senior redemption under pause(). Senior LPs have a narrower escape: more than 16 separate matured Senior epoch heads make the Pool return at the Senior work limit before reaching Junior; the test funds 16 and shows the last tail head remains blocked. No analogous Junior bypass is available because the failing head is the first statement of its pricing loop.
CECuro MED-24, “LP can delay other redeemers with zero-payout refund epochs” (Acknowledged and listed open in scope.txt:131), has published locations HousePool.sol:932-967 and TrancheVault.sol:1483-1501. Its accepted limitation says, “Zero-payout redemption epochs can consume settlement work and require additional calls before later epochs are funded.” Those heads reach the refund branch and later calls can progress. This head panics at HousePoolRedemptionMathLib.sol:46 through HousePool.sol:957 before HousePool.sol:960-987 can refund it; additional calls repeat the panic. CECuro LOW-72, “Pending depositor can receive impossible share quotes for a wiped tranche” (Addressed), concerns an indicative quote under a projected zero-principal wipe. Its fix at TrancheVault.sol:1366-1368 remains present; here Junior principal is positive (82,868,039 atoms). Under the same-root test in scope.txt:130, neither disclosure covers this checked-arithmetic, matured-head failure. The root is independent of Junior maintenance fees: release APR is zero (DEPLOYMENT.md:152, asserted in the PoC), so this is not an inactive-feature issue under scope.txt:148.
Recovery and operational limits
The owner has documented, legitimate recovery powers; the PoC and this report disclose them. At the escrow-leg end state, Junior principal is 82,868,039 atoms and Senior principal/high-water mark is 1,252,437 atoms. CfdEngine.recapitalizePool (CfdEngine.sol:632-653) followed by HousePool.assignUnassignedAssets(true, ...) (HousePool.sol:660-703) can increase Senior principal without quoting the overflowed Junior supply. Owner/pauser pause() (HousePool.sol:388-390) lets Senior redemptions settle before the stuck deposit quote. The test executes both the recapitalization and the paused Senior redemption. An owner can also propose a higher Senior coupon and share cap; finalizePoolConfig is not blocked by the overflow state, although a rate change needs a fresh mark (HousePool.sol:306-376,1484). The rate/share change has a 72-hour timelock.
| Escrow-leg recovery action | Earliest cancellation at the logged state |
|---|---|
| No owner action; permissionless projected-coupon self-cancel | 26,082,414,503 seconds, about 827 years |
| Immediate owner recapitalization and Senior assignment at the release 80% share cap and 800-bps rate | 98,550,280 seconds, about 3.125 years; executed in the PoC |
| Above plus a 100% annual Senior rate after the 72-hour timelock | About 93.9 days total, derived from the quoted coupon formula |
| Above plus a 99.99% Senior share cap in the same timelocked proposal | About 72.9 hours total, requiring approximately 826,086 USDG of additional owner capital at the logged state |
The latter two figures are source-derived bounds printed by the test, not transactions that the test executes. The owner-funded recapitalization is real capital, not a privileged attacker step. assignUnassignedAssets(false, ...) would quote the Junior Vault and panic; the Senior assignment route is the operative one. None of these escrow recovery actions burns the matured redemption head or reduces the overflowed Junior share supply. The permanently frozen honest Junior principal in the second leg therefore remains the selected impact. A severe trader loss that wipes Junior principal might open the escrow-leg cancellation guard sooner, but the redemption-head quote still adds 1,000 to the raw supply and panics; the PoC shows that even the 827-year projected-wipe horizon does not clear it.
Root Cause
TrancheVault.quoteDepositFromState and the ERC-4626 conversion paths use supply + VIRTUAL_SHARES without an enforced upper bound on mintable raw supply (TrancheVault.sol:1400-1409,1853-1866). Ordinary deposits can therefore land a raw supply at which this expression overflows. Separately, HousePool._fundRedemptionPhase invokes HousePoolRedemptionMathLib.netAssetsForShares before it can decide to refund a zero-value head (HousePool.sol:957-987); that math also computes supply + virtualShares in checked arithmetic (HousePoolRedemptionMathLib.sol:34-46). A matured head cannot be cancelled and has no separate permissionless skip or refund entrypoint, so the panic forms a persistent queue barrier.
Impact Explanation
An honest Junior LP's own approximately 30 USDG of principal remains represented by shares but cannot be redeemed. Before the landing, its full-balance redemption estimates 29,999,992 atoms; the completed control redeems and pays 29,999,984 atoms, with Junior principal decreasing. After the landing, the PoC's conservative value lower bound is 29,999,983 atoms, but the same LP's redemption request panics. The attacker also traps its 2-USDG dust head and its remaining Junior shares. This is freezing of principal, not theft or a claim on unclaimed yield. The Junior queue cannot reach its refund/funding mutations because the checked addition panics first. Even if an owner recovers the separate 1,000-USDG deposit escrow, the matured redemption head and valuable Junior shares remain stuck. Senior redemptions can be made to progress through the 16-epoch backlog workaround; the last tail request remains blocked. Already claimable, previously finalized assets are not asserted to be frozen.
Likelihood Explanation
The setup requires the attacker to provide about 10 million USDG of initial Senior and Junior capital, become effectively the sole non-seed Senior LP for the decisive withdrawal, and wait about 3.0 years with insufficient Junior revenue to offset the Senior coupon. The attacker then pays for 59 hourly top-ups and must coordinate the final deposit and dust redemption across the five-minute request cutoff and consecutive one-hour epochs. A permissionless LP settlement must land the final deposit in its assigned epoch; otherwise the dust head can mature and be funded before the unsafe mint. The attacker's final Junior deposit must be the only Junior entry maturing in that epoch to land the exact 2^256 - 2 supply; a competing entry can shift the cumulative quote, so the attacker must observe the queue and retry in a later epoch. These conditions make the sequence difficult, but every transaction in the PoC follows an in-scope public path at release parameters. The program calculates impact separately from feasibility and does not treat capital alone as a reason to change the impact (scope.txt:158-162).
The attacker does not need owner, pauser, guardian or sequencer authority, an incorrect parameter, a Pyth error, or an inactive feature. The honest Junior LP contributes its own 30 USDG in an ordinary deposit; its post-landing claim is measured in the PoC. The 1,000-USDG escrow leg has the recovery options stated above; those actions do not decide whether the arithmetic defect and permanent Junior-share freeze occur.
Attack Path / Reproduction Path
- With 1-USDG Senior and Junior seeds and the release 800-bps coupon and 40M/80% Senior limits, deposit 2,007,000 USDG in Junior and 7,999,000 USDG in Senior as the attacker. A same-amount 1,000-USDG third-party Junior deposit control activates normally before the attack.
- Advance about 3.0 years with no offsetting Junior revenue, then settle. Keep Junior principal positive near 100 USDG. Perform 59 hourly Junior top-ups; redeem the attacker's Senior shares during the last top-up epoch.
- For the escrow leg, redeem enough attacker Junior shares to leave
2^255 - 501raw supply, then deposit post-coupon Junior principal plus one atom. Settle to land2^256 - 2. In a later epoch, accept a separate user's 1,000-USDG Junior deposit. Two settlement calls panic; its matured cancellation reverts. Recapitalize/assign Senior and show the resulting owner-funded recovery and paused Senior redemption, then show the 827-year permissionless self-cancel. - Restore the amplified state. Before the final burn, have an honest Junior LP deposit 30 USDG and an attacker dust address deposit 2 USDG. Burn only the attacker's shares to leave the same
2^255 - 501raw supply, preserving both other LPs' shares and their funded value. From that same pre-final-mint state, first run and reverse a control where the honest LP redeems its full balance, receives29,999,984atoms, and Junior principal falls. - Before the cutoff, submit the final attacker Junior deposit for epoch
502479. After that cutoff, submit the dust full redemption for epoch502480. Settle in502479: the dust head is not matured and the raw supply lands at2^256 - 2. - In
502480, show the dust head is matured. Settlement panics at the Junior redemption quote. Dust cancellation reverts, and the honest LP's new redemption request panics. Repeat afterpause(), owner recapitalization plus Senior assignment, and the dedicated LP settlement pause. Show that the failure persists after an 827-year warp. - Queue 17 separate hourly Senior redemption heads. One settlement funds 16 before reaching Junior; the final tail remains and the next settlement panics. Rewind to the same state without the dust request: after the overflow landing,
pause()permits a Senior redemption to fund. This isolates the matured Junior head as the blocker.
External Preconditions
- The active, in-scope Senior and Junior tranches operate with the release coupon, caps, seed values, and ordinary LP epoch rules.
- The attacker can fund the initial LP positions and hourly top-ups and be effectively the sole non-seed Senior LP at its withdrawal. The other Junior LP is independently funded.
- Junior receives insufficient offsetting revenue over the long setup period, or reaches a comparable small-positive-principal state through another legitimate sequence. The PoC uses the first path only.
- The attacker can submit ordinary requests around a public five-minute cutoff, and a permissionless LP keeper settles the final deposit in its designated epoch.
Internal Preconditions
- Junior principal remains greater than zero during the final mint; a projected terminal wipe would defer new Junior activation.
- The final mint occurs while the dust redeem head is queued for the following epoch. The head is not matured at landing but is matured at the next LP settlement. The attacker's final deposit is the only Junior entry maturing in its epoch:
HousePool.sol:1043-1045quotes the cumulative batch, so another entry would change the exactA_final = P+1landing. A co-landing honest deposit would also be frozen if the overflow still occurred, but the PoC's exact integer landing needs this exclusivity. - The honest Junior LP has already activated its shares. Its pre-landing full redemption estimate is
29,999,992atoms; the control completes and pays29,999,984atoms. It retains at least29,999,983atoms of conservative value at landing. The dust address has passed the deposit cooldown and submits a full redemption before the overflowed conversion is reached. - Raw Junior supply remains
2^256 - 2and the matured dust head remains unrefunded. Neitherpause()nor Senior recapitalization lowers the supply or removes that head.
Affected Code
packages/perps/src/TrancheVault.sol:545-555,577-600assigns request epochs and escrows deposit assets before a quote.packages/perps/src/TrancheVault.sol:895-896,1385-1409,1611-1617,1853-1866blocks matured redeem cancellation and overflows in Junior share conversion and quoting.packages/perps/src/HousePool.sol:824-935,957-987,1030-1048processes Senior then Junior redemptions before pause/deposit checks and quotes deposits before the refund branch.packages/perps/src/libraries/HousePoolRedemptionMathLib.sol:34-46computessupply + virtualSharesbefore the zero-payout refund decision.packages/perps/src/libraries/HousePoolWaterfallAccountingLib.sol:47-86moves Junior principal to Senior coupon while the Junior share supply persists.
Recommended Mitigation
Enforce a conservative maximum on raw and accrued tranche share supply before any mint can make supply + VIRTUAL_SHARES unsafe in a deposit, redemption, or ERC-4626 conversion. Include the next request's full cumulative epoch mint in the bound. For an already accepted request whose quote cannot be represented, provide a bounded, permissionless way to reject/refund the request and advance the queue without first evaluating the failing arithmetic. Apply the same guarantee to matured redemption heads so a quote failure cannot block every later Junior exit. Verify that a Junior failure does not roll back otherwise fundable Senior work and that pause and recovery paths remain effective.
Proof of Concept
Description
The single complete Foundry test below exercises the scoped production Pool, both Vaults, Engine, and redemption sidecar through ordinary asynchronous LP requests, cooldowns, one-hour epoch settlement, claims and redemption. It proves both the long-lived 1,000-USDG escrow leg and the stronger permanent Junior redemption-head leg. It asserts the same-amount ordinary deposit control, an honest LP's completed 29,999,984-atom redemption control, exact raw supply 2^256 - 2, the dust request's one-epoch-later maturity, the honest LP's remaining funded value, panic 0x11, cancellation errors, the owner recovery, the paused Senior exit, the 17-head Senior bypass, and a same-state control without the dust head. Time is simulated with Foundry vm.warp; no public network is touched. The fixture mints test USDG to represent the actors' funded capital and uses no mock of an in-scope accounting component.
Where to place files and their names
Save the one complete authored source file below at the following path under the frozen repository root:
packages/perps/test/perps/poc/JuniorVirtualOffsetOverflowE2E.t.sol
This is the only authored file added for the PoC; no scoped production source is modified. Source SHA-256: 04e5d15953fd7b47e9c22d027016e5a340e731cf79c677341e3d2ad07dc6910a. Fresh log SHA-256: c8e7d8d80f45adc777ca27ccc84e9b1a4d3f1e0df059521179e728ed0fcb7d37.
Clean clone and exact run command
git clone https://github.com/immunefi-team/audit-comp-plether.git audit-comp-plether
cd audit-comp-plether
git checkout --detach a82d4fefb02768e5b3bddcc97dee371eee24fea8
git submodule update --init --recursive
mkdir -p packages/perps/test/perps/poc
# Save the complete authored Solidity source block below at packages/perps/test/perps/poc/JuniorVirtualOffsetOverflowE2E.t.sol
cd packages/perps
forge test --offline --match-path test/perps/poc/JuniorVirtualOffsetOverflowE2E.t.sol -vv
The sealed run used Forge 1.8.1 (982849d3140c01fd3b72905759581a132df7aa98) on macOS 27.2.1. The authored source and complete fresh passing log follow.
Complete authored source
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.35;
import {HousePoolAsyncTestBase} from "../shared/HousePoolTestBase.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {TrancheVault} from "@plether/perps/TrancheVault.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {console2} from "forge-std/console2.sol";
/// @notice Release-parameter trace of the coupon/refill producer for Junior virtual-share overflow.
contract JuniorVirtualOffsetOverflowE2E is HousePoolAsyncTestBase {
address internal constant ATTACKER = address(0xA11CE);
address internal constant VICTIM = address(0xB0B);
function _initialJuniorDeposit() internal pure override returns (uint256) { return 0; }
function _initialSeniorDeposit() internal pure override returns (uint256) { return 0; }
function _initialJuniorSeedDeposit() internal pure override returns (uint256) { return 1e6; }
function _initialSeniorSeedDeposit() internal pure override returns (uint256) { return 1e6; }
function _riskParams() internal pure override returns (CfdTypes.RiskParams memory p) {
p = super._riskParams();
p.vpiFactor = 0.01e18;
p.maxSkewRatio = 0.4e18;
}
function test_JuniorShareOverflowFreezesDepositsAndRedemptions() public {
_setSeniorCapacity(40_000_000e6, 8000);
assertEq(pool.seniorRateBps(), 800);
assertEq(pool.maxSeniorExposureAssets(), 40_000_000e6);
assertEq(pool.maxSeniorShareBps(), 8000);
assertEq(engine.executionFeeBps(), 4);
assertEq(juniorVault.maintenanceFeeAprBps(), 0);
_fundJunior(ATTACKER, 2_007_000e6);
_fundSenior(ATTACKER, 7_999_000e6);
uint256 ordinaryControlSnapshot = vm.snapshotState();
uint256 ordinaryControlId = _requestAsyncDeposit(juniorVault, VICTIM, 1_000e6);
_settleAsyncRequest(ordinaryControlId, false);
uint256 ordinaryControlShares = _claimAsyncDeposit(juniorVault, ordinaryControlId, VICTIM);
assertGt(ordinaryControlShares, 0, "the same 1000 USDG request normally activates");
console2.log("ordinary 1000 USDG control shares", ordinaryControlShares);
assertTrue(vm.revertToState(ordinaryControlSnapshot), "restore before attack setup");
uint256 juniorBefore = pool.juniorPrincipal();
uint256 seniorBefore = pool.seniorPrincipal();
uint256 q = (seniorBefore + juniorBefore) * 800 * 3600 / (10_000 * 365 days);
uint256 targetJunior = 100e6;
uint256 elapsed = (juniorBefore - targetJunior) * 10_000 * 365 days / (seniorBefore * 800);
uint256 targetTime = pool.lastSeniorCouponCheckpointTime() + elapsed;
console2.log("initial J atoms", juniorBefore);
console2.log("initial Sp atoms", seniorBefore);
console2.log("next hourly coupon atoms", q);
console2.log("target timestamp", targetTime);
_finishAsyncCooldown(seniorVault, ATTACKER);
uint256 seniorShares = seniorVault.convertToShares(2e6);
_requestAsyncRedeem(seniorVault, ATTACKER, seniorShares);
vm.warp(targetTime);
_settleLpEpochForTest();
console2.log("post-long J atoms", pool.juniorPrincipal());
console2.log("post-long Sp atoms", pool.seniorPrincipal());
console2.log("post-long raw Junior S", juniorVault.totalSupply());
console2.log("next actual hourly coupon atoms", pool.seniorPrincipal() * 800 * 3600 / (10_000 * 365 days));
assertGt(pool.juniorPrincipal(), 0, "coupon must leave positive Junior principal");
uint256 targetSupply = Math.mulDiv(type(uint256).max, 6, 10);
bool seniorExited;
for (uint256 i; i < 120 && juniorVault.totalSupply() < targetSupply; ++i) {
uint256 beforeSupply = juniorVault.totalSupply();
uint256 beforePrincipal = pool.juniorPrincipal();
uint256 beforeSenior = pool.seniorPrincipal();
(uint256 epoch,) = juniorVault.getRequestEpochWindow();
uint256 maturity = pool.lpEpochStart(epoch);
uint256 due = beforeSenior * 800 * (maturity - pool.lastSeniorCouponCheckpointTime())
/ (10_000 * 365 days);
assertGt(beforePrincipal, due, "coupon must not wipe Junior before activation");
uint256 afterCoupon = beforePrincipal - due;
uint256 amount = due;
uint256 maxAmount = Math.mulDiv(targetSupply - beforeSupply, afterCoupon + 1, beforeSupply + 1000);
bool capped = amount > maxAmount;
if (capped) {
amount = Math.mulDiv(targetSupply - beforeSupply, afterCoupon + 1, beforeSupply + 1000);
_requestAsyncRedeem(seniorVault, ATTACKER, seniorVault.balanceOf(ATTACKER));
seniorExited = true;
}
assertGe(amount, 1e6, "eligible one-dollar minimum deposit");
uint256 requestId = _requestAsyncDeposit(juniorVault, ATTACKER, amount);
assertEq(requestId, epoch);
console2.log("settling cycle", i);
console2.log("request epoch", requestId);
console2.log("cycle pre J", beforePrincipal);
console2.log("cycle projected due", due);
_settleAsyncRequest(requestId, false);
_claimAsyncDeposit(juniorVault, requestId, ATTACKER);
if (i % 10 == 0 || capped) {
console2.log("cycle", i);
console2.log("cycle timestamp", block.timestamp);
console2.log("cycle J atoms", pool.juniorPrincipal());
console2.log("cycle raw Junior S", juniorVault.totalSupply());
}
if (capped) break;
}
assertTrue(seniorExited, "senior exits at capped amplification epoch");
console2.log("post producer senior principal", pool.seniorPrincipal());
console2.log("post producer junior principal", pool.juniorPrincipal());
assertGe(juniorVault.totalSupply(), targetSupply - targetSupply / 1e6, "amplification reaches target supply");
uint256 preBurnSnapshot = vm.snapshotState();
uint256 halfMinus500 = type(uint256).max / 2 - 500;
uint256 burnShares = juniorVault.totalSupply() - halfMinus500;
_finishAsyncCooldown(juniorVault, ATTACKER);
uint256 burnRequest = _requestAsyncRedeem(juniorVault, ATTACKER, burnShares);
_settleAsyncRequest(burnRequest, false);
console2.log("post burn raw Junior S", juniorVault.totalSupply());
console2.log("post burn Junior P atoms", pool.juniorPrincipal());
console2.log("post burn Senior Sp atoms", pool.seniorPrincipal());
console2.log("post burn Senior HWM minus Sp atoms", pool.seniorHighWaterMark() - pool.seniorPrincipal());
assertEq(juniorVault.totalSupply(), halfMinus500, "funded burn reaches half-minus-500");
// A separate ordinary request still settles before the final overflow mint.
uint256 controlSnapshot = vm.snapshotState();
uint256 controlRequest = _requestAsyncDeposit(juniorVault, VICTIM, 1e6);
_settleAsyncRequest(controlRequest, false);
uint256 controlShares = _claimAsyncDeposit(juniorVault, controlRequest, VICTIM);
assertGt(controlShares, 0, "control request must activate");
console2.log("pre-overflow control shares", controlShares);
assertTrue(vm.revertToState(controlSnapshot), "return to pre-control state");
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 share-to-asset maths adds virtual shares to the raw supply in checked arithmetic without bounding the mintable supply, and the redemption phase evaluates that maths before it can refund or skip a zero-value head.
Impact
An honest Junior LP's principal remains represented by shares but cannot be redeemed, and the freeze persists through pause, owner recapitalisation and an 827-year warp, although Senior LPs have a partial 16-epoch backlog workaround and the separate escrow deposit has slow owner-funded recovery paths.
What the attacker needed
About 10 million USDG of attacker capital; roughly 3 years of coupon accrual; attacker is effectively sole non-seed Senior LP; final deposit is the only Junior entry that epoch
The fix
A conservative maximum on raw and accrued tranche share supply should be enforced before any mint, and a bounded permissionless way to reject or refund an unquotable request should advance the queue without evaluating the failing arithmetic.
How it was found
- Deposit large Junior and Senior positions and let Senior coupon accrue for about three years with little Junior revenue, then make 59 hourly Junior top-ups and redeem the Senior shares.
- Redeem attacker Junior shares to leave raw supply at 2^255 - 501, then deposit the post-coupon Junior principal plus one atom and settle so raw supply lands at 2^256 - 2.
- Have an honest Junior LP deposit 30 USDG and a dust address deposit 2 USDG before the final burn, and run a control where the honest LP redeems successfully.
- Submit the final attacker Junior deposit before the epoch cutoff and the dust full redemption after it, then settle the deposit epoch so the dust head is still immature.
- In the next epoch the dust head matures; settlement panics at the Junior redemption quote, dust cancellation reverts and the honest LP's new redemption request panics.
- Repeat after pause, owner recapitalisation with Senior assignment and the LP settlement pause, and after an 827-year warp, to show the failure persists.
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 vault tracks how many shares exist and adds a small fixed number (virtual shares) when converting between shares and money. If the share count grows so large that adding that small number no longer fits in the number type, the maths crashes and the transaction reverts. Because a queued redemption is processed before any refund or skip logic, that crash repeats forever and blocks everyone behind it in the queue.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.