Skip to content
Business logic Audit finding Advanced

Stale price cache bypasses oracle config changes

The batch price function returns cached prices before checking whether an asset is enabled or its oracle source has changed, and admin functions that update oracle configuration do not clear the cache. An attacker could keep using a stale or manipulated price for borrow, withdraw, swap or liquidation flows until the cache expires, even after an admin has disabled the asset or rotated the oracle.

v12 Follow with 0xterrah, hezze and 13 others

Originally disclosed on Code4rena

Submitted by v12, also found by 0xterrah, hezze, ht111111, JohnTears, Kear_07, Lamsy, maxzuvex, Mikeyxyz, orangesantra, oziajibogu, Ronke, siddforreal_1, suhail007, Trynax, and y4y

Found by V12

  • contracts/price-oracle/src/contract.rs #L438
  • contracts/price-oracle/src/contract.rs #L176
  • contracts/price-oracle/src/contract.rs #L193
  • contracts/price-oracle/src/contract.rs #L212
  • contracts/price-oracle/src/contract.rs #L251
  • contracts/price-oracle/src/contract.rs #L647
  • contracts/kinetic-router/src/price.rs #L88

Targets

  • PriceOracleContract::getassetprices_vec
  • PriceOracleContract::setassetenabled
  • PriceOracleContract::updatereflectorcontract
  • PriceOracleContract::setcustomoracle
  • PriceOracleContract::setfallbackoracle
  • PriceOracleContract::setbatchoracle
  • KineticRouter::verifyoraclepriceexistsand_nonzero

Affected Locations

  • PriceOracleContract.getassetprices_vec: Returns cached LastPriceData before reading current asset configuration or enforcing config.enabled for batch price requests.
  • PriceOracleContract.setassetenabled: Disables an asset in config but does not invalidate the cached price entry that batch callers can still consume.
  • PriceOracleContract.updatereflectorcontract: Updates reflector configuration without clearing LastPriceData, so prior cached prices can survive the source change.
  • PriceOracleContract.setcustomoracle: Changes the custom oracle source without invalidating cached prices already stored for the asset.
  • PriceOracleContract.setfallbackoracle: Changes the fallback oracle source without invalidating cached prices already stored for the asset.
  • PriceOracleContract.setbatchoracle: Changes the batch oracle source without invalidating cached prices already stored for the asset.
  • KineticRouter.verifyoraclepriceexistsand_nonzero: Accepts any fresh non-zero price returned through the batch oracle path, exposing router flows to stale cached prices after admin mitigation.

Description

PriceOracleContract::get_asset_prices_vec uses LastPriceData before it loads the asset’s live configuration, so a cached price can be returned even after the asset has been disabled or its oracle source has been changed. The router relies on this batch path, including through verify_oracle_price_exists_and_nonzero, which means price-sensitive flows continue trusting the cached value during the TTL window. This creates an inconsistent trust boundary because get_asset_price_data_with_config checks enabled before consulting cache, but batch resolution does not. The issue is amplified because admin mitigation functions such as set_asset_enabled, update_reflector_contract, set_custom_oracle, set_fallback_oracle, and set_batch_oracle update config without invalidating LastPriceData. The same fix pattern resolves all of these cases: enforce current config before serving cached data and clear cached prices whenever oracle-relevant configuration changes.

Root Cause

The batch oracle path in get_asset_prices_vec trusts cached LastPriceData before checking current asset configuration, and oracle-config admin functions do not invalidate that cache.

Impact

After admins disable a broken asset or rotate to a safer oracle, users can still execute borrow, withdraw, collateral, swap, or liquidation flows using the stale cached price until the TTL expires. If that cached price is stale or manipulated, the protocol can accept undercollateralized debt, mis-handle liquidations, or otherwise misallocate value based on a price the admin explicitly tried to stop using.

Proof of Concept

See this gist for full Proof of Concept


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

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 batch price path reads the cached LastPriceData before loading the asset's current configuration, and the admin functions that change oracle settings never invalidate that cache.

Impact

Until the cache TTL expires, users could still borrow, withdraw, swap or liquidate using a stale or manipulated price that the admin had explicitly disabled or replaced, potentially accepting undercollateralised debt or mis-handling liquidations.

What the attacker needed

Admin has changed oracle config or disabled asset; cached price still within TTL; price-sensitive router flow

The fix

The batch path should enforce the current asset configuration before serving cached data, and every oracle-relevant admin change should clear the cached prices.

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 price oracle is a contract that tells the protocol what an asset is worth. This protocol keeps a short-lived copy of recent prices to save gas, but it hands out that copy without first checking whether the asset is still allowed or whether the price source was just replaced. So for a short window, the protocol can act on an old price that an admin already tried to stop using.

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 v12

View all

37 more disclosed reports, best first.

More from K2

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.