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 23, 2023
· 0 comments
Labels
DuplicateA valid issue that is a duplicate of an issue with `Has Duplicates` labelHighA valid High severity issueRewardA payout will be made for this issue
Price from Chainlink DAI/ETH is in terms of ETH, i.e. returns how much ETH costs 1 DAI. But protocol assumes it returns how much DAI costs 1 ETH, resulting in broken math.
Vulnerability Detail
This vulnerability is close to using 8 decimals instead of 18 for priceFeedDAIETH oracle, but is distinct because it uses price from oracle in wrong way. Protocol uses this oracle:
Or convert value from DAI/ETH to ETH/DAI, but I'm not sure about rounding issue:
(, int256priceDaiEth, , , ) = priceFeedDAIETH.latestRoundData();
// (1e8 / priceDaiEth) ---- means how much times of 1 DAI to take to get 1 ETH// 1e18 * (...) ---- multiplies price to 18 decimalsuint256 priceEthDai =1e18* (1e8/ priceDaiEth);
return
(wethPriceUSD *1e18) /
((DAIWethPrice + priceEthDai) /2);
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` labelHighA valid High severity issueRewardA payout will be made for this issue
T1MOH
high
StableOracleDAI values DAI at $2
Summary
Price from Chainlink DAI/ETH is in terms of ETH, i.e. returns how much ETH costs 1 DAI. But protocol assumes it returns how much DAI costs 1 ETH, resulting in broken math.
Vulnerability Detail
This vulnerability is close to using 8 decimals instead of 18 for priceFeedDAIETH oracle, but is distinct because it uses price from oracle in wrong way. Protocol uses this oracle:
But oracle returns 1 DAI = 0.00055 ETH
It results in wrong formula accounting (suppose 1 ETH = 1820 DAI):
Impact
It will overvalue DAI as collateral, resulting in undercollateralisation of protocol.
Code Snippet
https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/oracles/StableOracleDAI.sol#L50-L52
https://github.com/sherlock-audit/2023-05-USSD/blob/main/ussd-contracts/contracts/oracles/StableOracleDAI.sol#L24-L26
Tool used
Manual Review
Recommendation
Duplicate of #236
The text was updated successfully, but these errors were encountered: