This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
0xpiken - ChainLink price feed address for collateral with index 0 might be updated mistakenly #62
Labels
Excluded
Excluded by the judge without consulting the protocol or the senior
Non-Reward
This issue will not receive a payout
0xpiken
high
ChainLink price feed address for collateral with index 0 might be updated mistakenly
Summary
ChainLink price feed address for collateral with index 0 might be updated mistakenly
Vulnerability Detail
UbiquityPoolFacet#setCollateralChainLinkPriceFeed()
is used to update chainLink price feed address and its threshold as well.When
LibUbiquityPool#setCollateralChainLinkPriceFeed()
is called, first it will read the collateral index, then update the chainLink price feed address and threshold based on the index:However,
collateralIndex
will be 0 for any collateral address which has not been supported yet. Therefore the chainlink price feed address and threshold of collateral stored in index 0 will be accidentally updated.Copy below codes into UbiquityPoolFacetTest.t.sol and run
forge test --match-test testSetCollateralChainLinkPriceFeed_UpdateToInvalidFeedAddress()
:Impact
Because
mintDallor()
andredeemDollar()
completely dependent on price feed address to obtain collateral price, a malicious user might exploit the system by over minting uAD or redeeming collateral, potentially resulting in profit for themself.Code Snippet
https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar/packages/contracts/src/dollar/facets/UbiquityPoolFacet.sol#L155-L165
https://github.com/sherlock-audit/2023-12-ubiquity/blob/main/ubiquity-dollar/packages/contracts/src/dollar/libraries/LibUbiquityPool.sol#L700-L726
Tool used
Manual Review
Recommendation
Use
collateralIndex
as parameter directly instead ofcollateralAddress
insetCollateralChainLinkPriceFeed()
:The text was updated successfully, but these errors were encountered: