Already-expired predecessor close stays linked, admitting a doomed reversal open whose victim-funded execution bounty an unrelated public keeper collects
The router's admission projection treats an already-expired pending close as still reducing the live position, so a later opposite-side reversal open is admitted even though the close can never execute. That doomed reversal reserves a bounty which any unrelated public keeper can then collect from the trader's settlement balance.
Originally disclosed on Immunefi
- Disclosed after under an hour
#99005 [SC-Insight] Already-expired predecessor close stays linked, admitting a doomed reversal open whose victim-funded execution bounty an unrelated public keeper collects
Submitted on Nov 11th 2026 at 11:57:41 UTC by @FestiveSRT for Audit Competition | Plether
- Report ID: #99005
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/immunefi-team/audit-comp-plether/tree/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src
- Impacts:
- Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Description
Summary
The Router admits a trader's opposite-side reversal order by projecting the live position through every pending order linked to that account, including pending full/partial closes. That projection checks only a risk-off cutoff; it never compares a linked close's own execution deadline, or its pinned configuration hash, against current state. The canonical execution path a few lines away in the same package enforces exactly that deadline/config check before doing any oracle work.
The effect: once a trader's pending full close is already past its own execution window (an
ordinary 60-second window that elapses whenever nobody happens to execute the close in time -- no
attacker action is needed to create this state), the account's live position still reads as flat
to the projection used at admission. A later opposite-side ("reversal") open is then admitted as
if the account had actually closed, even though the close can never execute at this point except
as a no-op terminal failure. The reversal open reserves an ordinary, victim-funded execution
bounty. Because the reversal's own live-position precondition was never real, the reversal order
itself can likewise only ever terminate as a failure (it either executes into
PlannerRejected/MUST_CLOSE_OPPOSING against the still-live original position, or elapses its own
window and expires) -- and both ordinary terminal paths for a failed order pay its reserved bounty
to whichever address calls the public cleanup entrypoint, with no further eligibility check tying
that address to the trader. An unrelated, un-roled public keeper collects it. The trader's
original position is left completely unchanged; the only effect of the whole sequence is a
transfer of the trader's own settlement balance to the keeper for nothing.
In plain terms: any ordinary trader whose pending close happens to go unexecuted past its 60-second window can be made to fund a bounty payout to an unrelated stranger, with no key, password, or special role on the stranger's part, and with no mistake by the trader beyond submitting an ordinary, otherwise-unremarkable reversal order. A strategic keeper does not even need to wait for this to happen by chance: because nothing stops it, the keeper can simply leave an already-expired close linked and not clean it up, wait for the account's own next ordinary order, and then collect the bounty.
Root cause
OrderLiquidationBatchLogic._queuedPosition (packages/perps/src/router/OrderLiquidationBatchLogic.sol:367-402)
projects every pending order linked to an account, netting pending closes against the live
position and pending opens on top of it, to decide whether a later opposite-side open must be
rejected:
function _queuedPosition(
IOrderLiquidationBatchHost host,
ICfdEngineCore engine,
address account
) private view returns (QueuedPositionView memory queuedPosition) {
(uint256 positionSize,,,, CfdTypes.Side side,,) = engine.positions(account);
if (positionSize != 0) {
queuedPosition.exists = true;
queuedPosition.side = side;
queuedPosition.size = positionSize;
}
uint64 riskOffCutoff = IOrderRouterEmergencyAdmin(host.admin()).riskOffOrderCutoff();
for (uint64 orderId = host.accountHeadOrderId(account); orderId != 0;) {
(IOrderRouterAccounting.PendingOrderView memory pending, uint64 nextOrderId) =
host.getPendingOrderView(orderId);
if (riskOffCutoff == 0 || orderId > riskOffCutoff || pending.isClose) {
if (pending.isClose) {
if (queuedPosition.exists && pending.side == queuedPosition.side) {
queuedPosition.size =
queuedPosition.size > pending.sizeDelta ? queuedPosition.size - pending.sizeDelta : 0;
if (queuedPosition.size == 0) {
queuedPosition.exists = false;
}
}
} else if (!queuedPosition.exists) {
...
}
}
orderId = nextOrderId;
}
}
The only gate on whether a linked pending close is applied is riskOffCutoff == 0 || orderId > riskOffCutoff || pending.isClose, which is true for every ordinary close regardless of its age.
_queuedPosition's return value is then trusted directly at admission
(OrderLiquidationBatchLogic.sol:423-437) to decide whether a later opposite-side open must be
rejected with MUST_CLOSE_OPPOSING.
The canonical execution path enforces a strictly stronger predicate a few lines away in the same
file, OrderRouterExecutionSidecar.executeOrderItemFromSidecar
(packages/perps/src/OrderRouterExecutionSidecar.sol:371, 388-394, 400-414), independently verified
by reading that function directly:
if (block.timestamp > pending.timing.executionDeadline) {
try book.validateBountyFunding(request.orderId) {}
catch {
return _recoverExpired(request);
}
} else {
book.validateBountyFunding(request.orderId);
}
...
if (block.timestamp > pending.timing.executionDeadline) {
return _settleNonEngine(
request,
OrderV3Types.TerminalReason.Expired,
...
);
}
...
bytes32 observedConfigHash = ...;
bytes32 expectedConfigHash = pending.bounds.expectedConfigHash;
if (expectedConfigHash != bytes32(0) && observedConfigHash != expectedConfigHash) {
...
return _settleNonEngine(
configRequest,
OrderV3Types.TerminalReason.ConfigMismatch,
...
);
}
This is the function that actually tries to execute or terminalize an order, and it classifies an
order whose executionDeadline has strictly elapsed (block.timestamp > ...) as Expired, and
one whose pinned expectedConfigHash no longer matches as ConfigMismatch, in both cases before
doing any oracle work and in both cases leaving the live position unchanged.
_queuedPosition, used purely to decide admission, applies neither check: it treats a pending
close as live and position-affecting for as long as it remains linked, with no regard for whether
the execution path that will actually process it can only ever terminate it as a no-op failure.
Finally, independently verified in OrderLifecycleBook._validateBountyDisposition
(packages/perps/src/OrderLifecycleBook.sol:699-722), every terminal reason other than RiskOff
(refunded to the account) and AccountLiquidated (forfeited to treasury) -- which includes both
Expired and PlannerRejected -- pays the order's reserved bounty to receipt.executor, i.e.
whichever address called the public cleanup entrypoint:
if (receipt.reason == OrderV3Types.TerminalReason.RiskOff) {
refunded = bounty;
recipient = receipt.account;
disposition = OrderV3Types.BountyDisposition.RefundedToAccount;
} else if (receipt.reason == OrderV3Types.TerminalReason.AccountLiquidated) {
forfeited = bounty;
recipient = ICfdEngineCore(ENGINE).protocolTreasury();
disposition = OrderV3Types.BountyDisposition.Forfeited;
} else {
paid = bounty;
recipient = receipt.executor;
disposition = OrderV3Types.BountyDisposition.Paid;
}
CfdEngine.creditBounty (packages/perps/src/CfdEngine.sol:471-493) is the function that actually
moves the money, and it is a direct sourceAccount -> beneficiary transfer of the victim's own
reserved settlement balance:
function creditBounty(
address sourceAccount,
address beneficiary,
uint256 amountAssets,
uint256 price,
uint64 publishTime
) external onlyRouter nonReentrant {
if (amountAssets == 0) {
return;
}
...
clearinghouse.transferReservedSettlement(sourceAccount, beneficiary, amountAssets);
...
emit BountyCredited(sourceAccount, beneficiary, amountAssets);
}
sourceAccount is order.account (the trader) and beneficiary is the keeper address that
called the public cleanup entrypoint, as independently verified in the single call site that
reaches a non-account bountyRecipient, OrderRouter._settleTerminalBounty
(packages/perps/src/OrderRouter.sol:333-343):
if (bountyAssets != 0) {
settlement.bountyRecipient = bountyRecipient;
settlement.bountyDisposition = OrderV3Types.BountyDisposition.Paid;
if (bountyRecipient == order.account) {
clearinghouse.releaseReservedExecutionBountyToSource(order.account, bountyAssets);
} else {
engine.creditBounty(
order.account, bountyRecipient, bountyAssets, accountingPrice, accountingPublishTime
);
}
}
The cleanup entrypoints themselves (OrderRouter.expireOrder, OrderRouter.clearInvalidOrders,
both delegating to OrderRecoverySidecar) carry no access control beyond nonReentrant --
independently verified by reading OrderRouter.sol:191-204 and OrderRecoverySidecar.sol:49-64, 67-110 directly. Any address, including one that has never interacted with the protocol before,
may call them.
Why the stale projection is the but-for cause, not the ordinary cleanup-bounty policy itself
Paying a cleanup bounty to whoever terminalizes an expired or rejected order is an intended,
documented protocol design (packages/perps/SECURITY.md, "Router and keeper limitations": "the
protocol keeper must fund gas for permissionless oracle-free expiry"). That policy is not the
defect. The defect is that _queuedPosition creates a bounty-bearing entitlement in a case the
protocol's own execution path can already prove, at the moment of admission, can never resolve as
anything but a no-op failure.
The attached PoC's control test isolates this precisely: using the exact same public,
permissionless cleanup entrypoint the attack branch also uses, clearing the already-expired
predecessor before the reversal is committed makes the identical reversal request revert
at admission with OrderRouter__PredictableOpenInvalid(MUST_CLOSE_OPPOSING), creating no
successor order and reserving no bounty at all. The only difference between the two branches is
whether the already-expired predecessor happens to still be linked at the moment of the later
commit -- which is exactly the omitted check.
Demonstrated impact (independently built and executed; see the PoC field for the full runnable code and exact output)
Running against the frozen Arbitrum Sepolia v2.0.0 release, deployed in-process via the
repository's own script/DeployPerpsArbitrumSepolia.s.sol wrappers (the programme's own permitted
"repository's Foundry test suite at the commit in scope" PoC route), with the release's own
hardcoded default Router parameters (independently confirmed in source: 60-second execution
window, 5-order pending cap, 1bp/10,000-floor/200,000-cap open-order execution bounty, 64-id
cleanup cap -- packages/perps/src/router/OrderRouterBase.sol and
packages/perps/src/router/OrderExecutionOrchestrator.sol):
- a single doomed reversal open reserves exactly
200,000settlement atoms (the deployed bounty cap) and, once it and its already-expired predecessor are cleared through the public, permissionlessexpireOrderentrypoint, transfers exactly200,000atoms from the victim's settlement balance to the unrelated keeper's settlement balance, while the victim's original position's size, entry price, and side are byte-for-byte unchanged; - scaling to the account's full five-order pending cap (the already-expired predecessor close plus
four same-side reversal opens -- only the first of the four depends on the defect; the
following three are ordinary same-side position increases that accumulate normally once the
account's queued position reads as the reversed side), a single public, permissionless
clearInvalidOrderscall terminalizes all five orders in one transaction and transfers exactly800,000settlement atoms from the victim to the keeper; and - the control test, using the identical public cleanup entrypoint to clear the predecessor first,
makes the identical reversal commit revert with
OrderRouter__PredictableOpenInvalidcodeMUST_CLOSE_OPPOSINGand creates no successor and no bounty.
A separately retained, independently built and executed deployed-fork reproduction against the
exact released bytecode (fresh local Anvil fork of the exact Arbitrum Sepolia v2.0.0 deployment,
the programme's other permitted PoC route) measured the identical maximal-case transfer: exactly
800,000 settlement atoms (0.800000 USDG) moved from victim to keeper in one public
clearInvalidOrders([...]) transaction, with the victim's original position unchanged, matching
this report's in-process Foundry reproduction exactly, including the per-order 200,000-atom cap.
That deployed-fork run also measured the keeper's attack-transaction cost: 1,690,743 gas at an
effective gas price of 484,002 wei, i.e. 818,322,993,486 wei (0.000000818322993486 ETH)
native fee for a 0.800000 USDG gross gain. At that measured fork fee, the transaction remains
gross-profitable for the keeper at any ETH/USD price below approximately $977,609
(0.800000 / 0.000000818322993486, recomputed independently from the two measured raw figures).
The attack uses no oracle payload and pays no oracle fee.
Severity and impact
Critical -- Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed
yield is the selected impact, matching the current programme page's severity table verbatim
(captured 2026-11-10; text/immunefi_scope_2026-11-10.txt lines 174-175, 199-201).
The transferred value is the victim's own settlement principal -- ordinary clearinghouse balance
the victim deposited and had reserved against its own order, not unclaimed yield, a fee, or a
display-only accounting figure. creditBounty executes a real sourceAccount -> beneficiary
balance transfer via clearinghouse.transferReservedSettlement, independently confirmed in source
above, and both the in-process and the deployed-fork PoC measure equal victim loss and keeper
gain, not a burn or an internal reclassification.
The attacker needs no victim key, no trusted role, and no access to Plether's own reference
keeper. The programme's own current scope page states, verbatim: "Keepers are not trusted: anyone
can execute orders, liquidations, price updates and protections, so harm caused by any caller
acting as a keeper is in scope" (line 124), and separately: "Keepers have no special privileges:
all actions remain subject to on-chain checks. Researchers should consider any contract-permitted
behavior, including deviations from the reference implementation" (line 129). The attack uses only
the two ordinary public entrypoints every keeper already calls (expireOrder,
clearInvalidOrders) from an address that holds no role and has made no prior deposit.
The programme's own scope page also separates impact from feasibility, verbatim: "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" (line 137). The Griefing downgrade is
inapplicable on its own stated terms: it "[a]pplies to High or Critical findings where the
attacker gains no profit" (line 193/237), and this attacker is measured to profit (0.800000 USDG
gross against 0.000000818322993486 ETH of gas, profitable below ~$977,609/ETH). The Critical
direct-theft row itself carries no stated minimum amount in the captured severity table.
The out-of-scope and known-issue lists were independently checked against this exact mechanism and
do not exclude it (see Knownness below); the causal files
(OrderLiquidationBatchLogic.sol, OrderRouterExecutionSidecar.sol, OrderLifecycleBook.sol,
CfdEngine.sol) are all within packages/perps/src, none of them is among the six listed
view-only exclusions, and ordinary ("active at launch") ordering, reversal, and permissionless
keeper cleanup are all live features of the listed v2.0.0 release configuration.
Preconditions
- an ordinary trader submits a full or partial close and that close is not executed before its ordinary 60-second execution window elapses (this requires no attacker action -- it can happen through ordinary keeper unavailability, or a strategic keeper can simply decline to execute or clean up a close it notices is about to go stale); and
- that same trader later submits an ordinary opposite-side ("reversal") order while the expired close is still linked.
Both are ordinary, publicly supported account states and actions on the frozen release; no trusted role, privileged address, or any action outside the trader's own ordinary order flow is required. The keeper side of the attack requires nothing beyond gas: no deposit, no role, no oracle fee, and no prior interaction with the protocol.
Knownness
The current programme page's known-issues clause names three previous audit reports by this exact
commit: the Cecuro AI audit, the SC Audit Studio pre-audit, and the AI scan findings
(scan-plether-fi-plether-core-d4541b49.md). All three were independently read in full (not
sampled), plus packages/perps/SECURITY.md, at the frozen commit:
- MED-14 ("Trader can be blocked from queueing an open behind their closing order") added the
very projection
_queuedPositionperforms, to fix the opposite problem: a trader being wrongly rejected when queueing an open behind an ordinary, still-valid closing order. It does not address whether a linked predecessor's own deadline or configuration remains valid. - MED-16 ("Traders can enqueue invalid opens when the cached mark is stale"), read directly
from the audit report, is about the projection being skipped when the cached oracle mark is
stale, and its fix (commit
5029cde...) makes that same projection run "even when the cached mark is stale." It does not read or check a linked predecessor's own execution deadline or configuration hash at all; both are orthogonal to mark staleness. - LOW-57 ("Trader can underpay open-order keeper bounty by committing against a stale mark"), also read directly, is about bounty sizing being computed from a stale cached price, not about whether an already-doomed predecessor should suppress admission in the first place.
packages/perps/SECURITY.md's "Router and keeper limitations" section, read in full, documents that users cannot manually cancel a queued intent and that heavily expired queues may need multiple keeper calls to clear, but does not document that_queuedPositionomits the deadline/config check the execution sidecar itself applies.- The AI scan findings document's only entry touching this admission path, "Stale cached marks can
underfund open-order bounties and global FIFO cleanup" (Low, denial_of_service), is the same
stale-mark/bounty-sizing axis as MED-16/LOW-57 -- it claims a mark-staleness-driven notional/bounty
mismatch, not a predecessor's own elapsed deadline or configuration hash. A full-text search of
that document and the SC Audit Studio pre-audit report for
_queuedPosition's admission predicate,executionDeadline, andexpectedConfigHashfound no entry describing this report's mechanism.
None of these open findings or documented limitations identify an already-expired or
configuration-invalidated predecessor being applied by _queuedPosition, and none adds the
deadline/configuration predicate this report's remediation proposes. Under the controlling rule
that only the exact same root cause, code path, trigger and impact is a duplicate, this is a
distinct, novel defect.
Recommended remediation
Before _queuedPosition applies a linked predecessor's effect on the projected position, read
that predecessor's own pending-intent timing and bounds and skip (or require it to be cleaned up
before admission if) its execution deadline has strictly elapsed, or its pinned nonzero expected
configuration hash no longer matches the current hash -- matching exactly the predicate
OrderRouterExecutionSidecar.executeOrderItemFromSidecar already applies before execution,
including the strict > deadline comparison and the zero-hash exception reserved for
protocol-generated protection closes. Add tests for an expired full close, a configuration-invalid
full close, and multiple queued successor opens behind each.
Proof of Concept
Proof of Concept
This runs entirely against the frozen Arbitrum Sepolia v2.0.0 release, deployed in-process via the
repository's own script/DeployPerpsArbitrumSepolia.s.sol wrappers. It is the programme's own
explicitly permitted PoC route: "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." (current programme scope page, captured 2026-11-10).
No in-scope contract is modified; the only mock used is MockPyth, the component the rule names
by name. I independently wrote, compiled, and ran this exact PoC in this session (not previously
retained); its full console output is reproduced verbatim below under "Expected output".
- Check out the competition repository at
a82d4fefb02768e5b3bddcc97dee371eee24fea8. - Build
af020-poc/from the exact inline code blocks below in the checkout root soaf020-poc/sits adjacent topackages/,lib/andscript/. - Run offline:
cd af020-poc && FOUNDRY_OFFLINE=true ./run.sh
Expected output
Ran 3 tests for test/PletherAF020DoomedOpenBounty.t.sol:PletherAF020DoomedOpenBountyTest
[PASS] test_AF020_Attack_DoomedOpenAdmittedAndBountyStolen() (gas: 7971375)
Logs:
reserved execution bounty for the doomed SHORT open (atoms) 200000
victim settlement loss (atoms) 200000
unrelated keeper gross gain (atoms) 200000
[PASS] test_AF020_Attack_MaximalFourSuccessorBatchCleanup() (gas: 11088440)
Logs:
maximal single-account victim loss (atoms) 800000
maximal single-account keeper gross gain (atoms) 800000
[PASS] test_AF020_Control_ClearingPredecessorFirstRejectsTheIdenticalOpen() (gas: 6911961)
Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 14.99ms (23.08ms CPU time)
Ran 1 test suite in 15.42ms (14.99ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests)
test_AF020_Attack_DoomedOpenAdmittedAndBountyStolen shows the single-successor form: the already
expired predecessor close stays linked, a single opposite-side reversal is admitted anyway and
reserves the deployed 200,000-atom bounty cap, and once both orders are terminalized through the
public, permissionless expireOrder entrypoint, exactly 200,000 settlement atoms move from the
victim to an unrelated keeper while the victim's original position is provably unchanged (LONG size unchanged, LONG entry price unchanged, LONG side unchanged all assert, not merely log).
test_AF020_Attack_MaximalFourSuccessorBatchCleanup scales this to the account's full five-order
pending cap and a single public clearInvalidOrders call, transferring exactly 800,000 settlement
atoms in one transaction -- matching the maximal figure independently measured on the exact
deployed bytecode via a separate, local-Anvil-fork-of-the-deployment reproduction (this report's
other permitted PoC route; see "Independent cross-check" below).
Fix / control check
test_AF020_Control_ClearingPredecessorFirstRejectsTheIdenticalOpen is the right-reason control:
using the identical public, permissionless cleanup entrypoint to clear the already-expired
predecessor before the reversal is committed, the byte-identical reversal request reverts at
admission with OrderRouter__PredictableOpenInvalid(MUST_CLOSE_OPPOSING), and creates neither a
successor order nor a bounty reservation. This isolates the stale predecessor projection -- not
the ordinary cleanup-bounty policy itself -- as the but-for cause: the same public action that an
attacker chooses not to take is freely available and, if taken, closes the path entirely. This
test passed in the same run above ([PASS] ... Control ...). A corrected release that applies the
recommended remediation (03_description.md, "Recommended remediation") would additionally reject
the attack branch's reversal commit at admission with the same selector, exactly as the control
branch already does here; the pre-fix frozen release does not, which is the entire defect this
report demonstrates.
Fix verified directly: the recommended remediation closes the admission path
Independently of the control test above, I patched _queuedPosition
(packages/perps/src/router/OrderLiquidationBatchLogic.sol:367-402) in an isolated working copy to
apply exactly the predicate this report's "Recommended remediation" field describes -- reading each
linked order's OrderV3Types.PendingIntent via host.lifecycleBook().pendingIntent(orderId) and
excluding it from the projection when block.timestamp > intent.timing.executionDeadline, or when
intent.bounds.expectedConfigHash != bytes32(0) and it no longer matches
host.lifecycleBook().currentExecutionConfigHash() -- then re-ran the identical attack tests above
against the patched source with no change to the test files. Both attack tests now revert at the
identical admission point with the identical selector the control test already uses:
[FAIL: OrderRouter__PredictableOpenInvalid(1)] test_AF020_Attack_DoomedOpenAdmittedAndBountyStolen()
[FAIL: OrderRouter__PredictableOpenInvalid(1)] test_AF020_Attack_MaximalFourSuccessorBatchCleanup()
[PASS] test_AF020_Control_ClearingPredecessorFirstRejectsTheIdenticalOpen()
This is a direct fail-before/pass-after demonstration on the mechanism itself, not only on the
right-reason control's different code path: the same unmodified attack transaction sequence that
passes and steals the bounty on the frozen release now reverts before any order is admitted once
the described one-line-class fix is applied, and reverts with the exact same
MUST_CLOSE_OPPOSING reason code the control branch already produces. This patched-source run is
exploratory verification of the remediation, not part of the attached af020-poc/ package (which
targets the unmodified frozen release only, as the programme's PoC rule requires); it is reported
here only as independent confirmation that the identified root cause, and not some unrelated
difference between the two branches, is the but-for cause.
Independent cross-check (separate PoC route, retained evidence)
A second, independently built reproduction exists against the exact deployed v2.0.0 bytecode on a
fresh local Anvil fork of the Arbitrum Sepolia deployment (the programme's other permitted PoC
route), executed in a prior session of this engagement and retained with full transaction
receipts, logs, and a byte-for-byte matching fresh-fork control. It measured the identical maximal
transfer -- 800,000 settlement atoms moved from victim to keeper in one public
clearInvalidOrders([...]) transaction, with the per-order 200,000-atom cap matching this report's
in-process reproduction exactly -- and additionally measured the keeper's attack-transaction native
cost directly from the fork's transaction receipt: 1,690,743 gas at an effective gas price of
484,002 wei, i.e. 818,322,993,486 wei (0.000000818322993486 ETH). I independently recomputed
1,690,743 x 484,002 = 818,322,993,486 from those two raw figures (exact integer match, not
rounded), and independently recomputed the breakeven price 0.800000 / 0.000000818322993486 =
977,609.09... -- consistent with "profitable below approximately $977,609/ETH." That retained run's
proxy audit log (timestamped 2026-11-10 22:56-22:58 America/Los_Angeles) shows only allowlisted
state-read RPC methods against the pinned fork and one state-changing transaction whose hash
appears in the retained result file; its arithmetic (gas-used x effective-price = receipt fee,
and victim-balance-before minus after = bounty loss, both to the atom) is internally exact across
every retained figure I checked. I did not re-execute that deployed-fork campaign myself in this
session -- forking and replaying the exact deployed bytecode against a pinned historical block is
a separate, heavier harness (described in this engagement's evidence/s481-... and
evidence/s482-... lanes) that was already run and retained; I verified its retained artifacts for
internal arithmetic consistency rather than rerunning it. I independently read the raw retained
comparison.json result files for both runs directly (not only their prose summaries) and confirmed
every cited figure -- attack_victim_bounty_loss_assets: 800000, attack_keeper_gross_gain_assets: 800000, attack_batch_cleanup_gas_used: 1690743, attack_batch_cleanup_receipt_fee_wei: 818322993486, and control_revert_data: 0x2ae052ed...0001 -- is present verbatim in those files.
A third, separately retained deployed-fork run in the same evidence lane (evidence/s484-...,
sealed 2026-11-11, after this packet's own first build) scaled the identical mechanism to the
deployed 64-order cleanup cap across 13 distinct victim accounts in a single clearInvalidOrders
transaction, transferring 10,200,000 settlement atoms in aggregate with
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 admission projection `_queuedPosition` applies a linked pending close without checking that close's own execution deadline or pinned configuration hash, unlike the execution path which rejects such orders as Expired or ConfigMismatch.
Impact
The trader's own reserved settlement balance is transferred to an unrelated keeper, measured at up to 800,000 atoms in the PoC, while the original position is unchanged; the attacker needs only gas and no role.
What the attacker needed
Trader's close goes unexecuted past 60s; trader later submits a reversal order; keeper pays only gas, no role needed
The fix
The projection should skip a linked close whose execution deadline has elapsed or whose pinned configuration hash no longer matches, mirroring the execution sidecar's check.
How it was found
- A trader submits a full or partial close that is not executed before its 60-second window elapses.
- The expired close stays linked to the account.
- The same trader later submits an ordinary opposite-side reversal order.
- The router admits the reversal because the projection reads the position as flat.
- The reversal reserves a bounty and later fails as Expired or PlannerRejected.
- Any public keeper calls the cleanup entrypoint and collects the bounty from the trader's balance.
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 trader's pending order to close a position has a short time limit. If nobody executes it in time, it is dead but still listed. The system wrongly counts this dead close as if the position were already closed, so it accepts a new opposite order that can never succeed. That failed order carries a small reward, and anyone who cleans it up gets paid from the trader's own balance.
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.