Outstanding loans cannot be closed or liquidated if collateral is paused
Pausing a collateral type set its validity flag to false, which caused loan closure and liquidation functions to revert. This trapped users' funds and prevented the protocol from liquidating bad debt.
Source: https://github.com/sherlock-audit/2022-11-isomorph-judging/issues/57
Found by
HonorLt, 0x52
Summary
When a collateral is paused by governance, collateralValid is set to false. This causes closing and liquidating of loans to be impossible, leading to two issues. The first is that users with exist loans are unable to close their loans to recover their collateral. The second is that since debt is impossible to liquidate the protocol could end up being stuck with a lot of bad debt.
Vulnerability Detail
function pauseCollateralType(
address _collateralAddress,
bytes32 _currencyKey
) external collateralExists(_collateralAddress) onlyAdmin {
require(_collateralAddress != address(0)); //this should get caught by the collateralExists check but just to be careful
//checks two inputs to help prevent input mistakes
require( _currencyKey == collateralProps[_collateralAddress].currencyKey, "Mismatched data");
collateralValid[_collateralAddress] = false;
collateralPaused[_collateralAddress] = true;
}
When a collateral is paused collateralValid[_collateralAddress] is set to false. For Vault_Lyra Vault_Synths and Vault_Velo this will cause closeLoan and callLiquidation to revert. This traps existing users and prevents liquidations which will result in bad debt for the protocol
Impact
Outstanding loans cannot be closed or liquidated, freezing user funds and causing the protocol to take on bad debt
Code Snippet
Tool used
Manual Review
Recommendation
Allow liquidations and loan closure when collateral is paused
Discussion
kree-dotcom
Fixed. https://github.com/kree-dotcom/isomorph/commit/9fef84211c150a6d184b2c492f77fa13b8adc61b
By decoupling the switching of the CollateralValid mapping in the CollateralBook.sol from CollateralPaused we can now introduce an additional check in OpenLoan() of require(!collateralBook.collateralPaused(_collateralAddress), "Paused collateral!");
This means increaseCollateralAmount(), closeLoan() and callLiquidation() can all occur for paused collaterals.
0x00052
Fixes look good. Pausing collateral no longer marks the collateral as invalid, allowing vault actions to be carried out when collateral is paused. OpenLoan now reverts if collateral is 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 pause function set the collateral's validity to false, and the vault functions checked validity before allowing close or liquidation, so pausing blocked those actions.
Impact
Outstanding loans could not be closed or liquidated, freezing user funds and potentially causing the protocol to accumulate bad debt.
What the attacker needed
Collateral type is paused by governance; existing loan using that collateral
The fix
The fix decoupled the validity flag from the pause state and added a check in OpenLoan to reject paused collateral, so close and liquidation still work when paused.
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.
In a lending protocol, users lock up collateral to borrow assets. If the protocol pauses a type of collateral, it should still let users close their loans or let the protocol liquidate unhealthy ones. Here, pausing also marked the collateral as invalid, so those essential actions stopped working, trapping funds and risking bad debt.
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.