Platform: Code4rena
Start Date: 25/10/2022
Pot Size: $50,000 USDC
Total HM: 18
Participants: 127
Period: 5 days
Judge: 0xean
Total Solo HM: 9
Id: 175
League: ETH
Rank: 93/127
Findings: 1
Award: $24.22
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: adriro
Also found by: 8olidity, BClabs, CertoraInc, Chom, Franfran, Lambda, RaoulSchaffranek, Ruhum, codexploder, cryptphi, eierina, joestakey, kaden, neumo, pashov, rvierdiiev, sorrynotsorry
24.2165 USDC - $24.22
https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L53 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L87-L88 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Oracle.sol#L121-L122 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L396 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L462 https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L567
In an event where the Oracle contract operator sets the feed tokenDecimals value to 36 in Oracle.setFeed() , the call to Oracle.viewPrice would always return the non-scaled value of token price if feedDecimals is 0, since uint8 decimals = 36 - feedDecimals - tokenDecimals;
in Oracle.getPrice() and Oracle.viewPrice() will output the value 0 , and uint normalizedPrice = price * (10 ** decimals); == feeds[token].feed.latestAnswer()
Due to this the following functions would revert since they will not be able to pass the require() checks; Market.borrowInternal() - https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L396 Market.withdrawInternal() - https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L462 Market.forceReplenish() - https://github.com/code-423n4/2022-10-inverse/blob/main/src/Market.sol#L567
Manual review
Apply some value checks when setting the tokenDecimals for the token.
#0 - c4-judge
2022-11-05T19:58:12Z
0xean marked the issue as duplicate
#1 - c4-judge
2022-11-28T16:07:24Z
0xean marked the issue as not a duplicate
#2 - c4-judge
2022-11-28T16:07:32Z
0xean marked the issue as duplicate of #540
#3 - Simon-Busch
2022-12-05T15:33:04Z
Issue marked as satisfactory as requested by 0xean
#4 - c4-judge
2022-12-07T08:18:20Z
Simon-Busch marked the issue as duplicate of #533