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 24, 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
Chainlink Oracle priceFeed Data May Return Stale Prices
Summary
The StableOracleWBTC, StableOracleWETH, and StableOracleDAI contract does not sufficiently validate the Chainlink oracle data feed for stale prices. If stale prices are used, it could lead to inaccuracies in calculations depending on the price.
Vulnerability Detail
In the StableOracle contract, the getPriceUSD function retrieves the price of Token in USD using Chainlink's latestRoundData function, without validating the freshness of the returned price. It simply takes the price from the returned data, ignoring other returned parameters such as roundId and answeredInRound. According to Chainlink's documentation, comparing answeredInRound against the current roundId can help determine whether the returned answer is fresh or not. also it not check price > 0.
function getPriceUSD() externalviewoverridereturns (uint256) {
//(uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound) = priceFeed.latestRoundData();
(, int256price, , , ) = priceFeed.latestRoundData();
// chainlink price data is 8 decimals for WETH/USDreturnuint256(price) *1e10;
}
Impact
The failure to validate the freshness of the price may result in the usage of stale prices, leading to incorrect calculations where price matters.
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
0xPkhatri
medium
Chainlink Oracle priceFeed Data May Return Stale Prices
Summary
The StableOracleWBTC, StableOracleWETH, and StableOracleDAI contract does not sufficiently validate the Chainlink oracle data feed for stale prices. If stale prices are used, it could lead to inaccuracies in calculations depending on the price.
Vulnerability Detail
In the StableOracle contract, the getPriceUSD function retrieves the price of Token in USD using Chainlink's latestRoundData function, without validating the freshness of the returned price. It simply takes the price from the returned data, ignoring other returned parameters such as roundId and answeredInRound. According to Chainlink's documentation, comparing answeredInRound against the current roundId can help determine whether the returned answer is fresh or not. also it not check price > 0.
Impact
The failure to validate the freshness of the price may result in the usage of stale prices, leading to incorrect calculations where price matters.
Code Snippet
https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/oracles/StableOracleDAI.sol#L48
https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/oracles/StableOracleWETH.sol#L23
https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/oracles/StableOracleWBTC.sol#L23
Tool used
Manual Review
Recommendation
please verify whether the price is fresh or stale.
Duplicate of #31
The text was updated successfully, but these errors were encountered: