This repository has been archived by the owner on May 26, 2023. It is now read-only.
tives - IchiLpOracle returns inflated price due to invalid calculation #254
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
tives
high
IchiLpOracle returns inflated price due to invalid calculation
Summary
IchiLpOracle
returns inflated price due to invalid calculationVulnerability Detail
If you run the tests, then you can see that IchiLpOracle returns inflated price for the ICHI_USDC vault
As the documentation says, the token price should be in USD with 18 decimals of precision. The price returned here is
1101189125194_558706411110851447
This is 1.1 trillion USD when considering the 18 decimals.The test uses real values except for mocking ichi and usdc price, which are returned by the mock with correct decimals (1e18 and 1e6)
Impact
IchiLpOracle
price is used in_validateMaxLTV
(collToken is the vault). Therefore the collateral value is inflated and users can open bigger positions than their collateral would normally allow.Code Snippet
link
Tool used
Manual Review
Recommendation
Fix the LP token price calculation. The problem is that you multiply totalReserve with extra 1e18 (
return (totalReserve * 1e18) / totalSupply;)
.The text was updated successfully, but these errors were encountered: