Skip to content
Business logic Audit finding Intermediate

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.

HonorLt Follow with 0x52

Originally disclosed on Sherlock

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

https://github.com/sherlock-audit/2022-11-isomorph/blob/main/contracts/Isomorph/contracts/CollateralBook.sol#L185-L195

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.

The original report as published on Sherlock, by HonorLt. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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.

More by HonorLt

View all

13 more disclosed reports, best first.

More from Isomorph

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.