Skip to content
Business logic Audit finding Advanced

Owner-sent protection trigger collects the owner's pending carry via creditBounty, outside its close limits and the receipt

When the owner of a position protection triggers it themselves, the trigger reward credit first collects that account's whole pending carry, which is not checked against the protection's close limits nor recorded in the close receipt. The close then executes above the owner's action-charge ceiling, whereas the same close triggered by another account is refused and latched.

Lester Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#99469 [SC-Low] Owner-sent protection trigger collects the owner's pending carry via creditBounty, outside its close limits and the receipt

Submitted on Nov 13th 2026 at 19:34:46 UTC by @Lester for Audit Competition | Plether

Description

Brief/Intro

The documents say a protection trigger has no carry effect, and that carry is bounded and recorded with the close:

  • "Protection trigger/retry | Queue through the protection path without ordinary commitment carry effects | Append a fresh authenticated zero record; carry is assessed at execution." (ACCOUNTING_SPEC.md:954)
  • "A trigger or retry queues a new close without ordinary commitment carry effects; its execution still settles carry." (CANONICAL_ENTRYPOINTS.md:112-113)
  • "Receipts and financial bounds include the direct collection once, in addition to the residual action settlement" (ACCOUNTING_SPEC.md:723-724)
  • "These limits apply per attempt, including commitment charges, not cumulatively across retries." (WORKING_WITH_AI_AGENTS.md:282)

The code pays the trigger reward with engine.creditBounty(plan.account, refundRecipient, ...) (router/OrderLiquidationBatchLogic.sol:617-619), and creditBounty first collects the pending carry of the reward recipient (CfdEngine.sol:487, :203-217). The recipient is the caller of triggerPositionProtection. When the caller is the account that owns the protection, that account's whole pending carry is collected inside the trigger transaction. This collection is not checked against the protection's close limits and is not in the receipt of the close; the close that follows is assessed with only the carry of the seconds after the trigger.

  • Who pays: the account that owns the protection ("the owner"), in its own trigger transaction.
  • Who can cause it: only that account. Another account's trigger does not touch the owner's carry (PoC tests 2 and 5a).
  • Numbers (PoC, release parameters; LONG 1,000,000 USDG notional, stop-loss armed for 30 days):
    • the owner's ceiling maxActionChargeAssets = 1,015.050281 USDG (the close charge quoted at arming, 914.050281, plus 101.00 headroom);
    • the owner triggers: 333.246575 USDG of carry is collected in the trigger; the close executes with a receipt charge of 914.033157; in total 1,247.279732 USDG of charges, 232.229451 above the ceiling; the receipt shows carry 0.000257 and commitment carry 0;
    • another account triggers, same state, same ceiling: the close is refused with ActionCharge, actual 1,247.279732 > limit 1,015.050281, and the protection becomes Latched.
  • What does not change: the total the owner is charged is the same on both paths (1,247.279732); the pool and the treasury receive the same amounts; the only transfer that differs is the 0.20 USDG trigger reward (tests 3 and 4).

Vulnerability Details

Root cause (pinned commit a82d4fefb02768e5b3bddcc97dee371eee24fea8, packages/perps/src)

router/OrderLiquidationBatchLogic.sol:611-620, trigger branch of updateMarkPrice:

Solidity
if (isProtectionTrigger) {
    uint64 linkedOrderId = host.nextCommitId();
    IPositionProtectionBook.TriggerPlan memory plan =
        protectionBook.activate(protectionId, snapshot.markPrice, snapshot.publishTime, linkedOrderId);
    _registerProtectionTrigger(host, protectionId, linkedOrderId, plan);
    _queueProtectionAttempt(host, linkedOrderId, plan.account, plan.side, plan.size);
    engine.creditBounty(
        plan.account, refundRecipient, plan.triggerBountyAssets, snapshot.markPrice, snapshot.publishTime
    );
}

CfdEngine.sol:482-492, creditBounty:

