You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.
sherlock-admin opened this issue
May 23, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Check for stale data before trusting Chainlink's response
Summary
Lack of checks for round completeness may result in the utilization of stale prices, leading to incorrect price return values or outdated pricing information. Consequently, functions that depend on accurate price feeds may not operate as intended, potentially resulting in financial losses.
Vulnerability Detail
While Chainlinks' latestRoundData() function is used along with other oracles in StablOracleDAI.sol, in StablOracleWBTC.sol and StableOracleWETH.sol it is used as an only source for getting real world price. The problem though lies in the usage of this function.
As Chainlink recommends:
Your application should track the latestTimestamp variable or use the updatedAt value from the latestRoundData() function to make sure that the latest answer is recent enough for your application to use it. If your application detects that the reported answer is not updated within the heartbeat or within time limits that you determine are acceptable for your application, pause operation or switch to an alternate operation mode while identifying the cause of the delay.
So it is recommended to use extra informations provided in latestRoundData function, such as:
If answeredInRound is less than roundId, the answer is being carried over.
A timestamp with zero value means the round is not complete and should not be used.
Impact
Functions that depend on accurate price feeds may not operate as intended, potentially resulting in financial losses.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelMediumA valid Medium severity issueRewardA payout will be made for this issue
Kose
medium
Check for stale data before trusting Chainlink's response
Summary
Lack of checks for round completeness may result in the utilization of stale prices, leading to incorrect price return values or outdated pricing information. Consequently, functions that depend on accurate price feeds may not operate as intended, potentially resulting in financial losses.
Vulnerability Detail
While Chainlinks'
latestRoundData()
function is used along with other oracles in StablOracleDAI.sol, in StablOracleWBTC.sol and StableOracleWETH.sol it is used as an only source for getting real world price. The problem though lies in the usage of this function.As Chainlink recommends:
So it is recommended to use extra informations provided in
latestRoundData
function, such as:answeredInRound
is less than roundId, the answer is being carried over.timestamp
with zero value means the round is not complete and should not be used.Impact
Functions that depend on accurate price feeds may not operate as intended, potentially resulting in financial losses.
Code Snippet
StableOracleDAI.sol#L48
StableOracleWBTC.sol#L48
StableOracleWETH.sol#L23
Tool used
Manual Review
Recommendation
Instead of just taking
price
from Chainlinks'latestRoundData()
function, get all return values as commented out in StableOracleDAI.sol#L47//(uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound) = priceFeedDAIETH.latestRoundData();
and to make sure that the data is not stale, use checks such as:
before returning
price
.Duplicate of #31
The text was updated successfully, but these errors were encountered: