factory
security audit
an automated adversarial security audit of the public factory AMM, conducted with claude opus 4.8 (anthropic) across more than 100 specialized agents. every confirmed critical and high-severity finding in scope was fixed; the criticals were reproduced and re-verified on octra devnet.
this automated review complements but does not replace a formal third-party human audit, which is planned ahead of a mainnet deployment. factory is currently beta software on devnet, where all tokens come from the faucet and have no real value.
the codebase was reviewed by more than 100 specialized agents across two independent adversarial passes: a 96-agent fan-out audit and a 6-agent council that debated each other's conclusions, with the results cross-validated. every reported issue was then re-checked by independent skeptic agents instructed to refute it; only findings that survived were kept. each confirmed critical was reproduced against the live contracts, fixed, and the fix re-verified on-chain (for example, attempting the liquidity-theft exploit and confirming it now reverts, while a legitimate operation still succeeds).
| id | sev | finding | resolution | status |
|---|---|---|---|---|
| C-1 | critical | liquidity could be burned against another LP's position. a missing ownership check let anyone remove liquidity they did not own and credit themselves a victim's underlying tokens, draining LP principal. | position updates now reject removing more liquidity than the caller owns. re-verified on-chain: over- and un-owned burns revert; a legitimate burn succeeds. | fixed ✓ |
| C-2 | critical | swap routing could be captured by a squatter pool. the router and quoter resolved a pair to the most recently registered pool, so an attacker could register a fake pool last and capture swap flow (and the reference price). | routing now resolves through a factory canonical index where the first registrant for a pair+fee wins, read in o(1). re-verified on-chain: a shadow pool cannot displace the canonical one. | fixed ✓ |
| H-1 | high | stale fee accounting on tick re-initialization. a tick reused after going inactive kept its old fee-growth value, corrupting fee math for positions spanning it. | tick fee-growth is reset to zero when a tick is re-initialized. | fixed ✓ |
| H-2 | high | pool price oracle trusted only the router, not the bytecode. the quote/fee-tier path could be pointed at a fake pool acting as the price source. | quotes now resolve through the same canonical pool that swaps use, anchored to the verified pool bytecode. | fixed ✓ |
| H-3 | high | pool-trust gate failed open. when the on-chain code-hash lookup returned nothing, the ui treated the pool as trusted, letting an unverifiable contract through. | the trust gate is fail-closed: an empty router or unreadable code-hash is treated as untrusted and the pool is ignored. | fixed ✓ |
| H-4 | high | attacker-controlled factory link. a pool deployed pointing at an attacker's factory could pass the ui trust checks yet hand protocol-fee control to the attacker. | the ui now verifies a pool points at the canonical factory before trusting it. | fixed ✓ |
| H-5 | high | protocol-fee setter accepted an invalid value. a negative fee denominator could invert the protocol skim and leave the pool insolvent. | the setter now bounds the value to off, or a safe in-range fraction. | fixed ✓ |
| M-1 | medium | look-alike token spoofing. the shared token registry is open, so anyone could publish a symbol (e.g. a known ticker) for their own address and have it appear trusted. | only the curated token list is marked verified; every registry-sourced or address-imported token shows an "unverified" badge in the selector. | fixed ✓ |
while extending the swap engine, the review also surfaced a latent rounding flaw in the pool's native exact-output math (it could fail to converge and revert). the exact-output feature was built to route through the verified exact-input path instead, sidestepping the flaw with no risk to pool solvency.
security auditing reduces risk; it does not prove the absence of bugs. this report covers the public AMM at the time of review and does not cover the underlying octra chain or third-party wallets. use the protocol with funds you are comfortable risking on devnet software, and report any issue to @factory_oct or via the contact in the footer.