Skip to content
This repository has been archived by the owner on Nov 26, 2023. It is now read-only.

peanuts - StableOracleWBTC.sol does not use the WBTC/USD pricefeed #74

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

Comments

@sherlock-admin
Copy link
Contributor

sherlock-admin commented May 23, 2023

peanuts

high

StableOracleWBTC.sol does not use the WBTC/USD pricefeed

Summary

The priceFeed in the constructor of StableOracleWBTC.sol is the ETH/USD feed, not WBTC/USD feed. getPriceUSD() will return the price of ETH instead of WBTC.

Vulnerability Detail

The priceFeed in StableOracleWBTC.sol uses 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419, which is the ETH/USD price feed.
Ref: https://data.chain.link/ethereum/mainnet/crypto-usd/eth-usd

contract StableOracleWBTC is IStableOracle {
    AggregatorV3Interface priceFeed;

    constructor() {
        priceFeed = AggregatorV3Interface(
            0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
        );
    }

Impact

The getPriceUSD() of StableOracleWBTC.sol will return the ETH price in USD instead of the WBTC price

Code Snippet

https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/oracles/StableOracleWBTC.sol#L12-L19

Tool used

Manual Review

Recommendation

Use the proper contract address. Recommend using the wBTC/BTC and BTC/USD price feeds together (Chainlink does not have a wBTC/USD price feed) and do the appropriate conversion instead of just BTC/USD price feed because wBTC may depeg from BTC, making BTC/USD price feed unreliable to read WBTC prices.

wBTC/BTC: 0xfdfd9c85ad200c506cf9e21f1fd8dd01932fbb23
https://data.chain.link/ethereum/mainnet/crypto-other/wbtc-btc

BTC/USD: 0xf4030086522a5beea4988f8ca5b36dbc97bee88c
https://data.chain.link/ethereum/mainnet/crypto-usd/btc-usd

Duplicate of #817

@github-actions github-actions bot closed this as completed Jun 5, 2023
@github-actions github-actions bot added High A valid High severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Jun 5, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Jun 23, 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 High A valid High severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

1 participant