Skip to content
Business logic Audit finding Intermediate

Ensure on-chain that cache is synced

Core factory functions rely on a cache of operators being in sync, but removing or updating an operator does not immediately rebuild that cache. A user could therefore call create or swap functions that still use a removed or outdated operator until the cache is rebuilt.

GreyArt Follow

Originally disclosed on Code4rena

Submitted by GreyArt, also found by WatchPug

Impact

Currently, many core operations (like NestedFactory.create(), NestedFactory.swapTokenForTokens()) are dependent on the assumption that the cache is synced before these functions are executed however this may not necessarily be the case.

Proof of Concept

  1. OperatorResolver.importOperators() is called to remove an operator.
  2. A user calls NestedFactory.create() that uses the operator that was being removed / updated.
  3. NestedFactory.rebuildCache() is called to rebuild cache.

This flow is not aware that the cache is not in synced.

Recommended Mitigation Steps

Add a modifier to require that the cache is synced to all functions that interact with the operators.

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

Likely the contract assumes the operator cache is always in sync, but operator removal or update does not force a cache rebuild before dependent functions execute.

Impact

Until the cache is rebuilt, core operations could use a removed or outdated operator, which may let users interact with logic that should no longer be active.

What the attacker needed

An operator is removed or updated; cache is not rebuilt before use

The fix

A modifier should be added to require that the cache is synced on all functions that interact with operators.

How it was found

  1. Call importOperators to remove an operator.
  2. Call NestedFactory.create, which uses the operator being removed or updated.
  3. Call rebuildCache to rebuild the cache.

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 keeps a local copy (a cache) of a list of helper contracts called operators so it does not have to look them up every time. When an operator is removed or changed, that local copy is not updated straight away, so the contract can keep using the old or removed helper. The report says this gap should be closed by checking the cache is up to date before any function that uses operators runs.

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 GreyArt

View all

12 more disclosed reports, best first.

More from Nested Finance contest

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.