Chainlink's latestRoundData is used here to retrieve price feed data, however there is insufficient protection against price staleness.
Return arguments other than int256 answer are necessary to determine the validity of the returned price, as it is possible for an outdated price to be received. See here for reasons why a price feed might stop updating.
The return value updatedAt contains the timestamp at which the received price was last updated, and can be used to ensure that the price is not outdated. See more information about latestRoundID in the Chainlink docs. Inaccurate price data can lead to functions not working as expected and/or lost funds.
Lines of code
https://github.com/code-423n4/2023-06-stader/blob/main/contracts/StaderOracle.sol#L646 https://github.com/code-423n4/2023-06-stader/blob/main/contracts/StaderOracle.sol#L648
Vulnerability details
Impact
Chainlink's
latestRoundData
is used here to retrieve price feed data, however there is insufficient protection against price staleness.Return arguments other than
int256 answer
are necessary to determine the validity of the returned price, as it is possible for an outdated price to be received. See here for reasons why a price feed might stop updating.The return value
updatedAt
contains the timestamp at which the received price was last updated, and can be used to ensure that the price is not outdated. See more information aboutlatestRoundID
in the Chainlink docs. Inaccurate price data can lead to functions not working as expected and/or lost funds.Proof of Concept
Tools Used
Manual Review
Recommended Mitigation Steps
Add a check for the
updatedAt
returned value fromlatestRoundData
.Assessed type
Oracle