Open code423n4 opened 1 year ago
minhquanym marked the issue as primary issue
To summary, in AnchoredViewRelay
, both currentValue()
and peekValue()
will call to relay.peekValue()
0xShaito marked the issue as disagree with severity
The implementations used in anchoredViewOracle do not need state changes and their prices are readily available at any time and correct as it uses chainlink and uniswap.
currentValue is meant as a fix for other types of oracles that actually need to update state like curve pools to avoid manipulations.
dmvt changed the severity to QA (Quality Assurance)
dmvt marked the issue as grade-b
Lines of code
https://github.com/code-423n4/2023-07-amphora/blob/daae020331404647c661ab534d20093c875483e1/core/solidity/contracts/periphery/oracles/AnchoredViewRelay.sol#L74
Vulnerability details
Impact
AnchoredViewRelay
is a mechanism that uses two independent oracles and checks whether the price from the main oracle does not deviate too much from the auxiliary oracle. An oracle usingAnchoredViewRelay
and the next two pairs can be added as the main and auxiliary oracle. ThecurrentValue
function is used to retrieve the current price, which is intended to provide always up-to-date prices. The basicOracleRelay
implementation from whichAnchoredViewRelay
inherits also includes thepeekValue
function, which is widely used in the system and by definition does not have to, but may guarantee the current price. The problem will arise if the pair inAnchoredViewRelay
is paired with an oracle that does not return the current price withpeekValue
but withcurrentValue
(e.g. similar toCbEthEthOracle.sol
). Although the price at the highest level (i.e. fromAnchoredViewRelay
) will be retrieved usingcurrentValue
, it retrieves prices from its oracles usingpeekValue
, which may result in outdated prices.Proof of Concept
Tools Used
Manual review
Recommended Mitigation Steps
AnchoredViewRelay
should have separatecurrentValue
andpeekValue
implementations, and each should use the appropriate functions from the underlying oracles.Assessed type
Oracle