Queued partial closes are not binding: a trader can decide after commit whether its own close executes (an equity bound with addMargin, or a free-settlement withdrawal on an ordinary close)
A trader can commit a queued partial close and then, after commit, choose whether it executes or fails terminally by calling addMargin or withdrawing free settlement. This breaks the protocol's stated guarantee that queued intents cannot be turned into free options, though the measured value transfer is small and net-negative for the trader after fees.
Originally disclosed on Immunefi
- Disclosed after under an hour
#99915 [SC-Low] Queued partial closes are not binding: a trader can decide after commit whether its own close executes (an equity bound with addMargin, or a free-settlement withdrawal on an ordinary close)
Submitted on Nov 15th 2026 at 18:03:45 UTC by @argo_the_hacker for Audit Competition | Plether
- Report ID: #99915
- Report Type: Smart Contract
- Report severity: Low
- Target: https://github.com/immunefi-team/audit-comp-plether/tree/a82d4fefb02768e5b3bddcc97dee371eee24fea8/packages/perps/src
- Impacts:
Description
Severity: Insight. Filed under the program's Insight Reporting rules. No impact from the program's list is claimed; the Impact section says why. The protocol states that "binding order semantics and the lack of a user cancellation path prevent traders from turning queued intents into free options" (packages/perps/SECURITY.md:658-659). At the pinned commit a trader with no role can still decide, after commit, whether its own queued partial close executes or fails terminally, at a fill already fixed by the first historical tick after commit. We show two levers. One uses an equity bound and addMargin. The other is an ordinary close with no unusual bound and a withdrawal of free settlement. A repeated-trade test measures what the choice is worth: 0.31 to 0.47 bp of each committed close, paid by LPs, under an assumed volatility. The same test shows the trader losing money net of fees. So this report claims a broken design guarantee with a measured, small value transfer, not an exploit.
Target: immunefi-team/audit-comp-plether @ a82d4fefb02768e5b3bddcc97dee371eee24fea8, packages/perps/src:
- the commit-time request validation
OrderLiquidationBatchLogic._validateFreshRequest(OrderLiquidationBatchLogic.sol:270-319), which never readsminPostPositionEquityAssets; - the execution-time bound check (
CfdOrderPolicyEvaluatorBase.sol:530-539) and its terminal classification (OrderRouterExecutionSidecar.sol:879-891); CfdEngine.addMargin(CfdEngine.sol:501-527);- the partial-close charge collection and its terminal rejection (
CfdEnginePlanLib.sol:1092-1133,:1137-1180,:882-885), and the owner withdrawal path (MarginClearinghouse._withdraw,MarginClearinghouse.sol:441-477;CfdEngine.checkWithdraw,CfdEngine.sol:730-748).
Relation to prior findings: this is the class of the pre-audit's SC-M4 "Risk Free Option in 60Sec Oracle Window" (fixed, Plether-Fi/plether-core#24). Both levers were added to the code after that fix. Under the program's rule we report it as the SC-M4 fix being incomplete at a82d4fef. It is a different root cause from Cecuro HIGH-1 (Arbitrum/Pyth clock alignment). HIGH-1 is about what a trader can know at commit. This report is about a choice the trader makes after commit, whatever the clock. See "Relation to prior findings" below.
Summary
A trader with no role can decide, after commit, whether its own queued partial close executes or fails. This was executed on the pinned code with two levers:
- Lever 1, equity bound and
addMargin. The trader commits a partial close with aminPostPositionEquityAssetsfloor that the residual cannot reach on its own. The same order at the same fill tick endsFailed(ConstraintViolation) if the trader does nothing, andExecutedif the trader first callsaddMargin. The same lever works on a position increase that the trader executes itself. - Lever 2, an ordinary close and a withdrawal. The partial close carries no unusual bound. In a narrow band of losing fills, the same order at the same fill ends
Executedif the trader leaves its free settlement in place. It endsFailed(planner rejection,PARTIAL_ACTION_CHARGE_UNCOLLECTIBLE) if the trader first withdraws that settlement. At the release risk parameters the band is +0.315% to +0.330% of adverse move for the tested position.
In both levers the failed branch settles no close and leaves the position size unchanged. The failed attempt takes no USDG from the trader and pays no executor. It is not free in every sense: committing costs gas and collects carry, a self-executing trader pays gas and any oracle fee, and the open position keeps its market risk and carry.
What the tests prove, and what they do not:
- They prove the switch. At a fixed historical fill, the outcome depends on an owner action taken after commit. In the single-trade tests the mocked historical tick is constructed at execution, after the trader's action. So these tests do not stage the sequence "see the published fill, see a later market price, then choose". The strict status equality in the property tests is the requirement we propose. The code does not document it in that exact form.
- The value of the choice is measured separately. A repeated-trade test (lever 1, release parameters, the shipped 60 s window) models the trader deciding with the fill price F and a later price D. It closes every round flat, so each result is fully realised wealth. The choice is worth 0.31 to 0.47 bp of each committed close, all of it from LPs. The trader still nets about −7.85 USDG per 10,000-notional round after fees, VPI and bounties. This is not a net-profitable extraction.
Limits a triager will raise, and that we accept:
- The window is not guaranteed. The choice must be made before the order's first execution. Close bounties are zero (
SECURITY.md:293-296), but any caller can execute the close: the trader, the protocol keeper (which is told to "Service the canonical Router head regardless of its reward",DEPLOYMENT.md:359), liquidators, or a keeper clearing the head to reach a bountied open. A close may stay pending until its deadline only if no other caller processes it. The tests show a decision at commit + 52 s with nobody executing in between. - Atomic exercise is possible, but not guaranteed. An account that is a batching smart contract could call
addMargin(orwithdraw) andexecuteOrderin one transaction. The tests do not demonstrate this; their trader is a plain address. Atomicity prevents interleaving between those two calls. It does not stop another caller from executing the order first. An ordinary EOA's two separate transactions have no such guarantee. - Capital. Lever 1's keep branch parks the trader's own free settlement as margin until the residual closes. It stays the trader's.
The promise, and the documented policy next to it.
- The promise:
SECURITY.md:658-659: "binding order semantics and the lack of a user cancellation path prevent traders from turning queued intents into free options".SECURITY.md:719: "users cannot cancel a queued intent".SECURITY.md:1345: "users cannot manually cancel queued intents". - The intended failure policy:
SECURITY.md:726-729: "exact-shape typed planner rejections, execution-mode violations, and financial-constraint violations fail terminally", and "ordinary close failure settles its zero Order record and pays no executor". - The intended bounds:
SECURITY.md:756-763andCLOSE_PREVIEW.md:88-90("Execution independently requires a healthy residual position and collectible partial-close charges"). - The whitepaper's softer wording:
WHITEPAPER.md:1137-1138: "Binding orders reduce the ability to treat a queue position as a free option".
Each ingredient is intended. We found no statement that accepts their combination as a trader-controlled choice after commit, and SECURITY.md:658-659 states the opposite. The no-cancel statements (:719, :1345) remain literally true of the API: inducing a terminal failure is not calling a cancel function.
Relation to prior findings
| Item | What it says | How this report relates |
|---|---|---|
| Pre-audit SC-M4 "Risk Free Option in 60Sec Oracle Window" (SC Audit Studio, fixed: "Fixed in Plether-Fi/plether-core#24") | "a SOLVENCY_EXCEEDED→RefundUser margin-return path triggered by LP withdrawal … an attacker can effectively hold a costless directional option on the underlying price for up to one minute per order pair" | Same class, later levers: the fix is incomplete. At a82d4fef orders are binding. There is no user cancellation, the fill is the unique first tick after commit (SECURITY.md:647-649), and the RefundUser path is gone. The protocol states that this prevents free options (SECURITY.md:658-659). The two levers here came later. The equity floor first appears in the repository history on 2026-08-25, after PRs #66 and #70 had merged, so after #24. The PARTIAL_ACTION_CHARGE_UNCOLLECTIBLE rejection first appears on 2026-08-21. The maintainers closed the matching settlement-floor lever: a positive settlement floor on a close is rejected at commit (OrderRouter__SettlementFloorUnsupported, OrderLiquidationBatchLogic.sol:308-310; CLOSE_PREVIEW.md:88). The equity floor and the charge collection got no such guard. The #24 diff itself is not in the competition repository, so this framing rests on the fix's stated effect, not on a reading of the patch. |
| Cecuro HIGH-1 (Info, open known issue: Arbitrum/Pyth clock alignment) | A trader may commit after a Pyth price is already published and be filled at it. A new report on this root needs "a repeatable, net-profitable extraction from LPs beyond this limitation". | Different root, and that bar is not met. HIGH-1 concerns information at commit. This report needs no clock lag. Our repeated-trade test measures the trader net-negative after costs, so we do not claim HIGH-1's bar. |
| Cecuro MED-16 (open) | "Price-dependent checks remain freshness-gated and are revalidated at execution; this does not guarantee that every admitted order will fill." | Different. MED-16 covers opens admitted against a stale cached mark that may fail. Here the trader controls whether the order fails, after commit. |
SECURITY.md:726-729, CLOSE_PREVIEW.md:88-90 |
Typed planner rejections and financial-constraint violations are terminal. Execution independently requires a healthy residual and collectible partial-close charges. | These document when the checks run and that failures are terminal. Neither says the trader may decide the outcome after commit, and SECURITY.md:658-659 says the trader cannot. |
Cecuro LOW-7, AI scan addMargin carry-checkpoint item |
addMargin(account, 0) error classification; one-atom addMargin carry checkpointing |
Unrelated uses of addMargin. |
The collaborative (Sherlock) and Cantina reports cover the spot package and have no related item.
Vulnerability details
Lever 1: the equity floor is not read at commit, is terminal at execution, and addMargin moves it
Commit-time validation reads the settlement floor but never the equity floor:
// OrderLiquidationBatchLogic.sol:303-312 (_validateFreshRequest)
uint64 head = host.accountHeadOrderId(account);
if (head != 0 && host.lifecycleBook().pendingPolicy(head).minPostSettlementBalanceAssets != 0) {
revert OrderRouter__SettlementFloorOrderPending(head);
}
if (bounds.minPostSettlementBalanceAssets != 0) {
(uint256 positionSize,,,,,,) = host.engine().positions(account);
if (request.isClose || positionSize != 0 || head != 0) {
revert OrderRouter__SettlementFloorUnsupported();
}
}
At execution, a partial close is checked against the floor at the fill price:
// CfdOrderPolicyEvaluatorBase.sol:530-539
uint256 normalizedEquityAssets =
assessment.postPositionEquityAssets > 0 ? uint256(assessment.postPositionEquityAssets) : 0;
if (assessment.postPositionEquityAssets < 0 || normalizedEquityAssets < bounds.minPostPositionEquityAssets) {
revert ICfdOrderPolicyEvaluator.CfdOrderPolicyEvaluator__ConstraintViolation(
OrderV3Types.ConstraintKind.PostPositionEquity,
normalizedEquityAssets,
bounds.minPostPositionEquityAssets
);
}
_requireMaximum(OrderV3Types.ConstraintKind.PostLeverage, assessment.postLeverageBps, bounds.maxPostLeverageBps);
That revert is terminal:
// OrderRouterExecutionSidecar.sol:879-891
if (
selector == ICfdOrderPolicyEvaluator.CfdOrderPolicyEvaluator__ConstraintViolation.selector
&& revertData.length == 100
) {
uint256 constraint = _word(revertData, 4);
if (constraint > 0 && constraint <= uint256(OrderV3Types.ConstraintKind.PostLeverage)) {
classification.terminal = true;
classification.reason = OrderV3Types.TerminalReason.ConstraintViolation;
// ...
}
}
The owner can raise the equity the floor reads at any time. There is no pending-order check and no oracle input:
// CfdEngine.sol:501-527 (abridged)
function addMargin(address account, uint256 amount) external nonReentrant {
if (msg.sender != account) revert CfdEngine__NotAccountOwner();
if (amount == 0) revert CfdEngine__ZeroAmount();
StoredPosition storage pos = _positions[account];
if (pos.lots == 0) revert CfdEngine__NoOpenPosition();
// ... realize carry, then:
clearinghouse.lockPositionMargin(account, amount);
_sideState(pos.side).totalMargin += amount;
// ...
}
Full closes skip the residual checks (CfdOrderPolicyEvaluatorBase.sol:526-528), so lever 1 needs a surviving position. maxPostLeverageBps is checked at the same point and also moves with addMargin. We did not test it separately.
The same lever on an increase. When the trader executes its own open and it fails on a typed check, the reserved bounty goes back to the trader's account (OrderRouter.sol:336-337, context :333-342). An increase committed with an unreachable minPostPositionEquityAssets therefore fails without a USDG debit when the trader executes it itself. If a third party executes it first, the failed branch pays that executor the bounty.
Lever 2: an ordinary close's charge collection reads free settlement, which the owner can withdraw after commit
A partial close collects its action charge (fee, VPI, carry) first from the spendable action reserve, then from free settlement, then from released margin limited by health (CfdEnginePlanLib._planCloseCashSources, CfdEnginePlanLib.sol:1092-1133; _limitCloseReleaseByHealth, :1137-1180). On a partial close, any charge it cannot collect is a terminal rejection:
// CfdEnginePlanLib.sol:882-885
if (remainingSize > 0 && delta.actionChargeWaivedAssets > 0) {
delta.revertCode = CfdEnginePlanTypes.CloseRevertCode.PARTIAL_ACTION_CHARGE_UNCOLLECTIBLE;
return delta;
}
The Router records that as PlannerRejected and the order fails. Free settlement is not position collateral. The owner can withdraw it while the close is queued, because neither MarginClearinghouse._withdraw (MarginClearinghouse.sol:441-477) nor CfdEngine.checkWithdraw (CfdEngine.sol:730-748) reads the order queue. Where health limits the released margin to less than the charge, leaving the free settlement in place lets the close execute, and withdrawing it makes the close fail. The trader needs no unusual bound for this. The band is narrow: in the tests it is about 1.5 to 2 bp of adverse move wide.
Impact
Grade: Insight. We do not claim an impact from the program's list, for these reasons:
- Not the Low line. The Low line is "Contract fails to deliver promised returns, but doesn't lose value". What breaks here is a promise about queue semantics, not a promise of financial returns. Where the choice is exercised with later price information, it moves LP value to the trader, which is a loss of value, however small.
- No value-loss line is demonstrated. Over repeated trades at the release parameters and the shipped 60 s window, the information-conditioned choice is worth 0.31 to 0.47 bp of each committed close. Under an assumed 7.5% annual volatility that is about 1.6 to 2.4 USDG per 50,000 closed, all of it from LPs (USDG taken at USDC parity). After fees, VPI and bounties the trader nets about −7.85 USDG per 10,000-notional round. This is not theft and not a net-profitable extraction.
- Not the Medium griefing line. A trader running the lever only to hurt LPs pays about 30 times what LPs lose: about 7.75 USDG of fees and bounty per round against about 0.24 USDG of option value.
What LPs give up is the option value on closes that traders make anyway, each time a trader uses the lever with a price signal. It grows with notional and volatility, and roughly with the square root of the time between the fill tick and the decision. All value figures above are frictionless and gross except the measured trader net. The 1 h owner cap on the window (OrderRouterAdmin.sol:31, behind a 72 h timelock) gives about 3.2 bp per close by √t scaling on a 365.25-day year (about 3.8 bp on a 252-trading-day year). That figure was not executed.
Why report it at all: the protocol states a guarantee that its own code does not provide, and the maintainers already closed the identical settlement-floor lever. Either the two remaining levers should be closed the same way, or the guarantee should be restated as the whitepaper's "reduce".
Recommendation
Close the two remaining levers the way the settlement floor was closed, or restate the guarantee. These are sketches. We have not implemented them or run them against the maintainers' suite.
- Lever 1, closes. In
_validateFreshRequest, reject a nonzerominPostPositionEquityAssets, and amaxPostLeverageBpsbelow the type maximum, on closes, next to the existingOrderRouter__SettlementFloorUnsupportedcheck. This removes the demonstrated lever. It does not necessarily remove every way an owner action can change whether a close passes at execution. - Lever 1, increases. Checking the bound once at commit does not fix the outcome at execution, because later owner actions still change the inputs. Either reject the bound on increases too, or make the inputs the bound reads fixed for the order's lifetime: reserve the funding at commit, as the open-side settlement floor already does (
OrderLiquidationBatchLogic.sol:259-266). - Lever 2. Reserve a queued partial close's maximum action charge at commit, as an open's bounty is reserved, or refuse withdrawals that would take free settlement below that reservation while the close is queued. A withdrawal restriction is safer than blocking
addMargin: the existingOrderRouter__SettlementFloorOrderPendingguard (OrderLiquidationBatchLogic.sol:303-306) blocks admitting a new order behind a pending settlement-floor order. It is not anaddMarginlock. Blocking margin top-ups while an order is pending could stop a trader from rescuing a position near liquidation, so we do not recommend that. - If the behaviour is intended, change
SECURITY.md:658-659to the whitepaper's wording ("reduce the ability to treat a queue position as a free option"), and list both levers as accepted.
We do not recommend making these violations retryable instead of terminal. The order would stay pending, and a zero-bounty close that the trader does not top up would still end at its deadline. Expiry is terminal too (SECURITY.md:724; OrderRouterExecutionSidecar.sol:910-911), so the choice would remain.
The property tests do not become regression tests unchanged. Under fix 1, a close with a nonzero equity floor reverts at commit, so the lever 1 property should assert that admission rejection. Under fix 3, the lever 2 property's withdrawal should revert or leave the close executable.
Link to Proof of Concept
https://gist.github.com/Richter2552/f10111e922c7bef6b3790e193e6284fe
Proof of Concept
Proof of Concept
The program requires PoCs to run in the repository's Foundry test suite at the commit in scope without modifying the contracts in scope. The three test files below extend the maintainers' BasePerpTest fixture. Prices come from the fixture's MockPyth; the program allows mocking Pyth. Every action after setup is a public call:
- the trader's own
router.commitOrder,engine.addMargin,clearinghouse.withdrawand (for the increase)router.executeOrder; - a keeper with no role calling
router.executeOrder.
Setup positions are opened through the Router commit and a keeper execution. No protocol contract is impersonated, and no vm.store or vm.etch is used.
When this insight is valuable. All of the following must hold:
- The trader can make its decision before anyone else executes the queued close.
- The trader has a price signal after commit, such as the published fill tick and a later market price.
- The account holds the free settlement that the lever needs: the top-up for lever 1, or the withdrawable balance for lever 2.
- For lever 2, the fill falls in the narrow band where health-limited released margin is below the action charge.
Then the trader keeps the close only when the fill beats the later price. The gain is roughly σ·√t/√(2π) of the closed notional, paid by LPs. Fees exceed this on any trade made only to harvest it. So it matters for traders who are closing anyway, and it grows with a longer owner-set window or a more volatile basket.
Files:
-
Card6482S1CloseFreeOption.t.sol(lever 1). Setup: TRADER holds a 10,000-token LONG with 2,000 USDG margin and commits a partial close of 5,000 withminPostPositionEquityAssets = 3,000 USDG; on its own the residual's equity is about 1,000. The two arms share the state and the fill tick, and differ only in whether TRADER callsaddMargin(5,000)before execution. -
Card5394S1WithdrawLever.t.sol(lever 2), at two parameter sets:- the fixture's own parameters (TRADER 10,000 LONG with 200 USDG margin);
- the release parameters from
DEPLOYMENT.md(TRADER 10,000 LONG with 50 USDG margin, with BOB 30,000 SHORT so that TRADER's close pays VPI rather than earning a rebate).
The close is ordinary, with no equity floor. The arms differ only in whether TRADER withdraws all its free settlement after commit.
-
Card6482S1RepeatedTrade.t.solmeasures what lever 1's choice is worth over many trades ("Repeated-trade measurement" below).
The property tests state the behaviour the code should have and fail on the pinned code. The control and characterize tests pass and pin the exact behaviour.
Run instructions (from a checkout of immunefi-team/audit-comp-plether at a82d4fefb02768e5b3bddcc97dee371eee24fea8 with submodules; solc 0.8.35 via the repository's packages/perps/foundry.toml):
cp Card6482S1CloseFreeOption.t.sol Card5394S1WithdrawLever.t.sol Card6482S1RepeatedTrade.t.sol \
packages/perps/test/perps/spec/trader/
cd packages/perps
forge test --match-contract '^Card6482S1CloseFreeOptionTest$' --match-test '^test_Property_' -vv
forge test --match-contract '^Card5394S1WithdrawLever(Release)?Test$' --match-test '^test_Property_' -vv
forge test --match-contract '^Card6482S1CloseFreeOptionTest$' --match-test '^test_(Control|Characterize)_' -vv
forge test --match-contract '^Card5394S1WithdrawLever(Release)?Test$' --match-test '^test_(Control|Characterize)_' -vv
forge test --match-contract '^Card6482S1RepeatedTradeTest$' --match-test '^test_Measure_' -vv
PoC output, lever 1 (pinned code, unmodified contracts)
Run against the pinned commit (forge 1.8.1, solc 0.8.35, via-IR, the repository's remappings): 3 tests pass and the 2 property tests fail. Excerpt (forge -vv logs; status 2 = Executed, 3 = Failed; terminal reason 8 = ConstraintViolation; custody is clearinghouse.balanceAssets in 1e6 units; sizes in 1e18; the keeper's 200000 is the bounty it earned on the setup open):
[PASS] test_Characterize_BothOutcomesAtGoodAndBadFills() (gas: 24737603)
Logs:
fill +2% DROP
status (2=Executed,3=Failed) 3
terminalReason 8
trader size after 10000000000000000000000
trader custody before/after 19995799999 19995799999
keeper custody before/after 200000 200000
fill +2% KEEP
status (2=Executed,3=Failed) 2
terminalReason 1
trader size after 5000000000000000000000
trader custody before/after 19995799999 19893759999
keeper custody before/after 200000 200000
fill -2% DROP
status (2=Executed,3=Failed) 3
terminalReason 8
trader size after 10000000000000000000000
trader custody before/after 19995799999 19995799999
keeper custody before/after 200000 200000
fill -2% KEEP
status (2=Executed,3=Failed) 2
terminalReason 1
trader size after 5000000000000000000000
trader custody before/after 19995799999 20093839999
keeper custody before/after 200000 200000
[PASS] test_Characterize_LateDecisionStillFillsAtOriginalTick() (gas: 12589277)
Logs:
max execution window (s) 60
decision made at commit + (s) 52
executed at commit + (s) 53
fill tick at commit + (s) 1
commitTime / deadline 1709535611 1709535671
LATE DROP
status (2=Executed,3=Failed) 3
terminalReason 8
trader size after 10000000000000000000000
trader custody before/after 19995799999 19995799999
keeper custody before/after 200000 200000
LATE KEEP
status (2=Executed,3=Failed) 2
terminalReason 1
trader size after 5000000000000000000000
trader custody before/after 19995799999 20093839994
keeper custody before/after 200000 200000
[PASS] test_Control_NoEquityBound_ExecutesEitherWay() (gas: 12575773)
Suite result: ok. 3 passed; 0 failed; 0 skipped
[FAIL: free option: trader picks execute-or-drop after the fill tick is known: 3 != 2] test_Property_TraderCannotChooseOutcomeAfterFill() (gas: 13027043)
Logs:
DROP (trader does nothing)
status (2=Executed,3=Failed) 3
terminalReason 8
trader size after 10000000000000000000000
trader custody before/after 19995799999 19995799999
keeper custody before/after 200000 200000
KEEP (trader addMargin first)
status (2=Executed,3=Failed) 2
terminalReason 1
trader size after 5000000000000000000000
trader custody before/after 19995799999 19993799999
keeper custody before/after 200000 200000
[FAIL: free option on an increase: trader picks after the fill tick: 3 != 2] test_Property_IncreaseSelfExecutedIsAlsoAFreeOption() (gas: 13860638)
Logs:
INCREASE DROP (self-executed, no top-up)
status (2=Executed,3=Failed) 3
terminalReason 8
trader size after 10000000000000000000000
trader custody before/after 19995799999 19995799999
keeper custody before/after 200000 200000
INCREASE KEEP (addMargin, self-executed)
status (2=Executed,3=Failed) 2
terminalReason 1
trader size after 15000000000000000000000
trader custody before/after 19995799999 19993799999
keeper custody before/after 200000 200000
PoC output, lever 2
Excerpt from the same run; the two # lines are our labels, not forge output. Terminal reason 7 = PlannerRejected; the planner's previewClose reason 7 = PartialActionChargeUncollectible. Fills are in 0.1 bp of adverse move (a LONG loses when the mark rises).
[PASS] test_Characterize_SweepBand() (gas: 780417607)
Logs:
diverges at adverse fill (0.1 bp) 1335
keep status/reason/previewReason 2 1 0
kill status/reason/previewReason 3 7 7
diverges at adverse fill (0.1 bp) 1340
keep status/reason/previewReason 2 1 0
kill status/reason/previewReason 3 7 7
diverges at adverse fill (0.1 bp) 1345
keep status/reason/previewReason 2 1 0
kill status/reason/previewReason 3 7 7
diverges at adverse fill (0.1 bp) 1350
keep status/reason/previewReason 2 1 0
kill status/reason/previewReason 3 7 7
sweep from/to (0.1 bp) 1200 1500
diverging fills (0.5 bp grid) 4
band first/last (0.1 bp) 1335 1350
[PASS] test_Control_BelowBandWithdrawalIsInert() (gas: 13303096)
[PASS] test_Control_FlatFillExecutesEitherWay() (gas: 13060695)
[FAIL: free option: an ordinary withdrawal after commit decides the queued close: 3 != 2] test_Property_WithdrawAfterCommitCannotKillQueuedPartialClose() (gas: 13604690)
Logs:
adverse fill (0.1 bp) 1350
KEEP (trader does nothing)
status (2=Executed,3=Failed) / terminalReason 2 1
trader size after 5000000000000000000000
KILL (trader withdraws its free settlement first)
status (2=Executed,3=Failed) / terminalReason 3 7
planner previewClose invalidReason 7
trader size after 10000000000000000000000
custody before / withdrawn / custody after 1995799999 1799800000 195999999
keeper custody before/after 200000 200000
[PASS] test_Characterize_SweepBand() (gas: 600306739)
Logs:
diverges at adverse fill (0.1 bp) 315
keep status/reason/previewReason 2 1 0
kill status/reason/previewReason 3 7 7
diverges at adverse fill (0.1 bp) 320
keep status/reason/previewReason 2 1 0
kill status/reason/previewReason 3 7 7
diverges at adverse fill (0.1 bp) 325
keep status/reason/previewReason 2 1 0
kill status/reason/previewReason 3 7 7
diverges at adverse fill (0.1 bp) 330
keep status/reason/previewReason 2 1 0
kill status/reason/previewReason 3 7 7
sweep from/to (0.1 bp) 250 400
diverging fills (0.5 bp grid) 4
band first/last (0.1 bp) 315 330
[PASS] test_Control_BelowBandWithdrawalIsInert() (gas: 19798398)
[PASS] test_Control_FlatFillExecutesEitherWay() (gas: 19726091)
[FAIL: free option: an ordinary withdrawal after commit decides the queued close: 3 != 2] test_Property_WithdrawAfterCommitCannotKillQueuedPartialClose() (gas: 20552408)
Logs:
adverse fill (0.1 bp) 320
KEEP (trader does nothing)
status (2=Executed,3=Failed) / terminalReason 2 1
trader size after 5000000000000000000000
KILL (trader withdraws its free settlement first)
status (2=Executed,3=Failed) / terminalReason 3 7
planner previewClose invalidReason 7
trader size after 10000000000000000000000
custody before / withdrawn / custody after 1998294997 1947305002 50989995
keeper custody before/after 400000 400000
What the tests show
- **Lever 1 property
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 commit-time validation never reads the equity floor and the execution-time checks read live account state (margin and free settlement) that the owner can change after commit, so the outcome is trader-controlled.
Impact
The choice is worth only 0.31 to 0.47 bp of each committed close to the trader, paid by LPs, and the trader still nets a loss after fees, so this is a broken design guarantee rather than a profitable exploit; the window also depends on no other caller executing the order first.
What the attacker needed
A trader account with an open position; no other caller executes the order first; a price signal after commit; free settlement held in the account
The fix
The two remaining levers should be closed the way the settlement floor was closed, by rejecting the equity floor on closes at commit and reserving the partial-close charge or restricting withdrawals while a close is queued, or the guarantee should be restated.
How it was found
- Commit a partial close with an equity floor the residual cannot reach on its own.
- Before anyone executes it, call addMargin to raise the equity the floor reads.
- The same order at the same fill tick now executes instead of failing.
- For the second lever, commit an ordinary partial close with no unusual bound.
- Withdraw the free settlement that the charge collection would otherwise use.
- The close now fails terminally where leaving the settlement in place would let it execute.
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.
When you place an order on this exchange it is meant to be locked in, so you cannot change your mind afterwards. The researcher found that a trader can still nudge things after placing a partial close, either by adding margin or by withdrawing spare cash, so the order succeeds or fails depending on what the trader wants. That gives a small, optional advantage that the protocol said was impossible.
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.