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

minhtrng - Stable prices pose risk in times of volatility #240

Closed
sherlock-admin opened this issue Jul 4, 2023 · 0 comments
Closed

minhtrng - Stable prices pose risk in times of volatility #240

sherlock-admin opened this issue Jul 4, 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 4, 2023

minhtrng

medium

Stable prices pose risk in times of volatility

Summary

The project enables usage of stable prices for oracles. This poses a risk if the price turns out to be not so stable after all.

Vulnerability Detail

The function Oracle.getUnderlyingPrice enables returning a stable price as oracle price:

function getUnderlyingPrice(address underlying)
    virtual
    external
    view
    returns(int256 answer)
{
    if (stablePrice[underlying] != 0) {
        return stablePrice[underlying];
    }

This can and has caused issues in the past (for reference). Even though the price is not hardcoded here, a change is only possible through governance, which might not be flexible and fast enough to adjust to changing environments

Impact

Price mismatch between oracle and market can cause bad behavior (e.g. reporting enough margin although there is not)

Code Snippet

https://github.com/sherlock-audit/2023-04-hubble-exchange/blob/1f9a5ed0ca8f6004bbb7b099ecbb8ae796557849/hubble-protocol/contracts/Oracle.sol#L30-L32

Tool used

Manual Review

Recommendation

Remove the feature of stable prices

Duplicate of #69

@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