Solidity
bool syncCurve = _positions[beneficiary].lots > 0;
if (syncCurve) { expectedOldHash = _beginTerminalCurveMutation(beneficiary); }
_checkpointBountyRecipient(beneficiary, price, publishTime);        // :203-217 -> _realizeCarryFromSettlement(beneficiary)
clearinghouse.transferReservedSettlement(sourceAccount, beneficiary, amountAssets);
  • refundRecipient is the caller of PositionProtectionBook.triggerPositionProtection: the Book appends msg.sender to the Router call (PositionProtectionBook.sol:375-376) and the Router reads it back (OrderLiquidationBatchLogic.sol:596-600).
  • There is no branch for refundRecipient == plan.account. With the owner as caller the call is creditBounty(account, account, ...): the account's pending carry is collected from position margin and free settlement and sent to the pool (CfdEngine.sol:1407-1441), then the reward returns to the account it came from.
  • The close attempt was registered two lines earlier by _registerProtectionTrigger (:628-653) with the four retained limits (_protectionCloseRequest, :657-680). That registration records no commitment carry (the receipt's commitment.carryCollectedAssets is 0), and the limits are checked only when the close executes, on the assessment of that moment.
  • So the carry collected by the trigger is in no bound and in no receipt.

The same situation on two neighbouring paths has a no-collection branch

path code document
order reward, executor = the order's own account OrderRouter.sol:336-337: if (bountyRecipient == order.account) { clearinghouse.releaseReservedExecutionBountyToSource(order.account, bountyAssets); } else { engine.creditBounty(...) } "Carry-safe reservation resolution | Opening-bounty release does not checkpoint carry." (SECURITY.md:384)
owner exit of an armed protection (cancelPositionProtectionAndCommitClose): the unused trigger reward returns to the owner OrderLiquidationBatchLogic.sol:176-179: "Release it without a carry checkpoint so all commitment carry is collected, bounded and recorded by the ordinary close path below." "The Router releases the unused trigger bounty without checkpointing carry before ordinary close commitment. All commitment carry is then collected and recorded by the canonical close path, including its gross-debit and action-charge bounds" (SECURITY.md:537-539); project tests test_CancelAndCommitClose_AccruedCarryCannotBypassGrossDebitBound, ..ActionChargeBound (PositionProtection.t.sol:1969, :1989)
protection trigger, caller = the owner OrderLiquidationBatchLogic.sol:617-619: always creditBounty "without ordinary commitment carry effects" (ACCOUNTING_SPEC.md:954)

PoC test 5b runs the first row: an order's own account executes it, the reward is released, and the account's pending carry is unchanged.

Relation to the audit item MED-9 (marked Addressed)

MED-9, "Keepers can retry protection closes without the trader's financial limits": "The protection retains trader-selected ceilings for execution notional, gross account debit, action charges and explicit fees, and copies them into both the initial close and every permissionless retry." (team comment; fix eadc5c58, 2026-10-23). The item's impact text: "A protection close can consume arbitrarily more fees and gross account debit than the trader would be allowed to authorize through a normal bounded V3 order."

  • On the path shown here two of the four retained ceilings do not bound what the close costs: maxActionChargeAssets and maxGrossAccountDebitAssets (PoC test 3: with either one set one atom below the amount the close needs, the close is refused after another account's trigger and executes after the owner's trigger). maxExecutionNotionalAssets and maxExplicitFeesAssets hold on both paths.
  • The lines OrderLiquidationBatchLogic.sol:611-620 are outside the fix diff (git blame: 2026-08-24/25, 2026-10-15 and 2026-10-27; no line from eadc5c58, and git show eadc5c58 does not contain the creditBounty call).
  • Stated plainly: MED-9's own precondition is "A keeper or other external caller triggers the protection". Here the caller is the owner. We do not claim that a keeper can exceed the ceilings.

The program rule for fixed items: "For findings marked as fixed or Acknowledged in the reports above, a report on the same root cause is valid only if it shows that the fix at commit a82d4fefb02768e5b3bddcc97dee371eee24fea8 is incomplete or introduces a new bug." (program page, Known Issues)

Distinct from our own report #98198

#98198 (confirmed) is about carry collected inside commitOrder of an increase order (router/OrderReservationAccounting.sol:108-128, MarginClearinghouse.lockReservedSettlement), which is outside that order's pinned bounds and commitment record. This report is about a different transaction and a different code path: the trigger reward credit of a protection (OrderLiquidationBatchLogic.sol:617-619 -> CfdEngine.creditBounty), and the bounds and receipt of the protected close. Both rest on the same spec sentence (ACCOUNTING_SPEC.md:723).

Measured separation: we applied the first option of the fix recommended in #98198 to a local copy (commitment carry of opens recorded and checked in recordCommitment, _includeCommitment applied to opens; two files, OrderCommitHandler.sol and CfdOrderPolicyEvaluator.sol). On that copy the effect of #98198 is gone, and the PoC of this report gives the same result as on the pinned tree (see Proof of Concept). The protected close is registered by _registerProtectionTrigger, never through the order-commit path that the #98198 fix changes.

Sequence (the owner's own transactions: one)

  1. The owner has a LONG position and arms a stop-loss with createPositionProtection, with closeLimits.maxActionChargeAssets set from the close quote of that moment plus headroom.
  2. Time passes; carry accrues on the position. The mark reaches the stop.
  3. The owner calls triggerPositionProtection itself (the function is open to any account).
    • Inside this transaction its pending carry is collected and the reward returns to it.
  4. Any account executes the queued close. It is assessed with (almost) no carry, passes the owner's ceiling and executes.

The same sequence with another account as the caller in step 3: the close is refused on the owner's ceiling and the protection becomes Latched.

Impact Details

Measured effect (PoC, USDG; release risk parameters; pool 5,000,000 Junior + 5,000,000 Senior; the owner LONG 10,000 lots = 1,000,000 notional at 1.0000 with 100,000 margin; another trader SHORT of the same size; stop at 1.0100; 30 days between arming and the stop)

the owner triggers another account triggers
carry pending before the trigger 333.246575 333.246575
collected in the trigger transaction 333.246575 (pool +333.246575) 0
trigger reward paid away by the owner 0 (returns to it) 0.20
ceiling maxActionChargeAssets = 1,015.050281: close executes refused: ActionCharge, actual 1,247.279732 > 1,015.050281; Latched, position open
close receipt: action charge / carry / commitment carry 914.033157 / 0.000257 / 0 (no execution)
charges the owner pays in total 1,247.279732 = 232.229451 above the ceiling 0.20 (reward only)

With all four limits unlimited (both closes execute; test 3):

the owner triggers another account triggers
charges borne by the owner (carry + execution fee + price impact) 1,247.279732 1,247.279732
of which carry 333.246832 (333.246575 in the trigger + 0.000257 in the close) 333.246832 (in the close)
close receipt: action charge 914.033157 1,247.279732
close receipt: gross account debit 10,914.033157 11,247.279732
receipt short of what was paid 333.246575 (both fields) 0
owner's end worth 1,988,852.494912 1,988,852.294912 (0.20 less: the reward)

Each of the four limits, set one atom below what the close needs after another account's trigger (test 3):

limit value set another account triggers the owner triggers
maxExecutionNotionalAssets 1,009,999.999999 refused (ExecutionNotional) refused
maxGrossAccountDebitAssets 11,247.279731 refused (GrossAccountDebit) executes
maxActionChargeAssets 1,247.279731 refused (ActionCharge) executes
maxExplicitFeesAssets 403.999999 refused (ExplicitFees) refused

Every other party, from before the trigger to after the close, unlimited limits (test 4):

party the owner triggers another account triggers
owner -11,247.279732 -11,247.479732
pool cash (LP side) +10,843.279732 +10,843.279732
treasury +404.000000 +404.000000
the other account (keeper) 0 +0.200000
sum 0 0

Preconditions and limits, stated plainly

  • Only the owner can cause it. At both creditBounty call sites the recipient is the caller: the trigger (OrderLiquidationBatchLogic.sol:617, caller of triggerPositionProtection) and order settlement (OrderRouter.sol:339, caller of executeOrder, and only when it is not the order's own account). No entry point takes a recipient parameter. Test 5a: another account's trigger leaves the owner's carry at 333.246575. Test 5b: at the order site neither the order's own account nor another executor causes a collection of the order owner's carry. The liquidation reward (CfdEngine.sol:1336-1338) is likewise paid to the caller and skips the liquidated account (read, not tested).
  • The owner pays the same total on both paths. Carry is owed either way; the trigger moves when it is collected and whether the limits and the receipt see it. Nobody gains except that the owner keeps its own 0.20 reward.
  • No other party is worse off. Pool and treasury receive the same amounts (table above).
  • A documented owner action reaches the same end state. After another account's trigger the owner can make an ordinary deposit; "A deposit credits custody and checkpoints carry" (CANONICAL_ENTRYPOINTS.md:31). Test 7: a 1 USDG deposit collects the 333.246575 and the close then executes under the same ceiling with the same receipt charge 914.033157. So the close limits do not bound carry that the owner pays through its own other transactions. What this report shows is narrower: the trigger transaction itself collects it, where the documents say the trigger has no carry effect, and the two neighbouring paths were given a no-collection branch.
  • Project test of the mechanism. test/perps/accounting/carry/CarryCreditCheckpoint.t.sol:275 (test_SelfBountyProtectsReserveThenReleasesFullCredit, 2026-09-09) calls engine.creditBounty(ACCOUNT, ACCOUNT, ...) directly and expects the carry collection. It predates the no-collection branch of the order path (2026-10-15) and the spec row quoted first (2026-10-26); it does not name the trigger, the close limits or the receipt.
  • Size. The amount outside the limits is the carry accrued since the account's last carry collection: 333.246575 over 30 days here (about 11.1 per day for this position and pool). The close executes instead of being refused only when the ceiling lies between the charge without that carry and the charge with it.
  • The book in the PoC is balanced by another trader's SHORT so that the close has a positive price-impact charge; that trader takes no part in the sequence.
  • Not done: a control with a fix installed.

Impact rows of the program, element by element

program row (verbatim) elements met by a test?
critical | Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield a party ends with funds that belonged to another not met: owner's charges equal on both paths (test_3), pool / treasury equal (test_4)
critical | Permanent freezing of funds funds that cannot be moved not met: the owner withdraws its whole balance (test_6)
critical | Protocol insolvency liabilities above assets not met: closed system, pool receives the same (test_4)
high | Theft of unclaimed yield yield of LPs goes elsewhere or is not paid not met: the same carry reaches the pool on both paths, 333.246832 (test_3, test_4)
high | Permanent freezing of unclaimed yield same, frozen not met (test_4)
high | Temporary freezing of funds for at least 24 hours funds unavailable, duration not met (test_6)
medium | Temporary freezing of funds for at least 1 hour funds unavailable, duration not met (test_6)
medium | Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol) (a) an account other than the damaged party causes it; (b) damage to users or the protocol (a) not met: test_5a, test_5b (another account cannot cause the collection); (b) not met: test_3, test_4 (same charges, same receipts of pool and treasury)
medium | Smart contract unable to operate due to lack of token funds a contract short of tokens not met (test_4)
medium | Theft of gas - not applicable, no test
medium | Block stuffing - not applicable, no test
medium | Unbounded gas consumption - not applicable, no test
low | Contract fails to deliver promised returns, but doesn't lose value (a) a documented promise is not delivered; (b) no value is lost (a) met: test_1 (carry 333.246575 collected in the trigger; 232.229451 above the owner's ceiling; receipt carry 0.000257, commitment carry 0), test_2 (same ceiling refuses the close after another account's trigger), test_3 (two of the four limits; receipt short by 333.246575); (b) met: test_4, test_6 (sum of all changes 0)

Impact (Low): "Contract fails to deliver promised returns, but doesn't lose value". It is the highest row whose every element has an assertion. The row one level above (Griefing) was examined with tests 5a, 5b and 7: both of its elements are unmet, not one. There is no row below Low in the program; the floor is an Insight.

  • Bound: only the owner's own trigger; amount = the carry accrued since its last collection (333.246575 in the PoC); the owner's total cost is unchanged.
  • Likelihood: the owner triggering its own protection is foreseen ("allows another operator or the trader to act when the usual automation is unavailable", docs.plether.com, Keepers and permissionless execution); it needs carry accrued since the last collection, which every open position has.

Known-issue review

Sources searched (2026-11-13): the repository documents packages/perps/*.md and NatSpec at the pinned commit; the project's own tests; git log of the repository (1,496 commits; message search and -S on the two call sites); the five audit texts linked by the program (Cecuro AI audit 2026-10-26, AI scan of 2026-10-15, pre-audit report, collaborative audit 2026-05-12, Cantina 2026-01); the program page's Known Issues; public GitHub lists of Plether-Fi/plether-core (issues, pull requests, commits since the pin) and immunefi-team/audit-comp-plether (issues disabled, no pull requests); docs.plether.com (index and the pages "Take profit and stop loss", "Keepers and permissionless execution", "Trading costs: fees, carry and VPI").

Closest items and why they differ:

item what it says difference
Cecuro MED-9 (Addressed) a keeper's trigger or retry closes the trader without financial limits fixed for the close attempt; the reward credit of the trigger is outside the fix; here the caller is the owner
Cecuro MED-30 (Addressed, partly open: no automatic frozen-market trigger) manual exit cancelPositionProtectionAndCommitClose; "commitment carry is collected and checked against the close limits" the sibling path that got the no-collection release; the trigger path did not
Cecuro LOW-34 (Addressed by documentation) the evaluator's carry field can overstate collected carry on a close opposite direction (over-report), ordinary close
AI scan, Low "Protection trigger bounty is paid before a zero-bounty close is executed" the caller is paid at trigger time and may not finish the close same three code lines, a different claim (incentive); nothing about carry or the owner as caller
ACCOUNTING_SPEC.md:702-705, SECURITY.md:954-957, NatSpec CfdEngine.sol:461-463 "claim payments and keeper bounty credits first collect all available margin and free settlement toward carry" the documented rule for a reward recipient; it does not say the reward of a trigger sent by the protected account collects that account's carry outside its close limits
project test CarryCreditCheckpoint.t.sol:275 Engine-level creditBounty(ACCOUNT, ACCOUNT) collects carry see "Preconditions and limits"
WORKING_WITH_AI_AGENTS.md:345 "An order receipt alone does not contain that full history or the separate trigger bounty movement." about the reward movement, not a carry collection
Program Known Issues: MED-7, MED-13, MED-16, LOW-57, MED-22 (carry rounding), MED-24, MED-29, MED-30, HIGH-1 - none concerns the trigger reward or carry at a trigger
plether-core issue #137; pull requests #90, #115, #124; commits after the pin (#136) deployed risk configuration; carry collection before credits; zero close bounties; MED-9 / MED-30 fix; test speed no change of the trigger reward credit; no public fix
our own #98198 carry at increase commitment different path; separation measured (above)

Recommended fix

In the trigger branch, release a reward that returns to its own source without a carry collection, as the two neighbouring paths do:

Solidity
if (refundRecipient == plan.account) {
    clearinghouse.releaseReservedExecutionBountyToSource(plan.account, plan.triggerBountyAssets);
} else {
    engine.creditBounty(plan.account, refundRecipient, plan.triggerBountyAssets, snapshot.markPrice, snapshot.publishTime);
}

Alternative: keep the collection and record it in the close attempt's commitment (carryCollectedAssets, custody before and after) so that the retained limits and the receipt include it once.

References

  • Code (pinned commit a82d4fefb02768e5b3bddcc97dee371eee24fea8, packages/perps/src): router/OrderLiquidationBatchLogic.sol#L585-L620, #L628-L680, #L168-L181; CfdEngine.sol#L203-L217, #L460-L493, #L1407-L1441; OrderRouter.sol#L314-L344; PositionProtectionBook.sol#L371-L379.
  • Documents: ACCOUNTING_SPEC.md :702-705, :723-724, :954; CANONICAL_ENTRYPOINTS.md :31, :112-113; SECURITY.md :384, :537-539, :954-957; WORKING_WITH_AI_AGENTS.md :231, :276-284, :343-345.
  • Project tests: test/perps/spec/trader/PositionProtection.t.sol :1969, :1989; test/perps/accounting/carry/CarryCreditCheckpoint.t.sol :275.
  • Audit: Cecuro AI audit 2026-10-26, MED-9, MED-30, LOW-34; AI scan 2026-10-15, "Protection trigger bounty is paid before a zero-bounty close is executed".

Proof of Concept

Proof of Concept

Runnable Foundry test in the repository's own suite at the pinned commit. No in-scope contract is modified; the only mocks are the fixture's MockPyth and USDG mock (both outside the scope). No vm.store, no vm.etch, no protocol address is impersonated. Release risk parameters (DEPLOYMENT.md: carry 500 bps, trigger reward 0.20 USDG).

Bash
git clone --recurse-submodules https://github.com/immunefi-team/audit-comp-plether
cd audit-comp-plether
git checkout --detach a82d4fefb02768e5b3bddcc97dee371eee24fea8
git submodule update --init --recursive
# save the test below as packages/perps/test/PocS7_SelfTriggerCarry.t.sol
FOUNDRY_SPARSE_MODE=true forge test --root packages/perps --match-path 'test/PocS7_*' -vv   # Foundry 1.5.1

No env vars or RPC needed. Expected: 8 passed; 0 failed. Sparse mode compiles only what the test needs (194 files, about 90 s cold).

Accounts and every vm.prank in the file

address in the test role calls made under vm.prank
ACCOUNT the trader that owns the position and its protection ("the owner"); no privileged role commitOrder, createPositionProtection, triggerPositionProtection (tests 1-3, 6), clearinghouse.deposit (test 7), clearinghouse.withdraw (test 6)
KEEPER "another account"; no privileged role updateMarkPrice, executeOrder, triggerPositionProtection (controls), pool.settleLpEpoch (setup; permissionless)
ACCOUNT_2 another trader; no privileged role commitOrder, executeOrder (test 5b)
JLP, SLP liquidity providers; no privileged role requestDeposit, claimDeposit (setup)
the test contract deployer / owner of the fixture only in setUp: the fixture's deployment and _setSeniorCapacity (release Senior cap 40M / 80 %: proposePoolConfig, finalizePoolConfig). No owner call after setUp

Setup (USDG; prices with 8 decimals)

  1. Pool: 5,000,000 Junior + 5,000,000 Senior, deposited through the vaults' request / settle / claim flow.
  2. ACCOUNT_2 opens SHORT 10,000 lots, then ACCOUNT opens LONG 10,000 lots (1,000,000 notional, 100,000 margin) at 1.0000; both through commitOrder + executeOrder.

Steps of the leading sequence (test 1)

  1. ACCOUNT reads the close charge at the stop price in the current book (914.050281, of which execution fee 404.00) and arms a stop-loss at 1.0100 with maxActionChargeAssets = 1,015.050281 (quote + 25 % of the fee); the other three limits are unlimited.
  2. 30 days pass. Pending carry of ACCOUNT: 333.246575.
  3. The mark is 1.0100. ACCOUNT calls triggerPositionProtection. In this transaction: ACCOUNT -333.246575, pool +333.246575, pending carry 0.
  4. KEEPER executes the queued close two seconds later: Executed. Receipt: action charge 914.033157, carry 0.000257, commitment carry 0.
  5. Carry collected in the trigger + receipt charge = 1,247.279732, which is 232.229451 above the ceiling.

Control (test 2): the same state and ceiling, KEEPER calls triggerPositionProtection: ACCOUNT pays 0.20, its carry stays 333.246575, the close is refused (ActionCharge, actual 1,247.279732, limit 1,015.050281), the protection is Latched, the position stays open.

Other tests: 3 totals on both paths with unlimited limits, and each of the four limits one atom below the need; 4 every other party and the sum of changes; 5a another account's trigger cannot collect the owner's carry; 5b at the order call site a reward that returns to the order's own account is released without a carry collection, and another executor does not collect the order owner's carry either; 6 the elements of the impact rows (the promise, no value lost, nothing frozen: the owner withdraws its whole balance); 7 control for the stated limit: after another account's trigger, a 1 USDG deposit by the owner collects the carry and the close executes under the same ceiling.

The same file on a tree with the recommended fix of our report #98198 applied (first option of that report: commitment carry of opens recorded and bounded; two files changed): 8 passed; 0 failed, and every logged amount is equal to the run on the pinned tree. The two reports have different causes.

Output of the run (clean copy of the pinned tree; compiler warnings left out, none of them names the test file; amounts are USDG atoms, 6 decimals):

Ran 8 tests for test/PocS7_SelfTriggerCarry.t.sol:PocS7_SelfTriggerCarryTest
[PASS] test_1_OwnerTriggersOwnProtection_CarryCollectedOutsideCloseLimitsAndReceipt() (gas: 5527577)
Logs:
    owner's ceiling: close charge quoted at arming / execution fee in it / maxActionChargeAssets 914050281 404000000 1015050281
    [owner triggers] carry due before the trigger / carry left right after it 333246575 0
    [owner triggers] trigger transaction: change of account / pool cash / keeper
  -333246575
  333246575
  0
    [owner triggers] close status (2 = Executed, 3 = Failed) / protection status / position lots 2 4 0
    [owner triggers] close receipt: action charge assessed / collected / gross account debit 914033157 914033157 10914033157
    [owner triggers] close receipt: execution fee / carry / commitment carry 404000000 257 0
    [owner triggers] close receipt: price-impact charge (signed) / realized price PnL (signed)
  510032900
  -10000000000
    [owner triggers] account worth: before the trigger / after the close attempt 2000099774644 1988852494912
    [owner triggers] close receipt: failed constraint (4 = ActionCharge) / actual / limit 0 0 0
    carry collected in the trigger + close charge in the receipt = paid / above the ceiling by 1247279732 232229451

[PASS] test_2_Control_AnotherAccountTriggers_SameCeilingRefusesTheClose() (gas: 8566015)
Logs:
    [another account triggers] carry due before the trigger / carry left right after it 333246575 333246575
    [another account triggers] trigger transaction: change of account / pool cash / keeper
  -200000
  0
  200000
    [another account triggers] close status (2 = Executed, 3 = Failed) / protection status / position lots 3 8 10000
    [another account triggers] close receipt: action charge assessed / collected / gross account debit 0 0 0
    [another account triggers] close receipt: execution fee / carry / commitment carry 0 0 0
    [another account triggers] close receipt: price-impact charge (signed) / realized price PnL (signed)
  0
  0
    [another account triggers] account worth: before the trigger / after the close attempt 2000099774644 2000099574644
    [another account triggers] close receipt: failed constraint (4 = ActionCharge) / actual / limit 4 1247279732 1015050281
    same ceiling: close after another account's trigger / after the owner's trigger (2 = Executed, 3 = Failed) 3 2
    assessed charge refused on the other accoun

The original report as published on Immunefi, by Lester. Images and videos are our own copies; raw HTML is shown as text. View it on Immunefi.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the trigger branch always calls creditBounty, which checkpoints and collects the recipient's pending carry, instead of releasing a reward that returns to its own source without a carry collection as the neighbouring order and cancel paths do.

Impact

The owner's close can execute 232.229451 USDG above their action-charge ceiling with the carry missing from the receipt, but only the owner can cause it, the owner's total cost is unchanged, and pool and treasury receive the same amounts.

What the attacker needed

Owner holds an open position with carry accrued; owner triggers their own protection; stop price reached

The fix

The trigger branch should release a reward that returns to its own source without a carry collection when the caller is the protected account, or record the collected carry in the close attempt's commitment so the limits and receipt include it.

How it was found

  1. The owner arms a stop-loss with a close limit set from the close quote plus headroom.
  2. Time passes and carry accrues on the position until the mark reaches the stop.
  3. The owner calls triggerPositionProtection themselves, which collects their pending carry and returns the reward to them.
  4. Any account executes the queued close, which is assessed with almost no carry and passes the owner's ceiling.

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 can set a stop-loss with a spending cap, so the automatic close cannot cost more than they agreed. Here, if the trader presses the trigger button themselves, a fee-like charge (carry) is taken at that moment and the cap never sees it, so the close goes through above the cap. If anyone else presses the button, the same close is correctly refused.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by Lester

View all

11 more disclosed reports, best first.

More from Plether

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.