Open code423n4 opened 1 year ago
0xean marked the issue as duplicate of #88
0xean changed the severity to 2 (Med Risk)
0xean marked the issue as satisfactory
0xean marked the issue as selected for report
To share more info related to this topic:
oracle.updatePrice
is invoked. If no one invokes this update function for an asset later used indirectly by another user, and the difference between the price offered by the TWAP oracle and the rest of the oracles (i.e. Chainlink) is greater than a threshold configure in our Oracle system, the TX will be also reverted. Could this generate a DoS? I suppose that potentially it can do it, but as soon as a user interact with the "staled" asset in Venus the block will disappear@chechu - I believe I should mark #104 as a dupe of this as well. Since this issue talks about both prices updated and accruing interests.
we assume the prices in the rest of the markets will be updated frequently because they are updated every time other users interact directly with these other markets
This assumption I think has risks in which the wardens are calling out. Its hard to say how real these risks are apriori without making assumptions about usage of all the markets.
I think these issues should be batched together over concerns around accrueInterest and price updates into a single M issue.
This assumption I think has risks in which the wardens are calling out. Its hard to say how real these risks are apriori without making assumptions about usage of all the markets.
@0xean IMHO I think the risk is low, but I could understand the concern and the lack of a guarantee in the code.
Regarding grouping this and #104, #104 only mentions the outdated interests and this mentions the outdated interest and the outdated prices. So, up to you, you are the judge :)
Sorry, I meant duping #104 against this. thanks for the response, will judge accordingly!
0xean marked the issue as duplicate of #486
Issues mentioning both will receive 100% credit while issues mentioning one will receive 50%
0xean marked the issue as not a duplicate
0xean marked the issue as primary issue
Lines of code
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Comptroller.sol#L199 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Comptroller.sol#L299 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Comptroller.sol#L324 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Comptroller.sol#L553 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Comptroller.sol#L1240 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Comptroller.sol#L1255 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Comptroller.sol#L578
Vulnerability details
Impact
Incorrect borrowBalance and token collateral values. Could lead to many different exploits, such has:
Proof of Concept
In the
Comptroller
, the total collateral balance and borrow balance is calculated at_getHypotheticalLiquiditySnapshot(...)
. This function calculates these balances in the following loop:As can be seen, the oracle price is not updated via calling
updatePrice(...)
, nor the borrow interest is updated by callingAccrueInterest(...)
. Only the correspondingVToken
that called theborrow(...)
, transfer(...)or
redeem(...)` has an updated price and interest, which could lead to critical inaccuracies for accounts with several VTokens.Tools Used
Vscode, Hardhat
Recommended Mitigation Steps
Update the price and interest of every collateral except the VToken that triggered the hook, which has already been updated. Similarly to what is being done on
healAccount(...)
.Assessed type
Oracle