Skip to content
Business logic Audit finding Advanced

ExecuteOrderBatch reverts as a whole whenever Pyth component publish times differ, because batch cache reuse checks every stored feed against the newest component time

The batch order execution path reuses a previously proven price basket for later orders, but the reuse check requires every stored Pyth feed to be at least as new as the basket's newest component time. When feeds have unequal publish times, this check fails and the whole batch reverts, even though the same orders succeed one at a time.

griffinf Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

#97603 [SC-Medium] executeOrderBatch reverts as a whole whenever Pyth component publish times differ, because batch cache reuse checks every stored feed against the newest component time

Submitted on Nov 2nd 2026 at 14:12:36 UTC by @Griffinf for Audit Competition | Plether

Description

Severity claimed: Low.

The Router's batch execution path reuses a proven historical basket for later orders in the same batch when every component time follows the later order's commit (OrderRouterExecutionSidecar.sol:997, :1074-1093). On reuse, PletherOracle.updateBatchOrderExecutionPrice re-proves Pyth storage coverage by requiring every stored feed to be at least cache.publishTime, which is the basket's newest component time (PletherOracle.sol:264-266). The fresh historical path, by contrast, checks each stored feed against its own parsed component time (PletherOracle.sol:624-626). Plether's live paths parse without writing Pyth storage, so the stored time of a quieter feed is typically the time the earlier historical update wrote for it, which is older than the newest component. With real six-feed data, where components rarely share a publish time, the reuse branch reverts StoredFeedBehind. The revert is not caught by the Router (:1019-1027 absorbs only HistoricalParserFailure), so the entire batch reverts and all earlier progress is rolled back. The same orders execute one at a time with the same payload.

Precondition, stated plainly: two or more orders committed before the oldest component tick that follows the first commit, and a payload whose components have unequal publish times. An attacker can arrange the first condition by committing a small order right after a victim's; the second is the normal shape of Pyth FX data. The documented mitigation is that keepers fall back to single execution, which is why I claim Low rather than Medium.

The expected pushback, answered: ORACLE_SYNCHRONIZATION.md lists "failed cache coverage" as a whole-transaction revert. It presents that as a defence against a bad cache, not as the behaviour of the honest happy path on ordinary data. The repository's own test_BatchReusesBasketWhenEveryComponentFollowsBothCommits passes only because it first pushes newer Pyth storage by hand for every feed, which a production keeper does not do.

Asset: packages/perps/src/PletherOracle.sol and packages/perps/src/OrderRouterExecutionSidecar.sol at a82d4fefb02768e5b3bddcc97dee371eee24fea8.

Relationship to published known issues

  • Program known-issues entry "Cecuro MED-7 (partly fixed): a caller can still pick an older valid signed price per feed" concerns live-basket component selection. This report concerns the batch cache coverage check on the historical path and does not depend on which tick the caller picks.
  • Not in SECURITY.md known limitations, the Cecuro AI audit, or the 2026-10-15 scan. Cecuro MED-7/18/20/21/23 and LOW-36/68 covered the live-basket and historical paths rewritten in #120; none concerns the batch cache coverage check.
  • The known "historical price availability leaves the order pending" issue is about a missing qualifying tick, not about a coverage check failing on a basket the oracle has already proven.

Root cause

Reuse coverage uses one timestamp for all feeds (PletherOracle.sol:262-266):

Solidity
if (!policy.oracleFrozen && _canReuseHistoricalBatchBasket(request.commitTime, cache)) {
    // Cache contents are caller-supplied; independently prove storage coverage, not price authenticity.
    for (uint256 i; i < pythFeedIds.length; ++i) {
        _requireStoredFeedCoverage(pythFeedIds[i], cache.publishTime);   // newest component time for every feed
    }

The fresh path uses each feed's own time (PletherOracle.sol:624-626), so the first order in the batch passes and the second fails on exactly the same data. BatchOrderPriceCache carries only publishTime and oldestPublishTime, not per-feed times, so the reuse branch has no way to make the per-feed check.

Vulnerability details

Paths relative to the repository root at a82d4fef.

Trigger. Order 1 and order 2 are committed at C and C+1. A payload has feed 1 at C+4 and feed 2 at C+5. The first item resolves historically: updatePriceFeeds writes feed 1 at C+4, feed 2 at C+5; per-feed coverage passes. The Router decides the basket is reusable for order 2 (every component follows C+1). The reuse branch requires feed 1's stored time to be at least C+5; it is C+4; StoredFeedBehind(feed 1, C+4, C+5) reverts the whole batch.

Not absorbed. The Router's try/catch around the oracle call treats only HistoricalParserFailure as a retryable item outcome; any other revert propagates (OrderRouterExecutionSidecar.sol:1019-1027).

Workaround exists. The same two orders executed with executeOrder one at a time, same payload, both fill.

Impact

  • Keeper batch execution fails on ordinary data whenever two batched orders qualify for cache reuse; earlier items in the batch are rolled back and the keeper pays the gas and Pyth fees for nothing.
  • A griefer can make a specific victim's order always sit in a reuse-eligible pair by committing a small order immediately after it, forcing keepers to single-execute.
  • No funds are lost; queue progress is delayed until keepers fall back to single execution.

Recommended fix

  1. Carry per-feed component times (or the minimum stored-coverage time actually proven) in BatchOrderPriceCache and check each feed against its own time in the reuse branch.
  2. Alternatively, treat a failed coverage check as "not reusable" and fall through to a fresh historical parse instead of reverting.
  3. Make the existing batch-reuse test use a payload with unequal component times and no manual Pyth storage push.

Link to Proof of Concept

https://gist.github.com/aussinfosec/52e4eb169a4a878634879a8e98a304f1

Proof of Concept

Gist (secret): https://gist.github.com/aussinfosec/52e4eb169a4a878634879a8e98a304f1

Bash
git clone https://github.com/immunefi-team/audit-comp-plether.git && cd audit-comp-plether
git checkout a82d4fefb02768e5b3bddcc97dee371eee24fea8 && git submodule update --init --recursive
mkdir -p packages/perps/test/perps/poc   # copy PoC_B_BatchReuseCoverage.t.sol from the gist here
forge test --root packages/perps --match-path test/perps/poc/PoC_B_BatchReuseCoverage.t.sol -vv

Stages (test_BatchRevertsOnReuseWhileSinglesSucceed, on the repository's OracleSynchronizationTestBase with the six-feed oracle and explicit payloads):

  1. Two orders are committed one second apart. A payload with unequal component times after both commits is built.
  2. executeOrderBatch(2, payload) reverts with StoredFeedBehind; nextExecuteId() is unchanged at 1.
  3. executeOrder is called twice with the same payload; both fill; nextExecuteId() is 0.

Observed output:

Text
[PASS] test_BatchRevertsOnReuseWhileSinglesSucceed()
  executeOrderBatch(2) reverted StoredFeedBehind; nextExecuteId stays 1
  single executeOrder x2 succeeded; nextExecuteId 0

The original report as published on Immunefi, by Griffinf. 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

The reuse branch checks all stored feeds against one shared timestamp (the basket's newest component time) instead of each feed's own parsed time, and the cache does not store per-feed times.

Impact

Keeper batch execution fails on ordinary data when two batched orders qualify for cache reuse, wasting gas and Pyth fees and delaying queue progress; no funds are lost because keepers can fall back to single execution.

What the attacker needed

Two or more orders batched together; payload with unequal feed publish times; orders committed before oldest component tick

The fix

The cache should carry per-feed component times and check each feed against its own time, or a failed coverage check should be treated as not reusable and fall through to a fresh parse.

How it was found

  1. Commit two orders one second apart and build a payload whose component publish times are unequal and after both commits.
  2. Call executeOrderBatch with two orders; it reverts with StoredFeedBehind and the next execution id stays unchanged.
  3. Call executeOrder twice with the same payload; both fill and the next execution id reaches zero.

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 smart contract here processes several orders in one batch and reuses a set of price readings it already checked. Each price reading (feed) can have a slightly different timestamp. The reuse check compares every feed against the single newest timestamp, so a slightly older feed fails the check and the entire batch is cancelled. Running the orders one by one avoids the problem.

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 griffinf

View all

14 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.