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.
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
OperatorResolver.importOperators()is called to remove an operator.- A user calls
NestedFactory.create()that uses the operator that was being removed / updated. 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.
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
- Call importOperators to remove an operator.
- Call NestedFactory.create, which uses the operator being removed or updated.
- 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.