_getHypotheticalLiquiditySnapshot function is used to calculate the health of all vToken collateral of the user. The problem here is accrueInterest function is not being called to update the interest when all vTokens are counted. As a result, the user's position is healthier than the actual situation.
Proof of Concept
The user has borrowed a lot of vTokens and has reached the liquidation threshold
However, since the interest has not been updated, the user himself is healthy, and it is still possible to redeem and borrow
Tools Used
manual
Recommended Mitigation Steps
function _getHypotheticalLiquiditySnapshot(
address account,
VToken vTokenModify,
uint256 redeemTokens,
uint256 borrowAmount,
function(VToken) internal view returns (Exp memory) weight
) internal view returns (AccountLiquiditySnapshot memory snapshot) {
// For each asset the account is in
VToken[] memory assets = accountAssets[account];
uint256 assetsCount = assets.length;
for (uint256 i; i < assetsCount; ++i) {
VToken asset = assets[i];
+ asset.accrueInterest();
Lines of code
https://github.com/code-423n4/2023-05-venus/blob/main/contracts/Comptroller.sol#L1307
Vulnerability details
Impact
_getHypotheticalLiquiditySnapshot
function is used to calculate the health of all vToken collateral of the user. The problem here isaccrueInterest
function is not being called to update the interest when all vTokens are counted. As a result, the user's position is healthier than the actual situation.Proof of Concept
Tools Used
manual
Recommended Mitigation Steps
Assessed type
Other