Lack of checks on Staleness of Chainlink data #362
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
Lines of code
https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/oracles/PegOracle.sol#L58-L63
https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/Controller.sol#L308-L309
https://github.com/code-423n4/2022-09-y2k-finance/blob/2175c044af98509261e4147edeb48e1036773771/src/oracles/PegOracle.sol#L103
Vulnerability details
Impact
In
PegOracle.latestRoundData()
, whenpriceFeed1.latestRoundData()
is called there are no checks whether the data is stale or not. This could lead to the oracle reporting incorrect prices which can negatively affect hedge and risk users, e.g. the oracle reports a price of 1.0 even if a depeg has occurred.Additionally, even though all other sections of code which use oracles do check that
answeredInRound >= round
, it may be the case that the chain link nodes have stopped working and therefore not updated to a new round in a very long time causing the data to be stale.Tools Used
VS Code
Recommended Mitigation Steps
Add checks for staleness of data including checking the timestamp of the data e.g.
The text was updated successfully, but these errors were encountered: