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 Jan 7, 2024. It is now read-only.
sherlock-admin opened this issue
Jul 3, 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
Lack of validation to check whether or not the return value would be a stale price data
Summary
Within the Oracle#getUnderlyingPrice(), the AggregatorV3Interface#latestRoundData(), which is made by the Chainlink, would be called to get the latest underlying token price data.
However, there is no validation to check whether or not the return value would be a stale price data.
This could lead to retrieving the stale prices.
Within the Oracle#getUnderlyingPrice(), consider adding the validations in order to check whether or not the retrieved-price via the AggregatorV3Interface#latestRoundData() would be a stale price data like this:
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
0xmuxyz
medium
Lack of validation to check whether or not the return value would be a stale price data
Summary
Within the Oracle#
getUnderlyingPrice()
, the AggregatorV3Interface#latestRoundData()
, which is made by the Chainlink, would be called to get the latest underlying token price data.However, there is no validation to check whether or not the return value would be a stale price data.
This could lead to retrieving the stale prices.
Vulnerability Detail
Within the Oracle#
getUnderlyingPrice()
, the AggregatorV3Interface#latestRoundData()
, which is made by the Chainlink, would be called to get the latest underlying token price data like this:https://github.com/sherlock-audit/2023-04-hubble-exchange/blob/main/hubble-protocol/contracts/Oracle.sol#L33-L35
However, there is no validation to check whether or not the return value would be a stale price data.
This could lead to retrieving the stale prices.
Here is a related-report that is previously reported:
code-423n4/2021-05-fairside-findings#70
Impact
The Oracle#
getUnderlyingPrice()
above would be called in the multiple functions like below:Within the AMM#
getOptimalPnl()
, the Oracle#getUnderlyingPrice()
would be called like this:https://github.com/sherlock-audit/2023-04-hubble-exchange/blob/main/hubble-protocol/contracts/AMM.sol#L340
Within the AMM#
lastPrice()
, the Oracle#getUnderlyingPrice()
would be called like this:https://github.com/sherlock-audit/2023-04-hubble-exchange/blob/main/hubble-protocol/contracts/AMM.sol#L394
Within the the AMM#
getUnderlyingPrice()
, the Oracle#getUnderlyingPrice()
would be called like this:https://github.com/sherlock-audit/2023-04-hubble-exchange/blob/main/hubble-protocol/contracts/AMM.sol#L400
Thus, a stale price data may be retrieved and used in these functions above.
Code Snippet
Tool used
Manual Review
Recommendation
Within the Oracle#
getUnderlyingPrice()
, consider adding the validations in order to check whether or not the retrieved-price via the AggregatorV3Interface#latestRoundData()
would be a stale price data like this:Duplicate of #18
The text was updated successfully, but these errors were encountered: