We appreciate ChainSecurity for very deep and thoughtful analysis!
Curve implements a stablecoin price oracle that combines prices from multiple Curve StableSwap pools. The aggregator assigns capped liquidity weights and reduces the influence of prices that deviate from the weighted reference price. It supports both legacy and StableSwap-NG pools and exposes the resulting price to downstream protocols.
The most critical subjects covered in our audit are price correctness and availability, and the resistance of liquidity-based weighting to manipulation. The most severe finding allowed a zero-supply legacy pool to block oracle reads and was corrected in Version 2, see A zero supply legacy pool blocks the aggregator.
Temporary liquidity can still inflate a legacy source’s stored TVL through permissionless checkpointing, a risk accepted by Curve, see Temporary liquidity can increase a legacy source’s weight. Inflation at registration was corrected in Version 2 by starting new legacy sources with zero stored TVL; since Version 3, registration also takes a checkpoint so that the phase-in starts at registration, see Initial legacy TVL can be inflated.
The general subjects covered are error handling, administrative configuration, code maintainability, event handling, and gas efficiency. Version 2 corrected the pool-registration issues and improved source validation. Version 3 made source removal independent of source indices, bounded the TVL averaging window, and prevented extreme liquidity floors from blocking price calculations. Safe operation depends on trusted administration selecting independent sources and suitable parameters.
The reviewed codebase provides a high level of security following the corrections in Version 2 and Version 3, provided proper administration and parameter selection. All remaining findings are accepted or acknowledged risks.
It is important to note that security audits are time-boxed and cannot uncover all vulnerabilities. They complement but don’t replace other vital measures to secure a project.