The protocol shouldn't charge interests when paused
The protocol continued to accrue interest on loans while vaults and collateral types were paused, even though users could not add collateral or close their loans during that time. This could force users to pay more interest than expected or make their loans unexpectedly liquidatable.
hansfriese Follow with rvierdiiev
Originally disclosed on Sherlock
Source: https://github.com/sherlock-audit/2022-11-isomorph-judging/issues/234
Found by
hansfriese, rvierdiiev
Summary
The protocol charges interest from users using virtualPrice and it increases when the protocol is paused.
As a result, users would be forced to pay more interests and experience an unexpected liquidation.
Vulnerability Detail
The protocol has 3 kinds of the vault and each one has pause/unpause option by pausers.
Also, each collateral would be paused using CollateralBook.pauseCollateralType().
But it updates the virtualPrice during the paused period and the below scenarios would be possible.
Scenario 1
- A user
Aliceopened a loan using some collaterals. - The vault was paused for a while for some unexpected reason.
- Meanwhile, her loan was changed to a
liquidatableone but she can't add collaterals(or close the loan) in the paused state. - After the protocol is unpaused, she's trying to protect her loan by adding collaterals but
Bobcan liquidate her loan with front running. - Even if her loan isn't liquidated, she should pay interests during the paused period and it's not fair for her.
Scenario 2
- A user
Aliceopened a loan withminOpeningMargin = 101%. - After the protocol was paused for some reason, the admin decided to change
minOpeningMargin = 105%. Alicewants to close her loan before it's applied because it's too high for her but she can't because it's paused.- After the new
minOpeningMarginis applied,Alicewill be forced to pay interests of the higherminOpeningMarginfor the paused period.
When I check other protocols to charge interests, it's normal to enable some ways to protect their loans during the paused period for users.
Currently, all functions don't work in the paused mode and it shouldn't charge interests in this case.
Impact
Users might be forced to pay more interests or their loans might be liquidated unexpectedly.
Code Snippet
https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/CollateralBook.sol#L127 https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Base_ERC20.sol#L85 https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Velo.sol#L141 https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Base_ERC20.sol#L203-L221 https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/Vault_Velo.sol#L248-L265
Tool used
Manual Review
Recommendation
We shouldn't increase the virtualPrice during the paused period.
Discussion
kree-dotcom
This was a design decision but we have decided to change it so that users can closeLoans, addCollateral or be liquidated when a collateral/vault is Paused.
Fixed here https://github.com/kree-dotcom/isomorph/commit/be279b394931393feaa119bc2ebe7d6bfeb575ba Collateral pausing has been modified to match Vault pausing. Because a user can closeLoan, addCollateral or be liquidated while a collateral is paused there is no reason to freeze interest accruing on the collateral. Like a paused Vault, the only action not possible when a collateral is paused is openLoan()
0x00052
Fixes look good. Reverting another fix, allowing interest to accrue while paused
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the interest calculation (virtualPrice) was not frozen during pause, while all user actions that could mitigate risk were disabled.
Impact
Users could be forced to pay more interest or have their loans liquidated unexpectedly.
What the attacker needed
A loan opened on the protocol; vault or collateral paused by pauser
The fix
The protocol was fixed so that users can close loans, add collateral, or be liquidated while paused, and interest continues to accrue only because those actions are possible.
How it was found
- A user opens a loan using collateral.
- The vault or collateral type is paused for some reason.
- Interest continues to accrue via virtualPrice during the pause.
- The user cannot add collateral or close the loan while paused.
- After unpausing, the user may be liquidated or owe more interest.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A lending protocol lets people borrow money by locking up collateral. Normally, if the value of the collateral drops, the borrower can add more collateral or repay the loan to avoid liquidation. But when the protocol was paused, those protective actions were blocked while interest kept growing, so borrowers could be caught out.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.