Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

p-tsanev - Oracle.sol#getUnderlyingPrice/getLatestRoundData - no additional checks for stale return data #20

Closed
sherlock-admin opened this issue Jul 3, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented Jul 3, 2023

p-tsanev

medium

Oracle.sol#getUnderlyingPrice/getLatestRoundData - no additional checks for stale return data

Summary

The Oracle.sol serves the purpose of providing accurate prices for the provided underlying assets, using the AggregatorV3's latestRoundData function if no stable price is defined for the given asset. Due to lack of checks on the additional return data other than the price, stale data can be passed back to the other contracts.

Vulnerability Detail

In Oracle.sol's getUnderlyingPrice(address underlying) we check for the existence of a stable price for said asset and if it is 0, a.k.a not initialized then we get the data from the oracle. A check is done to confirm the returned price (answer in the contract) is positive, but never check the other returned variables to confirm that the data is not stale.

Impact

This could lead to stale prices thus disrupting calculations and leading to unexpected damage to funds inside the protocol.

Code Snippet

https://github.com/sherlock-audit/2023-04-hubble-exchange/blob/main/hubble-protocol/contracts/Oracle.sol#L107-L123

https://github.com/sherlock-audit/2023-04-hubble-exchange/blob/main/hubble-protocol/contracts/Oracle.sol#L24-L36

Tool used

Manual Review

Recommendation

There are tons of related reports mitigating this risk like:
code-423n4/2021-05-fairside-findings#70
sherlock-audit/2023-02-blueberry-judging#94

Duplicate of #18

@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Jul 10, 2023
@sherlock-admin2 sherlock-admin2 added the Reward A payout will be made for this issue label Jul 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

2 participants